1 | "use strict";
|
---|
2 | /**
|
---|
3 | * @license
|
---|
4 | * Copyright Google LLC All Rights Reserved.
|
---|
5 | *
|
---|
6 | * Use of this source code is governed by an MIT-style license that can be
|
---|
7 | * found in the LICENSE file at https://angular.io/license
|
---|
8 | */
|
---|
9 | var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
---|
10 | if (kind === "m") throw new TypeError("Private method is not writable");
|
---|
11 | if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
---|
12 | if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
---|
13 | return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
---|
14 | };
|
---|
15 | var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
---|
16 | if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
---|
17 | if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
---|
18 | return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
---|
19 | };
|
---|
20 | var _FileEmitterRegistration_fileEmitter, _FileEmitterCollection_registrations;
|
---|
21 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
22 | exports.FileEmitterCollection = exports.FileEmitterRegistration = exports.AngularPluginSymbol = void 0;
|
---|
23 | exports.AngularPluginSymbol = Symbol.for('@ngtools/webpack[angular-compiler]');
|
---|
24 | class FileEmitterRegistration {
|
---|
25 | constructor() {
|
---|
26 | _FileEmitterRegistration_fileEmitter.set(this, void 0);
|
---|
27 | }
|
---|
28 | update(emitter) {
|
---|
29 | __classPrivateFieldSet(this, _FileEmitterRegistration_fileEmitter, emitter, "f");
|
---|
30 | }
|
---|
31 | emit(file) {
|
---|
32 | if (!__classPrivateFieldGet(this, _FileEmitterRegistration_fileEmitter, "f")) {
|
---|
33 | throw new Error('Emit attempted before Angular Webpack plugin initialization.');
|
---|
34 | }
|
---|
35 | return __classPrivateFieldGet(this, _FileEmitterRegistration_fileEmitter, "f").call(this, file);
|
---|
36 | }
|
---|
37 | }
|
---|
38 | exports.FileEmitterRegistration = FileEmitterRegistration;
|
---|
39 | _FileEmitterRegistration_fileEmitter = new WeakMap();
|
---|
40 | class FileEmitterCollection {
|
---|
41 | constructor() {
|
---|
42 | _FileEmitterCollection_registrations.set(this, []);
|
---|
43 | }
|
---|
44 | register() {
|
---|
45 | const registration = new FileEmitterRegistration();
|
---|
46 | __classPrivateFieldGet(this, _FileEmitterCollection_registrations, "f").push(registration);
|
---|
47 | return registration;
|
---|
48 | }
|
---|
49 | async emit(file) {
|
---|
50 | if (__classPrivateFieldGet(this, _FileEmitterCollection_registrations, "f").length === 1) {
|
---|
51 | return __classPrivateFieldGet(this, _FileEmitterCollection_registrations, "f")[0].emit(file);
|
---|
52 | }
|
---|
53 | for (const registration of __classPrivateFieldGet(this, _FileEmitterCollection_registrations, "f")) {
|
---|
54 | const result = await registration.emit(file);
|
---|
55 | if (result) {
|
---|
56 | return result;
|
---|
57 | }
|
---|
58 | }
|
---|
59 | }
|
---|
60 | }
|
---|
61 | exports.FileEmitterCollection = FileEmitterCollection;
|
---|
62 | _FileEmitterCollection_registrations = new WeakMap();
|
---|