@analogjs/vite-plugin-angular 0.2.0-alpha.0 → 0.2.0-alpha.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,8 +1,10 @@
1
1
  {
2
2
  "name": "@analogjs/vite-plugin-angular",
3
3
  "description": "Vite Plugin for Angular",
4
- "version": "0.2.0-alpha.0",
4
+ "version": "0.2.0-alpha.10",
5
5
  "keywords": [
6
+ "vite",
7
+ "vitest",
6
8
  "vite-plugin",
7
9
  "angular"
8
10
  ],
@@ -18,6 +20,7 @@
18
20
  },
19
21
  "peerDependencies": {
20
22
  "@angular-devkit/build-angular": "^14.0.0",
23
+ "zone.js": "~0.11.4",
21
24
  "tslib": "^2.0.0"
22
25
  },
23
26
  "main": "./src/index.js",
@@ -0,0 +1,4 @@
1
+ import 'zone.js';
2
+ import 'zone.js/dist/sync-test';
3
+ import 'zone.js/dist/proxy';
4
+ import 'zone.js/testing';
@@ -0,0 +1,116 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ require("zone.js");
4
+ require("zone.js/dist/sync-test");
5
+ require("zone.js/dist/proxy");
6
+ require("zone.js/testing");
7
+ /**
8
+ * Patch Vitest's describe/test/beforeEach/afterEach functions so test code
9
+ * always runs in a testZone (ProxyZone).
10
+ */
11
+ /* global Zone */
12
+ const Zone = globalThis['Zone'];
13
+ if (Zone === undefined) {
14
+ throw new Error('Missing: Zone (zone.js)');
15
+ }
16
+ if (globalThis['__vitest_zone_patch__'] === true) {
17
+ throw new Error("'vitest' has already been patched with 'Zone'.");
18
+ }
19
+ globalThis['__vitest_zone_patch__'] = true;
20
+ const SyncTestZoneSpec = Zone['SyncTestZoneSpec'];
21
+ const ProxyZoneSpec = Zone['ProxyZoneSpec'];
22
+ if (SyncTestZoneSpec === undefined) {
23
+ throw new Error('Missing: SyncTestZoneSpec (zone.js/dist/sync-test)');
24
+ }
25
+ if (ProxyZoneSpec === undefined) {
26
+ throw new Error('Missing: ProxyZoneSpec (zone.js/dist/proxy.js)');
27
+ }
28
+ const env = globalThis;
29
+ const ambientZone = Zone.current;
30
+ // Create a synchronous-only zone in which to run `describe` blocks in order to
31
+ // raise an error if any asynchronous operations are attempted
32
+ // inside of a `describe` but outside of a `beforeEach` or `it`.
33
+ const syncZone = ambientZone.fork(new SyncTestZoneSpec('vitest.describe'));
34
+ function wrapDescribeInZone(describeBody) {
35
+ return function (...args) {
36
+ return syncZone.run(describeBody, null, args);
37
+ };
38
+ }
39
+ // Create a proxy zone in which to run `test` blocks so that the tests function
40
+ // can retroactively install different zones.
41
+ const testProxyZone = ambientZone.fork(new ProxyZoneSpec());
42
+ function wrapTestInZone(testBody) {
43
+ if (testBody === undefined) {
44
+ return;
45
+ }
46
+ const wrappedFunc = function () {
47
+ return testProxyZone.run(testBody, null, arguments);
48
+ };
49
+ try {
50
+ Object.defineProperty(wrappedFunc, 'length', {
51
+ configurable: true,
52
+ writable: true,
53
+ enumerable: false,
54
+ });
55
+ wrappedFunc.length = testBody.length;
56
+ }
57
+ catch (e) {
58
+ return testBody.length === 0
59
+ ? () => testProxyZone.run(testBody, null)
60
+ : (done) => testProxyZone.run(testBody, null, [done]);
61
+ }
62
+ return wrappedFunc;
63
+ }
64
+ /**
65
+ * bind describe method to wrap describe.each function
66
+ */
67
+ const bindDescribe = (originalVitestFn) => function (...eachArgs) {
68
+ return function (...args) {
69
+ args[1] = wrapDescribeInZone(args[1]);
70
+ // @ts-ignore
71
+ return originalVitestFn.apply(this, eachArgs).apply(this, args);
72
+ };
73
+ };
74
+ /**
75
+ * bind test method to wrap test.each function
76
+ */
77
+ const bindTest = (originalVitestFn) => function (...eachArgs) {
78
+ return function (...args) {
79
+ args[1] = wrapTestInZone(args[1]);
80
+ // @ts-ignore
81
+ return originalVitestFn.apply(this, eachArgs).apply(this, args);
82
+ };
83
+ };
84
+ ['describe'].forEach((methodName) => {
85
+ const originalvitestFn = env[methodName];
86
+ env[methodName] = function (...args) {
87
+ args[1] = wrapDescribeInZone(args[1]);
88
+ return originalvitestFn.apply(this, args);
89
+ };
90
+ env[methodName].each = bindDescribe(originalvitestFn.each);
91
+ if (methodName === 'describe') {
92
+ env[methodName].only = env['fdescribe'];
93
+ env[methodName].skip = env['xdescribe'];
94
+ }
95
+ });
96
+ ['test', 'it'].forEach((methodName) => {
97
+ const originalvitestFn = env[methodName];
98
+ env[methodName] = function (...args) {
99
+ args[1] = wrapTestInZone(args[1]);
100
+ return originalvitestFn.apply(this, args);
101
+ };
102
+ env[methodName].each = bindTest(originalvitestFn.each);
103
+ if (methodName === 'test' || methodName === 'it') {
104
+ env[methodName].todo = function (...args) {
105
+ return originalvitestFn.todo.apply(this, args);
106
+ };
107
+ }
108
+ });
109
+ ['beforeEach', 'afterEach', 'beforeAll', 'afterAll'].forEach((methodName) => {
110
+ const originalvitestFn = env[methodName];
111
+ env[methodName] = function (...args) {
112
+ args[0] = wrapTestInZone(args[0]);
113
+ return originalvitestFn.apply(this, args);
114
+ };
115
+ });
116
+ //# sourceMappingURL=setup-vitest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup-vitest.js","sourceRoot":"","sources":["../../../packages/vite-plugin-angular/setup-vitest.ts"],"names":[],"mappings":";;AAAA,mBAAiB;AACjB,kCAAgC;AAChC,8BAA4B;AAC5B,2BAAyB;AAEzB;;;GAGG;AACH,iBAAiB;AACjB,MAAM,IAAI,GAAI,UAAkB,CAAC,MAAM,CAAC,CAAC;AAEzC,IAAI,IAAI,KAAK,SAAS,EAAE;IACtB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;CAC5C;AAED,IAAK,UAAkB,CAAC,uBAAuB,CAAC,KAAK,IAAI,EAAE;IACzD,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;CACnE;AAEA,UAAkB,CAAC,uBAAuB,CAAC,GAAG,IAAI,CAAC;AACpD,MAAM,gBAAgB,GAAG,IAAI,CAAC,kBA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AC,CAAC,UAAU,EAAE,EAAE;IAC1E,MAAM,gBAAgB,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC;IACzC,GAAG,CAAC,UAAU,CAAC,GAAG,UAAU,GAAG,IAAW;QACxC,IAAI,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAElC,OAAO,gBAAgB,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC5C,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -1,10 +1,9 @@
1
- import { BundleStylesheetOptions } from '@angular-devkit/build-angular/src/builders/browser-esbuild/stylesheets';
2
1
  import * as ts from 'typescript';
3
2
  import { Plugin } from 'vite';
4
3
  interface PluginOptions {
5
- tsconfig: string;
6
- sourcemap: boolean;
7
- advancedOptimizations: boolean;
4
+ tsconfig?: string;
5
+ workspaceRoot?: string;
6
+ inlineStylesExtension?: string;
8
7
  }
9
8
  interface EmitFileResult {
10
9
  content?: string;
@@ -13,6 +12,6 @@ interface EmitFileResult {
13
12
  hash?: Uint8Array;
14
13
  }
15
14
  declare type FileEmitter = (file: string) => Promise<EmitFileResult | undefined>;
16
- export declare function angular(pluginOptions?: PluginOptions, styleOptions?: BundleStylesheetOptions): Plugin;
15
+ export declare function angular(options?: PluginOptions): Plugin[];
17
16
  export declare function createFileEmitter(program: ts.BuilderProgram, transformers?: ts.CustomTransformers, onAfterEmit?: (sourceFile: ts.SourceFile) => void): FileEmitter;
18
17
  export {};
@@ -4,22 +4,31 @@ exports.createFileEmitter = exports.angular = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const core_1 = require("@babel/core");
6
6
  const application_1 = require("@angular-devkit/build-angular/src/babel/presets/application");
7
+ const webpack_loader_1 = require("@angular-devkit/build-angular/src/babel/webpack-loader");
7
8
  const ts = require("typescript");
8
9
  const compiler_plugin_1 = require("@angular-devkit/build-angular/src/builders/browser-esbuild/compiler-plugin");
9
10
  const load_esm_1 = require("@angular-devkit/build-angular/src/utils/load-esm");
10
- function angular(pluginOptions = {
11
- tsconfig: './tsconfig.app.json',
12
- sourcemap: false,
13
- advancedOptimizations: false,
14
- }, styleOptions = {
15
- optimization: false,
16
- sourcemap: true,
17
- }) {
11
+ const component_resolvers_1 = require("./component-resolvers");
12
+ const inline_styles_plugin_1 = require("./inline-styles-plugin");
13
+ function angular(options) {
14
+ var _a, _b, _c;
15
+ /**
16
+ * Normalize plugin options so defaults
17
+ * are used for values not provided.
18
+ */
19
+ const pluginOptions = {
20
+ tsconfig: ((_a = options === null || options === void 0 ? void 0 : options.tsconfig) !== null && _a !== void 0 ? _a : process.env['NODE_ENV'] === 'test')
21
+ ? './tsconfig.spec.json'
22
+ : './tsconfig.app.json',
23
+ workspaceRoot: (_b = options === null || options === void 0 ? void 0 : options.workspaceRoot) !== null && _b !== void 0 ? _b : process.cwd(),
24
+ inlineStylesExtension: (_c = options === null || options === void 0 ? void 0 : options.inlineStylesExtension) !== null && _c !== void 0 ? _c : '',
25
+ };
18
26
  // The file emitter created during `onStart` that will be used during the build in `onLoad` callbacks for TS files
19
27
  let fileEmitter;
20
28
  let compilerOptions = {};
21
29
  // Temporary deep import for transformer support
22
30
  const { mergeTransformers, replaceBootstrap, } = require('@ngtools/webpack/src/ivy/transformation');
31
+ const { replaceResources, } = require('@ngtools/webpack/src/transformers/replace_resources');
23
32
  const { augmentProgramWithVersioning, augmentHostWithCaching, } = require('@ngtools/webpack/src/ivy/host');
24
33
  const { SourceFileCache } = require('@ngtools/webpack/src/ivy/cache');
25
34
  let compilerCli;
@@ -29,109 +38,265 @@ function angular(pluginOptions = {
29
38
  let builderProgram;
30
39
  let watchMode = false;
31
40
  let sourceFileCache = new SourceFileCache();
32
- return {
33
- name: '@analogjs/vite-plugin-angular',
34
- config(config, { command }) {
35
- watchMode = command === 'serve';
36
- return {
37
- optimizeDeps: {
38
- exclude: ['rxjs'],
39
- esbuildOptions: {
40
- plugins: [
41
- (0, compiler_plugin_1.createCompilerPlugin)({
42
- tsconfig: pluginOptions.tsconfig,
43
- sourcemap: pluginOptions.sourcemap,
44
- advancedOptimizations: pluginOptions.advancedOptimizations,
45
- }, {
46
- sourcemap: styleOptions.sourcemap,
47
- optimization: styleOptions.optimization,
48
- }),
49
- ],
50
- },
51
- },
52
- };
53
- },
54
- buildStart() {
55
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
56
- compilerCli = yield (0, load_esm_1.loadEsmModule)('@angular/compiler-cli');
57
- const { options: tsCompilerOptions, rootNames: rn } = compilerCli.readConfiguration(pluginOptions.tsconfig, {
58
- enableIvy: true,
59
- noEmitOnError: false,
60
- suppressOutputPathCheck: true,
61
- outDir: undefined,
62
- inlineSources: pluginOptions.sourcemap,
63
- inlineSourceMap: pluginOptions.sourcemap,
64
- sourceMap: false,
65
- mapRoot: undefined,
66
- sourceRoot: undefined,
67
- declaration: false,
68
- declarationMap: false,
69
- allowEmptyCodegenFiles: false,
70
- annotationsAs: 'decorators',
71
- enableResourceInlining: false,
41
+ let isProd = process.env['NODE_ENV'] === 'production';
42
+ let isTest = process.env['NODE_ENV'] === 'test' || !!process.env['VITEST'];
43
+ let viteServer;
44
+ return [
45
+ {
46
+ name: '@analogjs/vite-plugin-angular',
47
+ config(config, { command }) {
48
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
49
+ watchMode = command === 'serve';
50
+ compilerCli = yield (0, load_esm_1.loadEsmModule)('@angular/compiler-cli');
51
+ return {
52
+ assetsInclude: ['**/*.html'],
53
+ optimizeDeps: {
54
+ esbuildOptions: {
55
+ plugins: [
56
+ (0, compiler_plugin_1.createCompilerPlugin)({
57
+ tsconfig: pluginOptions.tsconfig,
58
+ sourcemap: !isProd,
59
+ advancedOptimizations: isProd,
60
+ }, {
61
+ workspaceRoot: pluginOptions.workspaceRoot,
62
+ sourcemap: !isProd,
63
+ optimization: isProd,
64
+ }),
65
+ ],
66
+ define: {
67
+ ngDevMode: watchMode ? JSON.stringify({}) : 'false',
68
+ ngJitMode: 'false',
69
+ ngI18nClosureMode: 'false',
70
+ },
71
+ },
72
+ },
73
+ };
72
74
  });
73
- rootNames = rn;
74
- compilerOptions = tsCompilerOptions;
75
- host = ts.createIncrementalCompilerHost(compilerOptions);
76
- // Setup source file caching and reuse cache from previous compilation if present
77
- let cache = new SourceFileCache();
78
- // Only store cache if in watch mode
79
- if (watchMode) {
80
- sourceFileCache = cache;
81
- }
82
- augmentHostWithCaching(host, cache);
83
- yield buildAndAnalyze();
84
- });
85
- },
86
- handleHotUpdate(ctx) {
87
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
88
- if (/\.[cm]?tsx?$/.test(ctx.file)) {
89
- sourceFileCache.invalidate(ctx.file);
75
+ },
76
+ configureServer(server) {
77
+ viteServer = server;
78
+ server.watcher.on('add', setupCompilation);
79
+ server.watcher.on('unlink', setupCompilation);
80
+ },
81
+ buildStart() {
82
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
83
+ setupCompilation();
84
+ // Only store cache if in watch mode
85
+ if (watchMode) {
86
+ augmentHostWithCaching(host, sourceFileCache);
87
+ }
90
88
  yield buildAndAnalyze();
91
- }
92
- });
89
+ });
90
+ },
91
+ handleHotUpdate(ctx) {
92
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
93
+ if (/\.[cm]?tsx?$/.test(ctx.file)) {
94
+ sourceFileCache.invalidate(ctx.file);
95
+ yield buildAndAnalyze();
96
+ }
97
+ if (/\.(html|htm|css|less|sass|scss)$/.test(ctx.file)) {
98
+ /**
99
+ * Check to see if this was a direct request
100
+ * for an external resource (styles, html).
101
+ */
102
+ const isDirect = ctx.modules.find((mod) => { var _a; return ctx.file === mod.file && ((_a = mod.id) === null || _a === void 0 ? void 0 : _a.includes('?direct')); });
103
+ if (isDirect) {
104
+ return ctx.modules;
105
+ }
106
+ let mods = [];
107
+ ctx.modules.forEach((mod) => {
108
+ mod.importers.forEach((imp) => {
109
+ sourceFileCache.invalidate(imp.id);
110
+ ctx.server.moduleGraph.invalidateModule(imp);
111
+ mods.push(imp);
112
+ });
113
+ });
114
+ yield buildAndAnalyze();
115
+ return mods;
116
+ }
117
+ return ctx.modules;
118
+ });
119
+ },
120
+ transform(code, id) {
121
+ var _a, _b;
122
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
123
+ // Skip transforming node_modules
124
+ if (id.includes('node_modules')) {
125
+ return;
126
+ }
127
+ if (/\.[cm]?tsx?$/.test(id)) {
128
+ /**
129
+ * Re-analyze on each transform
130
+ * for test(Vitest)
131
+ */
132
+ if (isTest) {
133
+ const tsMod = viteServer.moduleGraph.getModuleById(id);
134
+ if (tsMod) {
135
+ sourceFileCache.invalidate(id);
136
+ yield buildAndAnalyze();
137
+ }
138
+ }
139
+ if (watchMode) {
140
+ if ((0, component_resolvers_1.hasTemplateUrl)(code)) {
141
+ const templateUrl = (0, component_resolvers_1.resolveTemplateUrl)(code, id);
142
+ if (templateUrl) {
143
+ this.addWatchFile(templateUrl);
144
+ }
145
+ }
146
+ if ((0, component_resolvers_1.hasStyleUrls)(code)) {
147
+ const styleUrls = (0, component_resolvers_1.resolveStyleUrls)(code, id);
148
+ styleUrls.forEach((styleUrl) => {
149
+ this.addWatchFile(styleUrl);
150
+ });
151
+ }
152
+ }
153
+ const typescriptResult = yield fileEmitter(id);
154
+ // return fileEmitter
155
+ const data = (_a = typescriptResult === null || typescriptResult === void 0 ? void 0 : typescriptResult.content) !== null && _a !== void 0 ? _a : '';
156
+ const forceAsyncTransformation = /for\s+await\s*\(|async\s+function\s*\*/.test(data);
157
+ const useInputSourcemap = (!isProd ? undefined : false);
158
+ if (!forceAsyncTransformation && !isProd) {
159
+ return {
160
+ code: isProd
161
+ ? data.replace(/^\/\/# sourceMappingURL=[^\r\n]*/gm, '')
162
+ : data,
163
+ };
164
+ }
165
+ const babelResult = yield (0, core_1.transformAsync)(data, {
166
+ filename: id,
167
+ inputSourceMap: (useInputSourcemap
168
+ ? undefined
169
+ : false),
170
+ sourceMaps: !isProd ? 'inline' : false,
171
+ compact: false,
172
+ configFile: false,
173
+ babelrc: false,
174
+ browserslistConfigFile: false,
175
+ plugins: [],
176
+ presets: [
177
+ [
178
+ application_1.default,
179
+ {
180
+ forceAsyncTransformation,
181
+ optimize: isProd && {},
182
+ },
183
+ ],
184
+ ],
185
+ });
186
+ return {
187
+ code: (_b = babelResult === null || babelResult === void 0 ? void 0 : babelResult.code) !== null && _b !== void 0 ? _b : '',
188
+ map: babelResult === null || babelResult === void 0 ? void 0 : babelResult.map,
189
+ };
190
+ }
191
+ return undefined;
192
+ });
193
+ },
93
194
  },
94
- transform(code, id) {
95
- var _a, _b;
96
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
97
- // Skip transforming node_modules
98
- if (id.includes('node_modules')) {
99
- return;
100
- }
101
- const typescriptResult = yield fileEmitter(id);
102
- // return fileEmitter
103
- const data = (_a = typescriptResult === null || typescriptResult === void 0 ? void 0 : typescriptResult.content) !== null && _a !== void 0 ? _a : '';
104
- if (/\.[cm]?tsx?$/.test(id)) {
105
- const babelResult = yield (0, core_1.transformAsync)(data, {
106
- filename: id,
107
- inputSourceMap: (pluginOptions.sourcemap
108
- ? undefined
109
- : false),
110
- sourceMaps: pluginOptions.sourcemap ? 'inline' : false,
111
- compact: false,
112
- configFile: false,
113
- babelrc: false,
114
- browserslistConfigFile: false,
115
- plugins: [],
116
- presets: [
117
- [
118
- application_1.default,
119
- {
120
- forceAsyncTransformation: data.includes('async'),
121
- optimize: pluginOptions.advancedOptimizations && {},
122
- },
195
+ {
196
+ name: '@analogjs/vite-plugin-angular-optimizer',
197
+ apply: 'build',
198
+ config() {
199
+ return {
200
+ esbuild: {
201
+ legalComments: 'none',
202
+ keepNames: false,
203
+ define: isProd
204
+ ? {
205
+ ngDevMode: 'false',
206
+ ngJitMode: 'false',
207
+ ngI18nClosureMode: 'false',
208
+ }
209
+ : undefined,
210
+ supported: {
211
+ // Native async/await is not supported with Zone.js. Disabling support here will cause
212
+ // esbuild to downlevel async/await to a Zone.js supported form.
213
+ 'async-await': false,
214
+ // Zone.js also does not support async generators or async iterators. However, esbuild does
215
+ // not currently support downleveling either of them. Instead babel is used within the JS/TS
216
+ // loader to perform the downlevel transformation. They are both disabled here to allow
217
+ // esbuild to handle them in the future if support is ever added.
218
+ // NOTE: If esbuild adds support in the future, the babel support for these can be disabled.
219
+ 'async-generator': false,
220
+ 'for-await': false,
221
+ },
222
+ },
223
+ };
224
+ },
225
+ transform(code, id) {
226
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
227
+ if (/\.[cm]?js$/.test(id)) {
228
+ const angularPackage = /[\\/]node_modules[\\/]@angular[\\/]/.test(id);
229
+ const linkerPluginCreator = (yield (0, load_esm_1.loadEsmModule)('@angular/compiler-cli/linker/babel')).createEs2015LinkerPlugin;
230
+ const forceAsyncTransformation = !/[\\/][_f]?esm2015[\\/]/.test(id) &&
231
+ /for\s+await\s*\(|async\s+function\s*\*/.test(code);
232
+ const shouldLink = yield (0, webpack_loader_1.requiresLinking)(id, code);
233
+ const useInputSourcemap = (!isProd ? undefined : false);
234
+ if (!forceAsyncTransformation && !isProd && !shouldLink) {
235
+ return {
236
+ code: isProd
237
+ ? code.replace(/^\/\/# sourceMappingURL=[^\r\n]*/gm, '')
238
+ : code,
239
+ };
240
+ }
241
+ const result = yield (0, core_1.transformAsync)(code, {
242
+ filename: id,
243
+ inputSourceMap: useInputSourcemap,
244
+ sourceMaps: !isProd ? 'inline' : false,
245
+ compact: false,
246
+ configFile: false,
247
+ babelrc: false,
248
+ browserslistConfigFile: false,
249
+ plugins: [],
250
+ presets: [
251
+ [
252
+ application_1.default,
253
+ {
254
+ angularLinker: {
255
+ shouldLink,
256
+ jitMode: false,
257
+ linkerPluginCreator,
258
+ },
259
+ forceAsyncTransformation,
260
+ optimize: isProd && {
261
+ looseEnums: angularPackage,
262
+ pureTopLevel: angularPackage,
263
+ },
264
+ },
265
+ ],
123
266
  ],
124
- ],
125
- });
126
- return {
127
- code: (_b = babelResult === null || babelResult === void 0 ? void 0 : babelResult.code) !== null && _b !== void 0 ? _b : '',
128
- map: babelResult === null || babelResult === void 0 ? void 0 : babelResult.map,
129
- };
130
- }
131
- return undefined;
132
- });
267
+ });
268
+ return {
269
+ code: (result === null || result === void 0 ? void 0 : result.code) || '',
270
+ map: result === null || result === void 0 ? void 0 : result.map,
271
+ };
272
+ }
273
+ return;
274
+ });
275
+ },
133
276
  },
134
- };
277
+ (0, inline_styles_plugin_1.inlineStylesPlugin)(pluginOptions.inlineStylesExtension),
278
+ ];
279
+ function setupCompilation() {
280
+ const { options: tsCompilerOptions, rootNames: rn } = compilerCli.readConfiguration(pluginOptions.tsconfig, {
281
+ enableIvy: true,
282
+ noEmitOnError: false,
283
+ suppressOutputPathCheck: true,
284
+ outDir: undefined,
285
+ inlineSources: !isProd,
286
+ inlineSourceMap: !isProd,
287
+ sourceMap: false,
288
+ mapRoot: undefined,
289
+ sourceRoot: undefined,
290
+ declaration: false,
291
+ declarationMap: false,
292
+ allowEmptyCodegenFiles: false,
293
+ annotationsAs: 'decorators',
294
+ enableResourceInlining: false,
295
+ });
296
+ rootNames = rn;
297
+ compilerOptions = tsCompilerOptions;
298
+ host = ts.createIncrementalCompilerHost(compilerOptions);
299
+ }
135
300
  /**
136
301
  * Creates a new NgtscProgram to analyze/re-analyze
137
302
  * the source files and create a file emitter.
@@ -156,9 +321,13 @@ function angular(pluginOptions = {
156
321
  builder = ts.createAbstractBuilder(typeScriptProgram, host);
157
322
  }
158
323
  yield angularCompiler.analyzeAsync();
159
- fileEmitter = createFileEmitter(builder, mergeTransformers(angularCompiler.prepareEmit().transformers, {
160
- before: [replaceBootstrap(() => builder.getProgram().getTypeChecker())],
161
- }), () => []);
324
+ const getTypeChecker = () => builder.getProgram().getTypeChecker();
325
+ fileEmitter = createFileEmitter(builder, mergeTransformers({
326
+ before: [
327
+ replaceBootstrap(getTypeChecker),
328
+ replaceResources(() => true, getTypeChecker, pluginOptions.inlineStylesExtension),
329
+ ],
330
+ }, angularCompiler.prepareEmit().transformers), () => []);
162
331
  });
163
332
  }
164
333
  }
@@ -1 +1 @@
1
- {"version":3,"file":"angular-vite-plugin.js","sourceRoot":"","sources":["../../../../../packages/vite-plugin-angular/src/lib/angular-vite-plugin.ts"],"names":[],"mappings":";;;;AACA,sCAA6C;AAC7C,6FAAmG;AAEnG,iCAAiC;AAGjC,gHAAkH;AAClH,+EAAiF;AAgBjF,SAAgB,OAAO,CACrB,gBAA+B;IAC7B,QAAQ,EAAE,qBAAqB;IAC/B,SAAS,EAAE,KAAK;IAChB,qBAAqB,EAAE,KAAK;CAC7B,EACD,eAAwC;IACtC,YAAY,EAAE,KAAK;IACnB,SAAS,EAAE,IAAI;CAChB;IAED,kHAAkH;IAClH,IAAI,WAAoC,CAAC;IACzC,IAAI,eAAe,GAAG,EAAE,CAAC;IACzB,gDAAgD;IAChD,MAAM,EACJ,iBAAiB,EACjB,gBAAgB,GACjB,GAAG,OAAO,CAAC,yCAAyC,CAAC,CAAC;IACvD,MAAM,EACJ,4BAA4B,EAC5B,sBAAsB,GACvB,GAAG,OAAO,CAAC,+BAA+B,CAAC,CAAC;IAC7C,MAAM,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC,gCAAgC,CAAC,CAAC;IACtE,IAAI,WAAmD,CAAC;IACxD,IAAI,SAAmB,CAAC;IACxB,IAAI,IAAqB,CAAC;IAC1B,IAAI,WAAyB,CAAC;IAC9B,IAAI,cAA2D,CAAC;IAChE,IAAI,SAAS,GAAY,KAAK,CAAC;IAC/B,IAAI,eAAe,GAAG,IAAI,eAAe,EAAE,CAAC;IAE5C,OAAO;QACL,IAAI,EAAE,+BAA+B;QACrC,MAAM,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE;YACxB,SAAS,GAAG,OAAO,KAAK,OAAO,CAAC;YAEhC,OAAO;gBACL,YAAY,EAAE;oBACZ,OAAO,EAAE,CAAC,MAAM,CAAC;oBACjB,cAAc,EAAE;wBACd,OAAO,EAAE;4BACP,IAAA,sCAAo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D,OAAO,CAAO,IAAY,EAAE,EAAE;QAC5B,MAAM,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAC/C,IAAI,CAAC,UAAU,EAAE;YACf,OAAO,SAAS,CAAC;SAClB;QAED,IAAI,OAA2B,CAAC;QAChC,OAAO,CAAC,IAAI,CACV,UAAU,EACV,CAAC,QAAQ,EAAE,IAAI,EAAE,EAAE;YACjB,IAAI,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;gBAC/B,OAAO,GAAG,IAAI,CAAC;aAChB;QACH,CAAC,EACD,SAAS,CAAC,uBAAuB,EACjC,SAAS,CAAC,sBAAsB,EAChC,YAAY,CACb,CAAC;QAEF,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAG,UAAU,CAAC,CAAC;QAE1B,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC;IACvC,CAAC,CAAA,CAAC;AACJ,CAAC;AA5BD,8CA4BC"}
1
+ {"version":3,"file":"angular-vite-plugin.js","sourceRoot":"","sources":["../../../../../packages/vite-plugin-angular/src/lib/angular-vite-plugin.ts"],"names":[],"mappings":";;;;AACA,sCAA6C;AAC7C,6FAAmG;AACnG,2FAAyF;AACzF,iCAAiC;AAGjC,gHAAkH;AAClH,+EAAiF;AACjF,+DAK+B;AAC/B,iEAA4D;AAgB5D,SAAgB,OAAO,CAAC,OAAuB;;IAC7C;;;OAGG;IACH,MAAM,aAAa,GAAG;QACpB,QAAQ,EACN,CAAA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,mCAAI,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,MAAM;YACrD,CAAC,CAAC,sBAAsB;YACxB,CAAC,CAAC,qBAAqB;QAC3B,aAAa,EAAE,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,aAAa,mCAAI,OAAO,CAAC,GAAG,EAAE;QACtD,qBAAqB,EAAE,MAAA,OAAO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QACH,CAAC,EACD,SAAS,CAAC,uBAAuB,EACjC,SAAS,CAAC,sBAAsB,EAChC,YAAY,CACb,CAAC;QAEF,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAG,UAAU,CAAC,CAAC;QAE1B,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC;IACvC,CAAC,CAAA,CAAC;AACJ,CAAC;AA5BD,8CA4BC"}
@@ -0,0 +1,4 @@
1
+ export declare function hasStyleUrls(code: string): boolean;
2
+ export declare function resolveStyleUrls(code: string, id: string): string[];
3
+ export declare function hasTemplateUrl(code: string): boolean;
4
+ export declare function resolveTemplateUrl(code: string, id: string): string;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveTemplateUrl = exports.hasTemplateUrl = exports.resolveStyleUrls = exports.hasStyleUrls = void 0;
4
+ const path_1 = require("path");
5
+ const styleUrlsRE = /styleUrls\s*:\s*\[([^\[]*?)\]/;
6
+ const templateUrlRE = /\s*templateUrl\s*:\s*["|']*?["|'].*/;
7
+ function hasStyleUrls(code) {
8
+ return styleUrlsRE.test(code);
9
+ }
10
+ exports.hasStyleUrls = hasStyleUrls;
11
+ function resolveStyleUrls(code, id) {
12
+ const styleUrlsGroup = styleUrlsRE.exec(code);
13
+ if (Array.isArray(styleUrlsGroup) && styleUrlsGroup[0]) {
14
+ const styleUrls = styleUrlsGroup[0].replace(/(styleUrls|\:|\s|\[|\]|"|')/g, '');
15
+ const styleUrlPaths = (styleUrls === null || styleUrls === void 0 ? void 0 : styleUrls.split(',')) || [];
16
+ return styleUrlPaths.map(styleUrlPath => (0, path_1.resolve)((0, path_1.dirname)(id), styleUrlPath));
17
+ }
18
+ return [];
19
+ }
20
+ exports.resolveStyleUrls = resolveStyleUrls;
21
+ function hasTemplateUrl(code) {
22
+ return templateUrlRE.test(code);
23
+ }
24
+ exports.hasTemplateUrl = hasTemplateUrl;
25
+ function resolveTemplateUrl(code, id) {
26
+ const templateUrlGroup = templateUrlRE.exec(code);
27
+ let templateUrlPath = '';
28
+ if (Array.isArray(templateUrlGroup) && templateUrlGroup[0]) {
29
+ const resolvedTemplatePath = templateUrlGroup[0].replace(/templateUrl|\s|'|"|\:|,/g, '');
30
+ templateUrlPath = (0, path_1.resolve)((0, path_1.dirname)(id), resolvedTemplatePath);
31
+ }
32
+ return templateUrlPath;
33
+ }
34
+ exports.resolveTemplateUrl = resolveTemplateUrl;
35
+ //# sourceMappingURL=component-resolvers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component-resolvers.js","sourceRoot":"","sources":["../../../../../packages/vite-plugin-angular/src/lib/component-resolvers.ts"],"names":[],"mappings":";;;AAAA,+BAAwC;AAExC,MAAM,WAAW,GAAG,+BAA+B,CAAC;AACpD,MAAM,aAAa,GAAG,qCAAqC,CAAC;AAE5D,SAAgB,YAAY,CAAC,IAAY;IACvC,OAAO,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAChC,CAAC;AAFD,oCAEC;AAED,SAAgB,gBAAgB,CAAC,IAAY,EAAE,EAAU;IACvD,MAAM,cAAc,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAE9C,IAAI,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,cAAc,CAAC,CAAC,CAAC,EAAE;QACtD,MAAM,SAAS,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,8BAA8B,EAAE,EAAE,CAAC,CAAC;QAChF,MAAM,aAAa,GAAG,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,KAAK,CAAC,GAAG,CAAC,KAAI,EAAE,CAAC;QAElD,OAAO,aAAa,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC,IAAA,cAAO,EAAC,IAAA,cAAO,EAAC,EAAE,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC;KAC9E;IAED,OAAO,EAAE,CAAC;AACZ,CAAC;AAXD,4CAWC;AAED,SAAgB,cAAc,CAAC,IAAY;IACzC,OAAO,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAClC,CAAC;AAFD,wCAEC;AAED,SAAgB,kBAAkB,CAAC,IAAY,EAAE,EAAU;IACzD,MAAM,gBAAgB,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAElD,IAAI,eAAe,GAAG,EAAE,CAAC;IACzB,IAAI,KAAK,CAAC,OAAO,CAAC,gBAAgB,CAAC,IAAI,gBAAgB,CAAC,CAAC,CAAC,EAAE;QAC1D,MAAM,oBAAoB,GAAG,gBAAiB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,0BAA0B,EAAE,EAAE,CAAC,CAAC;QAC1F,eAAe,GAAG,IAAA,cAAO,EAAC,IAAA,cAAO,EAAC,EAAE,CAAC,EAAE,oBAAoB,CAAC,CAAC;KAC9D;IAED,OAAO,eAAe,CAAC;AACzB,CAAC;AAVD,gDAUC"}
@@ -0,0 +1,10 @@
1
+ import { Plugin } from 'vite';
2
+ /**
3
+ * This plugin decodes and returns inline styles that were
4
+ * extracted from the Component decorator metadata and encoded
5
+ * into the import string. This allows Vite to intercept
6
+ * these imports, convert them into virtual modules, and
7
+ * return them as imported styles to pass through the CSS
8
+ * transform pipeline.
9
+ */
10
+ export declare function inlineStylesPlugin(inlineStylesExtension?: string): Plugin;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.inlineStylesPlugin = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const virtualModuleId = 'virtual:analog-inline-styles-module';
6
+ /**
7
+ * This plugin decodes and returns inline styles that were
8
+ * extracted from the Component decorator metadata and encoded
9
+ * into the import string. This allows Vite to intercept
10
+ * these imports, convert them into virtual modules, and
11
+ * return them as imported styles to pass through the CSS
12
+ * transform pipeline.
13
+ */
14
+ function inlineStylesPlugin(inlineStylesExtension = '') {
15
+ return {
16
+ name: '@analogjs/vite-plugin-angular-inline-styles',
17
+ enforce: 'pre',
18
+ resolveId(id) {
19
+ if (id.includes(`.${inlineStylesExtension}?ngResource`) &&
20
+ /data=(.*)\!/.test(id)) {
21
+ return '\0' + virtualModuleId + id;
22
+ }
23
+ return undefined;
24
+ },
25
+ load(id) {
26
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
27
+ if (!id.startsWith(`\0${virtualModuleId}`)) {
28
+ return undefined;
29
+ }
30
+ const encodedStyles = id.match(/data=(.*)\!/)[1];
31
+ const styles = Buffer.from(decodeURIComponent(encodedStyles), 'base64').toString();
32
+ return {
33
+ code: styles,
34
+ };
35
+ });
36
+ },
37
+ };
38
+ }
39
+ exports.inlineStylesPlugin = inlineStylesPlugin;
40
+ //# sourceMappingURL=inline-styles-plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inline-styles-plugin.js","sourceRoot":"","sources":["../../../../../packages/vite-plugin-angular/src/lib/inline-styles-plugin.ts"],"names":[],"mappings":";;;;AAEA,MAAM,eAAe,GAAG,qCAAqC,CAAC;AAE9D;;;;;;;GAOG;AACH,SAAgB,kBAAkB,CAAC,qBAAqB,GAAG,EAAE;IAC3D,OAAO;QACL,IAAI,EAAE,6CAA6C;QACnD,OAAO,EAAE,KAAK;QACd,SAAS,CAAC,EAAE;YACV,IACE,EAAE,CAAC,QAAQ,CAAC,IAAI,qBAAqB,aAAa,CAAC;gBACnD,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC,EACtB;gBACA,OAAO,IAAI,GAAG,eAAe,GAAG,EAAE,CAAC;aACpC;YAED,OAAO,SAAS,CAAC;QACnB,CAAC;QACK,IAAI,CAAC,EAAE;;gBACX,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,KAAK,eAAe,EAAE,CAAC,EAAE;oBAC1C,OAAO,SAAS,CAAC;iBAClB;gBAED,MAAM,aAAa,GAAG,EAAE,CAAC,KAAK,CAAC,aAAa,CAAE,CAAC,CAAC,CAAC,CAAC;gBAClD,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CACxB,kBAAkB,CAAC,aAAa,CAAC,EACjC,QAAQ,CACT,CAAC,QAAQ,EAAE,CAAC;gBAEb,OAAO;oBACL,IAAI,EAAE,MAAM;iBACb,CAAC;YACJ,CAAC;SAAA;KACF,CAAC;AACJ,CAAC;AA9BD,gDA8BC"}