@analogjs/vite-plugin-angular 3.0.0-alpha.2 → 3.0.0-alpha.20
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/migrations/migrate-setup-vitest/migrate-setup-vitest.d.ts +2 -0
- package/migrations/migrate-setup-vitest/migrate-setup-vitest.js +49 -0
- package/migrations/migrate-setup-vitest/migrate-setup-vitest.js.map +1 -0
- package/migrations/migration.json +7 -1
- package/package.json +8 -11
- package/src/index.d.ts +3 -2
- package/src/index.js +6 -2
- package/src/index.js.map +1 -1
- package/src/lib/angular-build-optimizer-plugin.d.ts +4 -4
- package/src/lib/angular-build-optimizer-plugin.js +48 -62
- package/src/lib/angular-build-optimizer-plugin.js.map +1 -1
- package/src/lib/angular-jit-plugin.d.ts +3 -3
- package/src/lib/angular-jit-plugin.js +31 -37
- package/src/lib/angular-jit-plugin.js.map +1 -1
- package/src/lib/angular-pending-tasks.plugin.d.ts +7 -7
- package/src/lib/angular-pending-tasks.plugin.js +17 -18
- package/src/lib/angular-pending-tasks.plugin.js.map +1 -1
- package/src/lib/angular-vite-plugin.d.ts +145 -45
- package/src/lib/angular-vite-plugin.js +822 -963
- package/src/lib/angular-vite-plugin.js.map +1 -1
- package/src/lib/angular-vitest-plugin.d.ts +20 -16
- package/src/lib/angular-vitest-plugin.js +88 -114
- package/src/lib/angular-vitest-plugin.js.map +1 -1
- package/src/lib/compiler-plugin.d.ts +11 -11
- package/src/lib/compiler-plugin.js +43 -44
- package/src/lib/compiler-plugin.js.map +1 -1
- package/src/lib/component-resolvers.d.ts +8 -6
- package/src/lib/component-resolvers.js +93 -64
- package/src/lib/component-resolvers.js.map +1 -1
- package/src/lib/host.d.ts +10 -8
- package/src/lib/host.js +70 -101
- package/src/lib/host.js.map +1 -1
- package/src/lib/live-reload-plugin.d.ts +5 -5
- package/src/lib/live-reload-plugin.js +51 -62
- package/src/lib/live-reload-plugin.js.map +1 -1
- package/src/lib/models.d.ts +9 -9
- package/src/lib/nx-folder-plugin.d.ts +5 -5
- package/src/lib/nx-folder-plugin.js +18 -16
- package/src/lib/nx-folder-plugin.js.map +1 -1
- package/src/lib/plugins/file-replacements.plugin.d.ts +4 -4
- package/src/lib/plugins/file-replacements.plugin.js +35 -62
- package/src/lib/plugins/file-replacements.plugin.js.map +1 -1
- package/src/lib/router-plugin.d.ts +1 -1
- package/src/lib/router-plugin.js +23 -23
- package/src/lib/router-plugin.js.map +1 -1
- package/src/lib/style-preprocessor.d.ts +1 -0
- package/src/lib/tools/package.json +2 -7
- package/src/lib/tools/src/builders/vite/vite-build.impl.js +31 -35
- package/src/lib/tools/src/builders/vite/vite-build.impl.js.map +1 -1
- package/src/lib/tools/src/builders/vite-dev-server/dev-server.impl.js +51 -59
- package/src/lib/tools/src/builders/vite-dev-server/dev-server.impl.js.map +1 -1
- package/src/lib/tools/src/index.js +0 -1
- package/src/lib/utils/compiler-plugin-options.d.ts +11 -11
- package/src/lib/utils/devkit.d.ts +4 -4
- package/src/lib/utils/devkit.js +34 -38
- package/src/lib/utils/devkit.js.map +1 -1
- package/src/lib/utils/hmr-candidates.d.ts +28 -28
- package/src/lib/utils/rolldown.d.ts +2 -0
- package/src/lib/utils/rolldown.js +12 -0
- package/src/lib/utils/rolldown.js.map +1 -0
- package/src/lib/utils/source-file-cache.d.ts +8 -15
- package/src/lib/utils/source-file-cache.js +35 -37
- package/src/lib/utils/source-file-cache.js.map +1 -1
- package/src/test-setup.d.ts +2 -0
- package/setup-vitest.d.ts +0 -4
- package/setup-vitest.js +0 -217
- package/setup-vitest.js.map +0 -1
- package/src/lib/models.js +0 -1
- package/src/lib/models.js.map +0 -1
- package/src/lib/tools/README.md +0 -3
- package/src/lib/tools/src/index.d.ts +0 -0
- package/src/lib/tools/src/index.js.map +0 -1
- package/src/lib/utils/compiler-plugin-options.js +0 -1
- package/src/lib/utils/compiler-plugin-options.js.map +0 -1
- package/src/lib/utils/hmr-candidates.js +0 -272
- package/src/lib/utils/hmr-candidates.js.map +0 -1
- package/vite.config.d.ts +0 -2
- package/vite.config.js +0 -22
- package/vite.config.js.map +0 -1
|
@@ -1,62 +1,54 @@
|
|
|
1
|
-
|
|
1
|
+
let _angular_devkit_architect = require("@angular-devkit/architect");
|
|
2
|
+
//#region packages/vite-plugin-angular-tools/src/builders/vite-dev-server/dev-server.impl.ts
|
|
2
3
|
async function viteDevServerBuilder(options, context) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
4
|
+
const { createServer } = await Function("return import(\"vite\")")();
|
|
5
|
+
if (!context.target) throw new Error("Builder must be executed with a target");
|
|
6
|
+
const projectConfig = await context.getProjectMetadata(context.target);
|
|
7
|
+
const projectName = context.target.project;
|
|
8
|
+
const buildTarget = (0, _angular_devkit_architect.targetFromTargetString)(options.buildTarget ?? `::development`, projectName, "build");
|
|
9
|
+
const browserBuilderName = await context.getBuilderNameForTarget(buildTarget);
|
|
10
|
+
const rawBuildOptions = await context.getTargetOptions(buildTarget);
|
|
11
|
+
const buildOptions = await context.validateOptions(rawBuildOptions, browserBuilderName);
|
|
12
|
+
const serverConfig = {
|
|
13
|
+
configFile: buildOptions.configFile,
|
|
14
|
+
root: projectConfig.root,
|
|
15
|
+
mode: process.env.NODE_ENV ?? buildOptions.mode ?? "development",
|
|
16
|
+
build: { sourcemap: !!buildOptions.sourcemap },
|
|
17
|
+
server: {
|
|
18
|
+
hmr: options?.hmr,
|
|
19
|
+
port: options?.port
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
try {
|
|
23
|
+
const server = await createServer(serverConfig);
|
|
24
|
+
await server.listen();
|
|
25
|
+
server.printUrls();
|
|
26
|
+
const resolvedUrls = [...server.resolvedUrls.local, ...server.resolvedUrls.network];
|
|
27
|
+
const processOnExit = async () => {
|
|
28
|
+
await server.close();
|
|
29
|
+
};
|
|
30
|
+
await new Promise((resolve) => {
|
|
31
|
+
const shutdown = () => {
|
|
32
|
+
processOnExit().then(() => resolve(), () => resolve());
|
|
33
|
+
};
|
|
34
|
+
process.once("SIGINT", shutdown);
|
|
35
|
+
process.once("SIGTERM", shutdown);
|
|
36
|
+
process.once("exit", shutdown);
|
|
37
|
+
});
|
|
38
|
+
return {
|
|
39
|
+
success: true,
|
|
40
|
+
baseUrl: resolvedUrls[0] ?? ""
|
|
41
|
+
};
|
|
42
|
+
} catch (e) {
|
|
43
|
+
console.error(e);
|
|
44
|
+
return {
|
|
45
|
+
success: false,
|
|
46
|
+
baseUrl: ""
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
49
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
const processOnExit = async () => {
|
|
55
|
-
await server.close();
|
|
56
|
-
};
|
|
57
|
-
process.once('SIGINT', processOnExit);
|
|
58
|
-
process.once('SIGTERM', processOnExit);
|
|
59
|
-
process.once('exit', processOnExit);
|
|
60
|
-
}
|
|
61
|
-
export default createBuilder(viteDevServerBuilder);
|
|
50
|
+
var dev_server_impl_default = (0, _angular_devkit_architect.createBuilder)(viteDevServerBuilder);
|
|
51
|
+
//#endregion
|
|
52
|
+
module.exports = dev_server_impl_default;
|
|
53
|
+
|
|
62
54
|
//# sourceMappingURL=dev-server.impl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev-server.impl.js","
|
|
1
|
+
{"version":3,"file":"dev-server.impl.js","names":[],"sources":["../../../../../../../../vite-plugin-angular-tools/src/builders/vite-dev-server/dev-server.impl.ts"],"sourcesContent":["import {\n BuilderContext,\n BuilderOutput,\n createBuilder,\n targetFromTargetString,\n} from '@angular-devkit/architect';\nimport type { InlineConfig } from 'vite';\nimport { ViteDevServerSchema } from './schema';\n\nasync function viteDevServerBuilder(\n options: ViteDevServerSchema,\n context: BuilderContext,\n): Promise<BuilderOutput> {\n const { createServer } = await Function('return import(\"vite\")')();\n if (!context.target) {\n throw new Error('Builder must be executed with a target');\n }\n const projectConfig = await context.getProjectMetadata(context.target);\n const projectName = context.target.project;\n const buildTargetSpecifier = options.buildTarget ?? `::development`;\n const buildTarget = targetFromTargetString(\n buildTargetSpecifier,\n projectName,\n 'build',\n );\n\n const browserBuilderName = await context.getBuilderNameForTarget(buildTarget);\n const rawBuildOptions = await context.getTargetOptions(buildTarget);\n const buildOptions = await context.validateOptions(\n rawBuildOptions,\n browserBuilderName,\n );\n\n const serverConfig: InlineConfig = {\n configFile: buildOptions.configFile as string,\n root: projectConfig.root as string,\n mode: (process.env.NODE_ENV ??\n buildOptions.mode ??\n 'development') as string,\n build: {\n sourcemap: !!buildOptions.sourcemap,\n },\n server: {\n hmr: options?.hmr,\n port: options?.port,\n },\n };\n\n try {\n const server = await createServer(serverConfig);\n await server.listen();\n server.printUrls();\n\n const resolvedUrls = [\n ...server.resolvedUrls.local,\n ...server.resolvedUrls.network,\n ];\n\n const processOnExit = async () => {\n await server.close();\n };\n\n // Use process.once to avoid listener accumulation when Nx invokes\n // multiple builders in the same process during a large build graph.\n await new Promise<void>((resolve) => {\n const shutdown = () => {\n processOnExit().then(\n () => resolve(),\n () => resolve(),\n );\n };\n process.once('SIGINT', shutdown);\n process.once('SIGTERM', shutdown);\n process.once('exit', shutdown);\n });\n\n return {\n success: true,\n baseUrl: resolvedUrls[0] ?? '',\n };\n } catch (e) {\n console.error(e);\n return {\n success: false,\n baseUrl: '',\n };\n }\n}\n\nexport default createBuilder(viteDevServerBuilder) as any;\n"],"mappings":";;AASA,eAAe,qBACb,SACA,SACwB;CACxB,MAAM,EAAE,iBAAiB,MAAM,SAAS,0BAAwB,EAAE;AAClE,KAAI,CAAC,QAAQ,OACX,OAAM,IAAI,MAAM,yCAAyC;CAE3D,MAAM,gBAAgB,MAAM,QAAQ,mBAAmB,QAAQ,OAAO;CACtE,MAAM,cAAc,QAAQ,OAAO;CAEnC,MAAM,eAAA,GAAA,0BAAA,wBADuB,QAAQ,eAAe,iBAGlD,aACA,QACD;CAED,MAAM,qBAAqB,MAAM,QAAQ,wBAAwB,YAAY;CAC7E,MAAM,kBAAkB,MAAM,QAAQ,iBAAiB,YAAY;CACnE,MAAM,eAAe,MAAM,QAAQ,gBACjC,iBACA,mBACD;CAED,MAAM,eAA6B;EACjC,YAAY,aAAa;EACzB,MAAM,cAAc;EACpB,MAAA,QAAA,IAAA,YACE,aAAa,QACb;EACF,OAAO,EACL,WAAW,CAAC,CAAC,aAAa,WAC3B;EACD,QAAQ;GACN,KAAK,SAAS;GACd,MAAM,SAAS;GAChB;EACF;AAED,KAAI;EACF,MAAM,SAAS,MAAM,aAAa,aAAa;AAC/C,QAAM,OAAO,QAAQ;AACrB,SAAO,WAAW;EAElB,MAAM,eAAe,CACnB,GAAG,OAAO,aAAa,OACvB,GAAG,OAAO,aAAa,QACxB;EAED,MAAM,gBAAgB,YAAY;AAChC,SAAM,OAAO,OAAO;;AAKtB,QAAM,IAAI,SAAe,YAAY;GACnC,MAAM,iBAAiB;AACrB,mBAAe,CAAC,WACR,SAAS,QACT,SAAS,CAChB;;AAEH,WAAQ,KAAK,UAAU,SAAS;AAChC,WAAQ,KAAK,WAAW,SAAS;AACjC,WAAQ,KAAK,QAAQ,SAAS;IAC9B;AAEF,SAAO;GACL,SAAS;GACT,SAAS,aAAa,MAAM;GAC7B;UACM,GAAG;AACV,UAAQ,MAAM,EAAE;AAChB,SAAO;GACL,SAAS;GACT,SAAS;GACV;;;AAIL,IAAA,2BAAA,GAAA,0BAAA,eAA6B,qBAAqB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { SourceFileCache } from
|
|
1
|
+
import { SourceFileCache } from "./source-file-cache";
|
|
2
2
|
export interface CompilerPluginOptions {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
3
|
+
sourcemap: boolean;
|
|
4
|
+
tsconfig: string;
|
|
5
|
+
jit?: boolean;
|
|
6
|
+
/** Skip TypeScript compilation setup. This is useful to re-use the TypeScript compilation from another plugin. */
|
|
7
|
+
noopTypeScriptCompilation?: boolean;
|
|
8
|
+
advancedOptimizations?: boolean;
|
|
9
|
+
thirdPartySourcemaps?: boolean;
|
|
10
|
+
fileReplacements?: Record<string, string>;
|
|
11
|
+
sourceFileCache?: SourceFileCache;
|
|
12
|
+
incremental: boolean;
|
|
13
13
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { CompilerPluginOptions } from
|
|
1
|
+
import type { CompilerPluginOptions } from "./compiler-plugin-options.js";
|
|
2
2
|
declare const angularMajor: number;
|
|
3
3
|
declare const angularMinor: number;
|
|
4
4
|
declare const angularPatch: number;
|
|
5
5
|
declare const angularFullVersion: number;
|
|
6
6
|
declare let sourceFileCache: any;
|
|
7
|
-
declare let cjt:
|
|
7
|
+
declare let cjt: (...args: any[]) => any;
|
|
8
8
|
declare let jt: any;
|
|
9
|
-
declare let createAngularCompilation:
|
|
10
|
-
export { cjt as createJitResourceTransformer, jt as JavaScriptTransformer, sourceFileCache as SourceFileCache, CompilerPluginOptions, angularMajor, angularMinor, angularPatch, createAngularCompilation, angularFullVersion
|
|
9
|
+
declare let createAngularCompilation: (...args: any[]) => any;
|
|
10
|
+
export { cjt as createJitResourceTransformer, jt as JavaScriptTransformer, sourceFileCache as SourceFileCache, CompilerPluginOptions, angularMajor, angularMinor, angularPatch, createAngularCompilation, angularFullVersion };
|
package/src/lib/utils/devkit.js
CHANGED
|
@@ -1,41 +1,37 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
1
|
+
import { SourceFileCache } from "./source-file-cache.js";
|
|
2
|
+
import { VERSION } from "@angular/compiler-cli";
|
|
3
|
+
import { createRequire } from "node:module";
|
|
4
|
+
//#region packages/vite-plugin-angular/src/lib/utils/devkit.ts
|
|
5
|
+
var require = createRequire(import.meta.url);
|
|
6
|
+
var angularMajor = Number(VERSION.major);
|
|
7
|
+
var angularMinor = Number(VERSION.minor);
|
|
8
|
+
var angularPatch = Number(VERSION.patch);
|
|
9
|
+
var padVersion = (version) => String(version).padStart(2, "0");
|
|
10
|
+
var angularFullVersion = Number(`${angularMajor}${padVersion(angularMinor)}${padVersion(angularPatch)}`);
|
|
11
|
+
var sourceFileCache;
|
|
12
|
+
var cjt;
|
|
13
|
+
var jt;
|
|
14
|
+
var createAngularCompilation;
|
|
15
|
+
if (angularMajor < 17) throw new Error("AnalogJS is not compatible with Angular v16 and lower");
|
|
17
16
|
else if (angularMajor >= 17 && angularMajor < 18) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const { createJitResourceTransformer, JavaScriptTransformer, SourceFileCache, createAngularCompilation: createAngularCompilationFn, } = require('@angular/build/private');
|
|
35
|
-
sourceFileCache = SourceFileCache;
|
|
36
|
-
cjt = createJitResourceTransformer;
|
|
37
|
-
jt = JavaScriptTransformer;
|
|
38
|
-
createAngularCompilation = createAngularCompilationFn;
|
|
17
|
+
const cp = require("@angular-devkit/build-angular/src/tools/esbuild/angular/compiler-plugin.js");
|
|
18
|
+
const { createJitResourceTransformer } = require("@angular-devkit/build-angular/src/tools/esbuild/angular/jit-resource-transformer.js");
|
|
19
|
+
const { JavaScriptTransformer } = require("@angular-devkit/build-angular/src/tools/esbuild/javascript-transformer.js");
|
|
20
|
+
/**
|
|
21
|
+
* Workaround for compatibility with Angular 17.0+
|
|
22
|
+
*/
|
|
23
|
+
if (typeof cp["SourceFileCache"] !== "undefined") sourceFileCache = cp.SourceFileCache;
|
|
24
|
+
else sourceFileCache = SourceFileCache;
|
|
25
|
+
cjt = createJitResourceTransformer;
|
|
26
|
+
jt = JavaScriptTransformer;
|
|
27
|
+
} else {
|
|
28
|
+
const { createJitResourceTransformer, JavaScriptTransformer, SourceFileCache, createAngularCompilation: createAngularCompilationFn } = require("@angular/build/private");
|
|
29
|
+
sourceFileCache = SourceFileCache;
|
|
30
|
+
cjt = createJitResourceTransformer;
|
|
31
|
+
jt = JavaScriptTransformer;
|
|
32
|
+
createAngularCompilation = createAngularCompilationFn;
|
|
39
33
|
}
|
|
40
|
-
|
|
34
|
+
//#endregion
|
|
35
|
+
export { angularFullVersion, cjt, createAngularCompilation, jt, sourceFileCache };
|
|
36
|
+
|
|
41
37
|
//# sourceMappingURL=devkit.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devkit.js","
|
|
1
|
+
{"version":3,"file":"devkit.js","names":[],"sources":["../../../../src/lib/utils/devkit.ts"],"sourcesContent":["import { VERSION } from '@angular/compiler-cli';\nimport { createRequire } from 'node:module';\nimport type { CompilerPluginOptions } from './compiler-plugin-options.js';\nimport * as sfc from './source-file-cache.js';\n\nconst require = createRequire(import.meta.url);\n\nconst angularMajor: number = Number(VERSION.major);\nconst angularMinor: number = Number(VERSION.minor);\nconst angularPatch: number = Number(VERSION.patch);\nconst padVersion = (version: number) => String(version).padStart(2, '0');\nconst angularFullVersion: number = Number(\n `${angularMajor}${padVersion(angularMinor)}${padVersion(angularPatch)}`,\n);\nlet sourceFileCache: any;\nlet cjt: (...args: any[]) => any;\nlet jt: any;\nlet createAngularCompilation: (...args: any[]) => any;\n\nif (angularMajor < 17) {\n throw new Error('AnalogJS is not compatible with Angular v16 and lower');\n} else if (angularMajor >= 17 && angularMajor < 18) {\n const cp = require('@angular-devkit/build-angular/src/tools/esbuild/angular/compiler-plugin.js');\n const {\n createJitResourceTransformer,\n } = require('@angular-devkit/build-angular/src/tools/esbuild/angular/jit-resource-transformer.js');\n const {\n JavaScriptTransformer,\n } = require('@angular-devkit/build-angular/src/tools/esbuild/javascript-transformer.js');\n\n /**\n * Workaround for compatibility with Angular 17.0+\n */\n if (typeof cp['SourceFileCache'] !== 'undefined') {\n sourceFileCache = cp.SourceFileCache;\n } else {\n sourceFileCache = sfc.SourceFileCache;\n }\n\n cjt = createJitResourceTransformer;\n jt = JavaScriptTransformer;\n} else {\n const {\n createJitResourceTransformer,\n JavaScriptTransformer,\n SourceFileCache,\n createAngularCompilation: createAngularCompilationFn,\n } = require('@angular/build/private');\n\n sourceFileCache = SourceFileCache;\n cjt = createJitResourceTransformer;\n jt = JavaScriptTransformer;\n createAngularCompilation = createAngularCompilationFn;\n}\n\nexport {\n cjt as createJitResourceTransformer,\n jt as JavaScriptTransformer,\n sourceFileCache as SourceFileCache,\n CompilerPluginOptions,\n angularMajor,\n angularMinor,\n angularPatch,\n createAngularCompilation,\n angularFullVersion,\n};\n"],"mappings":";;;;AAKA,IAAM,UAAU,cAAc,OAAO,KAAK,IAAI;AAE9C,IAAM,eAAuB,OAAO,QAAQ,MAAM;AAClD,IAAM,eAAuB,OAAO,QAAQ,MAAM;AAClD,IAAM,eAAuB,OAAO,QAAQ,MAAM;AAClD,IAAM,cAAc,YAAoB,OAAO,QAAQ,CAAC,SAAS,GAAG,IAAI;AACxE,IAAM,qBAA6B,OACjC,GAAG,eAAe,WAAW,aAAa,GAAG,WAAW,aAAa,GACtE;AACD,IAAI;AACJ,IAAI;AACJ,IAAI;AACJ,IAAI;AAEJ,IAAI,eAAe,GACjB,OAAM,IAAI,MAAM,wDAAwD;SAC/D,gBAAgB,MAAM,eAAe,IAAI;CAClD,MAAM,KAAK,QAAQ,6EAA6E;CAChG,MAAM,EACJ,iCACE,QAAQ,sFAAsF;CAClG,MAAM,EACJ,0BACE,QAAQ,4EAA4E;;;;AAKxF,KAAI,OAAO,GAAG,uBAAuB,YACnC,mBAAkB,GAAG;KAErB,mBAAkB;AAGpB,OAAM;AACN,MAAK;OACA;CACL,MAAM,EACJ,8BACA,uBACA,iBACA,0BAA0B,+BACxB,QAAQ,yBAAyB;AAErC,mBAAkB;AAClB,OAAM;AACN,MAAK;AACL,4BAA2B"}
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import { NgtscProgram } from
|
|
9
|
-
import ts from
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
+
*/
|
|
8
|
+
import { NgtscProgram } from "@angular/compiler-cli";
|
|
9
|
+
import ts from "typescript";
|
|
10
10
|
/**
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
11
|
+
* Analyzes one or more modified files for changes to determine if any
|
|
12
|
+
* class declarations for Angular components are candidates for hot
|
|
13
|
+
* module replacement (HMR). If any source files are also modified but
|
|
14
|
+
* are not candidates then all candidates become invalid. This invalidation
|
|
15
|
+
* ensures that a full rebuild occurs and the running application stays
|
|
16
|
+
* synchronized with the code.
|
|
17
|
+
* @param modifiedFiles A set of modified files to analyze.
|
|
18
|
+
* @param param1 An Angular compiler instance
|
|
19
|
+
* @param staleSourceFiles A map of paths to previous source file instances.
|
|
20
|
+
* @returns A set of HMR candidate component class declarations.
|
|
21
|
+
*/
|
|
22
22
|
export declare function collectHmrCandidates(modifiedFiles: Set<string>, { compiler }: NgtscProgram, staleSourceFiles: Map<string, ts.SourceFile> | undefined): Set<ts.ClassDeclaration>;
|
|
23
23
|
/**
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
export declare function analyzeFileUpdates(stale: ts.SourceFile, updated: ts.SourceFile, compiler: NgtscProgram[
|
|
24
|
+
* Analyzes the updates of a source file for potential HMR component class candidates.
|
|
25
|
+
* A source file can contain candidates if only the Angular component metadata of a class
|
|
26
|
+
* has been changed and the metadata changes are only of supported fields.
|
|
27
|
+
* @param stale The stale (previous) source file instance.
|
|
28
|
+
* @param updated The updated source file instance.
|
|
29
|
+
* @param compiler An Angular compiler instance.
|
|
30
|
+
* @returns An array of candidate class declarations; or `null` if unsupported changes are present.
|
|
31
|
+
*/
|
|
32
|
+
export declare function analyzeFileUpdates(stale: ts.SourceFile, updated: ts.SourceFile, compiler: NgtscProgram["compiler"]): ts.ClassDeclaration[] | null;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as vite from "vite";
|
|
2
|
+
//#region packages/vite-plugin-angular/src/lib/utils/rolldown.ts
|
|
3
|
+
function isRolldown() {
|
|
4
|
+
return !!vite.rolldownVersion;
|
|
5
|
+
}
|
|
6
|
+
function getJsTransformConfigKey() {
|
|
7
|
+
return isRolldown() ? "oxc" : "esbuild";
|
|
8
|
+
}
|
|
9
|
+
//#endregion
|
|
10
|
+
export { getJsTransformConfigKey, isRolldown };
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=rolldown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rolldown.js","names":[],"sources":["../../../../src/lib/utils/rolldown.ts"],"sourcesContent":["import * as vite from 'vite';\n\nexport function isRolldown(): boolean {\n return !!vite.rolldownVersion;\n}\n\nexport function getJsTransformConfigKey(): 'oxc' | 'esbuild' {\n return isRolldown() ? 'oxc' : 'esbuild';\n}\n"],"mappings":";;AAEA,SAAgB,aAAsB;AACpC,QAAO,CAAC,CAAC,KAAK;;AAGhB,SAAgB,0BAA6C;AAC3D,QAAO,YAAY,GAAG,QAAQ"}
|
|
@@ -1,17 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright Google LLC All Rights Reserved.
|
|
4
|
-
*
|
|
5
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.io/license
|
|
7
|
-
*/
|
|
8
|
-
import type ts from 'typescript';
|
|
1
|
+
import type ts from "typescript";
|
|
9
2
|
export declare class SourceFileCache extends Map<string, ts.SourceFile> {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
3
|
+
readonly persistentCachePath?: string | undefined;
|
|
4
|
+
readonly modifiedFiles: Set<string>;
|
|
5
|
+
readonly babelFileCache: Map<string, Uint8Array>;
|
|
6
|
+
readonly typeScriptFileCache: Map<string, string | Uint8Array>;
|
|
7
|
+
referencedFiles?: readonly string[];
|
|
8
|
+
constructor(persistentCachePath?: string | undefined);
|
|
9
|
+
invalidate(files: Iterable<string>): void;
|
|
17
10
|
}
|
|
@@ -1,39 +1,37 @@
|
|
|
1
|
+
import * as path$1 from "node:path";
|
|
2
|
+
import { platform } from "node:os";
|
|
3
|
+
import { pathToFileURL } from "node:url";
|
|
4
|
+
//#region packages/vite-plugin-angular/src/lib/utils/source-file-cache.ts
|
|
1
5
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
this.delete(file);
|
|
35
|
-
this.modifiedFiles.add(file);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
6
|
+
* @license
|
|
7
|
+
* Copyright Google LLC All Rights Reserved.
|
|
8
|
+
*
|
|
9
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
10
|
+
* found in the LICENSE file at https://angular.io/license
|
|
11
|
+
*/
|
|
12
|
+
var USING_WINDOWS = platform() === "win32";
|
|
13
|
+
var WINDOWS_SEP_REGEXP = new RegExp(`\\${path$1.win32.sep}`, "g");
|
|
14
|
+
var SourceFileCache = class extends Map {
|
|
15
|
+
modifiedFiles = /* @__PURE__ */ new Set();
|
|
16
|
+
babelFileCache = /* @__PURE__ */ new Map();
|
|
17
|
+
typeScriptFileCache = /* @__PURE__ */ new Map();
|
|
18
|
+
referencedFiles;
|
|
19
|
+
constructor(persistentCachePath) {
|
|
20
|
+
super();
|
|
21
|
+
this.persistentCachePath = persistentCachePath;
|
|
22
|
+
}
|
|
23
|
+
invalidate(files) {
|
|
24
|
+
if (files !== this.modifiedFiles) this.modifiedFiles.clear();
|
|
25
|
+
for (let file of files) {
|
|
26
|
+
this.babelFileCache.delete(file);
|
|
27
|
+
this.typeScriptFileCache.delete(pathToFileURL(file).href);
|
|
28
|
+
if (USING_WINDOWS) file = file.replace(WINDOWS_SEP_REGEXP, path$1.posix.sep);
|
|
29
|
+
this.delete(file);
|
|
30
|
+
this.modifiedFiles.add(file);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
//#endregion
|
|
35
|
+
export { SourceFileCache };
|
|
36
|
+
|
|
39
37
|
//# sourceMappingURL=source-file-cache.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source-file-cache.js","
|
|
1
|
+
{"version":3,"file":"source-file-cache.js","names":[],"sources":["../../../../src/lib/utils/source-file-cache.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport { platform } from 'node:os';\nimport * as path from 'node:path';\nimport { pathToFileURL } from 'node:url';\nimport type ts from 'typescript';\n\nconst USING_WINDOWS = platform() === 'win32';\nconst WINDOWS_SEP_REGEXP = new RegExp(`\\\\${path.win32.sep}`, 'g');\n\nexport class SourceFileCache extends Map<string, ts.SourceFile> {\n readonly modifiedFiles: Set<string> = new Set<string>();\n readonly babelFileCache: Map<string, Uint8Array> = new Map<\n string,\n Uint8Array\n >();\n readonly typeScriptFileCache: Map<string, string | Uint8Array> = new Map<\n string,\n string | Uint8Array\n >();\n\n referencedFiles?: readonly string[];\n\n constructor(readonly persistentCachePath?: string) {\n super();\n }\n\n invalidate(files: Iterable<string>): void {\n if (files !== this.modifiedFiles) {\n this.modifiedFiles.clear();\n }\n for (let file of files) {\n this.babelFileCache.delete(file);\n this.typeScriptFileCache.delete(pathToFileURL(file).href);\n\n // Normalize separators to allow matching TypeScript Host paths\n if (USING_WINDOWS) {\n file = file.replace(WINDOWS_SEP_REGEXP, path.posix.sep);\n }\n\n this.delete(file);\n this.modifiedFiles.add(file);\n }\n }\n}\n"],"mappings":";;;;;;;;;;;AAaA,IAAM,gBAAgB,UAAU,KAAK;AACrC,IAAM,qBAAqB,IAAI,OAAO,KAAK,OAAK,MAAM,OAAO,IAAI;AAEjE,IAAa,kBAAb,cAAqC,IAA2B;CAC9D,gCAAsC,IAAI,KAAa;CACvD,iCAAmD,IAAI,KAGpD;CACH,sCAAiE,IAAI,KAGlE;CAEH;CAEA,YAAY,qBAAuC;AACjD,SAAO;AADY,OAAA,sBAAA;;CAIrB,WAAW,OAA+B;AACxC,MAAI,UAAU,KAAK,cACjB,MAAK,cAAc,OAAO;AAE5B,OAAK,IAAI,QAAQ,OAAO;AACtB,QAAK,eAAe,OAAO,KAAK;AAChC,QAAK,oBAAoB,OAAO,cAAc,KAAK,CAAC,KAAK;AAGzD,OAAI,cACF,QAAO,KAAK,QAAQ,oBAAoB,OAAK,MAAM,IAAI;AAGzD,QAAK,OAAO,KAAK;AACjB,QAAK,cAAc,IAAI,KAAK"}
|
package/setup-vitest.d.ts
DELETED