@analogjs/vite-plugin-angular 1.20.0-beta.2 → 1.20.0-beta.4
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 +2 -1
- package/src/lib/tools/README.md +3 -0
- package/src/lib/tools/builders.json +15 -0
- package/src/lib/tools/package.json +7 -0
- package/src/lib/tools/src/builders/vite/schema.d.ts +6 -0
- package/src/lib/tools/src/builders/vite/schema.json +39 -0
- package/src/lib/tools/src/builders/vite/vite-build.impl.d.ts +2 -0
- package/src/lib/tools/src/builders/vite/vite-build.impl.js +40 -0
- package/src/lib/tools/src/builders/vite/vite-build.impl.js.map +1 -0
- package/src/lib/tools/src/builders/vite-dev-server/dev-server.impl.d.ts +2 -0
- package/src/lib/tools/src/builders/vite-dev-server/dev-server.impl.js +64 -0
- package/src/lib/tools/src/builders/vite-dev-server/dev-server.impl.js.map +1 -0
- package/src/lib/tools/src/builders/vite-dev-server/schema.d.ts +5 -0
- package/src/lib/tools/src/builders/vite-dev-server/schema.json +25 -0
- package/src/lib/tools/src/index.d.ts +0 -0
- package/src/lib/tools/src/index.js +1 -0
- package/src/lib/tools/src/index.js.map +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@analogjs/vite-plugin-angular",
|
|
3
|
-
"version": "1.20.0-beta.
|
|
3
|
+
"version": "1.20.0-beta.4",
|
|
4
4
|
"description": "Vite Plugin for Angular",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"ts-morph": "^21.0.0",
|
|
40
40
|
"vfile": "^6.0.3"
|
|
41
41
|
},
|
|
42
|
+
"builders": "./src/lib/tools/builders.json",
|
|
42
43
|
"ng-update": {
|
|
43
44
|
"packageGroup": [
|
|
44
45
|
"@analogjs/platform",
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"builders": {
|
|
3
|
+
"vite-dev-server": {
|
|
4
|
+
"implementation": "./src/builders/vite-dev-server/dev-server.impl",
|
|
5
|
+
"schema": "./src/builders/vite-dev-server/schema.json",
|
|
6
|
+
"description": "Vite dev server."
|
|
7
|
+
},
|
|
8
|
+
"vite": {
|
|
9
|
+
"implementation": "./src/builders/vite/vite-build.impl",
|
|
10
|
+
"schema": "./src/builders/vite/schema.json",
|
|
11
|
+
"description": "Build with Vite."
|
|
12
|
+
},
|
|
13
|
+
"vitest": "@analogjs/vitest-angular:test"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 2,
|
|
3
|
+
"outputCapture": "direct-nodejs",
|
|
4
|
+
"title": "Vite Prod Builder",
|
|
5
|
+
"cli": "nx",
|
|
6
|
+
"description": "Builds a Vite.js application for production.",
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"outputPath": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"description": "The output path of the generated files.",
|
|
12
|
+
"x-completion-type": "directory",
|
|
13
|
+
"x-priority": "important"
|
|
14
|
+
},
|
|
15
|
+
"configFile": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"description": "The name of the Vite.js configuration file.",
|
|
18
|
+
"x-completion-type": "file",
|
|
19
|
+
"x-completion-glob": "vite.config.@(js|ts)"
|
|
20
|
+
},
|
|
21
|
+
"sourcemap": {
|
|
22
|
+
"description": "Output sourcemaps. Use 'hidden' for use with error reporting tools without generating sourcemap comment.",
|
|
23
|
+
"oneOf": [
|
|
24
|
+
{
|
|
25
|
+
"type": "boolean"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"type": "string"
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
"mode": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"description": "Mode to run the build in."
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"definitions": {},
|
|
38
|
+
"required": ["outputPath"]
|
|
39
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const architect_1 = require("@angular-devkit/architect");
|
|
4
|
+
async function viteBuilder(options, context) {
|
|
5
|
+
const { createBuilder } = await Function('return import("vite")')();
|
|
6
|
+
const projectConfig = await context.getProjectMetadata(context.target);
|
|
7
|
+
const projectName = context.target.project;
|
|
8
|
+
const configuration = context.target?.configuration || 'production';
|
|
9
|
+
const buildTargetSpecifier = `::${configuration}`;
|
|
10
|
+
const buildTarget = (0, architect_1.targetFromTargetString)(buildTargetSpecifier, projectName, 'build');
|
|
11
|
+
const browserBuilderName = await context.getBuilderNameForTarget(buildTarget);
|
|
12
|
+
const rawBuildOptions = await context.getTargetOptions(buildTarget);
|
|
13
|
+
const buildOptions = await context.validateOptions(rawBuildOptions, browserBuilderName);
|
|
14
|
+
const buildConfig = {
|
|
15
|
+
configFile: options.configFile,
|
|
16
|
+
root: projectConfig.root,
|
|
17
|
+
mode: (process.env.NODE_ENV ??
|
|
18
|
+
buildOptions.mode ??
|
|
19
|
+
configuration),
|
|
20
|
+
build: {
|
|
21
|
+
outDir: options.outputPath,
|
|
22
|
+
sourcemap: !!buildOptions.sourcemap,
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
try {
|
|
26
|
+
const builder = await createBuilder(buildConfig, false);
|
|
27
|
+
await builder.buildApp();
|
|
28
|
+
return {
|
|
29
|
+
success: true,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
catch (e) {
|
|
33
|
+
console.error(e);
|
|
34
|
+
return {
|
|
35
|
+
success: false,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.default = (0, architect_1.createBuilder)(viteBuilder);
|
|
40
|
+
//# sourceMappingURL=vite-build.impl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite-build.impl.js","sourceRoot":"","sources":["../../../../../../../../../packages/vite-plugin-angular-tools/src/builders/vite/vite-build.impl.ts"],"names":[],"mappings":";;AAAA,yDAKmC;AAInC,KAAK,UAAU,WAAW,CACxB,OAAwB,EACxB,OAAuB;IAEvB,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,QAAQ,CAAC,uBAAuB,CAAC,EAAE,CAAC;IACpE,MAAM,aAAa,GAAG,MAAM,OAAO,CAAC,kBAAkB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACvE,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC;IAC3C,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,EAAE,aAAa,IAAI,YAAY,CAAC;IACpE,MAAM,oBAAoB,GAAG,KAAK,aAAa,EAAE,CAAC;IAClD,MAAM,WAAW,GAAG,IAAA,kCAAsB,EACxC,oBAAoB,EACpB,WAAW,EACX,OAAO,CACR,CAAC;IAEF,MAAM,kBAAkB,GAAG,MAAM,OAAO,CAAC,uBAAuB,CAAC,WAAW,CAAC,CAAC;IAC9E,MAAM,eAAe,GAAG,MAAM,OAAO,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;IACpE,MAAM,YAAY,GAAG,MAAM,OAAO,CAAC,eAAe,CAChD,eAAe,EACf,kBAAkB,CACnB,CAAC;IAEF,MAAM,WAAW,GAAiB;QAChC,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,IAAI,EAAE,aAAa,CAAC,IAAc;QAClC,IAAI,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ;YACzB,YAAY,CAAC,IAAI;YACjB,aAAa,CAAW;QAC1B,KAAK,EAAE;YACL,MAAM,EAAE,OAAO,CAAC,UAAU;YAC1B,SAAS,EAAE,CAAC,CAAC,YAAY,CAAC,SAAS;SACpC;KACF,CAAC;IAEF,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,aAAa,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;QACxD,MAAM,OAAO,CAAC,QAAQ,EAAE,CAAC;QAEzB,OAAO;YACL,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACjB,OAAO;YACL,OAAO,EAAE,KAAK;SACf,CAAC;IACJ,CAAC;AACH,CAAC;AAED,kBAAe,IAAA,yBAAa,EAAC,WAAW,CAAQ,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const architect_1 = require("@angular-devkit/architect");
|
|
4
|
+
async function viteDevServerBuilder(options, context) {
|
|
5
|
+
const { createServer } = await Function('return import("vite")')();
|
|
6
|
+
const projectConfig = await context.getProjectMetadata(context.target);
|
|
7
|
+
const projectName = context.target.project;
|
|
8
|
+
const buildTargetSpecifier = options.buildTarget ?? `::development`;
|
|
9
|
+
const buildTarget = (0, architect_1.targetFromTargetString)(buildTargetSpecifier, projectName, 'build');
|
|
10
|
+
const browserBuilderName = await context.getBuilderNameForTarget(buildTarget);
|
|
11
|
+
const rawBuildOptions = await context.getTargetOptions(buildTarget);
|
|
12
|
+
const buildOptions = await context.validateOptions(rawBuildOptions, browserBuilderName);
|
|
13
|
+
const serverConfig = {
|
|
14
|
+
configFile: buildOptions.configFile,
|
|
15
|
+
root: projectConfig.root,
|
|
16
|
+
mode: (process.env.NODE_ENV ??
|
|
17
|
+
buildOptions.mode ??
|
|
18
|
+
'development'),
|
|
19
|
+
build: {
|
|
20
|
+
sourcemap: !!buildOptions.sourcemap,
|
|
21
|
+
},
|
|
22
|
+
server: {
|
|
23
|
+
hmr: options?.hmr,
|
|
24
|
+
port: options?.port,
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
try {
|
|
28
|
+
const server = await createServer(serverConfig);
|
|
29
|
+
await runViteDevServer(server);
|
|
30
|
+
const resolvedUrls = [
|
|
31
|
+
...server.resolvedUrls.local,
|
|
32
|
+
...server.resolvedUrls.network,
|
|
33
|
+
];
|
|
34
|
+
await new Promise((resolve) => {
|
|
35
|
+
process.once('SIGINT', () => resolve());
|
|
36
|
+
process.once('SIGTERM', () => resolve());
|
|
37
|
+
process.once('exit', () => resolve());
|
|
38
|
+
});
|
|
39
|
+
return {
|
|
40
|
+
success: true,
|
|
41
|
+
baseUrl: resolvedUrls[0] ?? '',
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
catch (e) {
|
|
45
|
+
console.error(e);
|
|
46
|
+
return {
|
|
47
|
+
success: false,
|
|
48
|
+
baseUrl: '',
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
// vite ViteDevServer
|
|
53
|
+
async function runViteDevServer(server) {
|
|
54
|
+
await server.listen();
|
|
55
|
+
server.printUrls();
|
|
56
|
+
const processOnExit = async () => {
|
|
57
|
+
await server.close();
|
|
58
|
+
};
|
|
59
|
+
process.once('SIGINT', processOnExit);
|
|
60
|
+
process.once('SIGTERM', processOnExit);
|
|
61
|
+
process.once('exit', processOnExit);
|
|
62
|
+
}
|
|
63
|
+
exports.default = (0, architect_1.createBuilder)(viteDevServerBuilder);
|
|
64
|
+
//# sourceMappingURL=dev-server.impl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev-server.impl.js","sourceRoot":"","sources":["../../../../../../../../../packages/vite-plugin-angular-tools/src/builders/vite-dev-server/dev-server.impl.ts"],"names":[],"mappings":";;AAAA,yDAKmC;AAInC,KAAK,UAAU,oBAAoB,CACjC,OAA4B,EAC5B,OAAuB;IAEvB,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,QAAQ,CAAC,uBAAuB,CAAC,EAAE,CAAC;IACnE,MAAM,aAAa,GAAG,MAAM,OAAO,CAAC,kBAAkB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACvE,MAA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S,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;YACzC,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;QACxC,CAAC,CAAC,CAAC;QAEH,OAAO;YACL,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,IAAI,EAAE;SAC/B,CAAC;IACJ,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACjB,OAAO;YACL,OAAO,EAAE,KAAK;YACd,OAAO,EAAE,EAAE;SACZ,CAAC;IACJ,CAAC;AACH,CAAC;AAED,qBAAqB;AACrB,KAAK,UAAU,gBAAgB,CAAC,MAA2B;IACzD,MAAM,MAAM,CAAC,MAAM,EAAE,CAAC;IAEtB,MAAM,CAAC,SAAS,EAAE,CAAC;IAEnB,MAAM,aAAa,GAAG,KAAK,IAAI,EAAE;QAC/B,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC,CAAC;IAEF,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;IACtC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;IACvC,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;AACtC,CAAC;AAED,kBAAe,IAAA,yBAAa,EAAC,oBAAoB,CAAQ,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 2,
|
|
3
|
+
"outputCapture": "direct-nodejs",
|
|
4
|
+
"title": "Vite Dev Server",
|
|
5
|
+
"description": "Starts a dev server using Vite.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"buildTarget": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "Target which builds the application. Only used to retrieve the configuration as the dev-server does not build the code.",
|
|
11
|
+
"x-priority": "important"
|
|
12
|
+
},
|
|
13
|
+
"port": {
|
|
14
|
+
"type": "number",
|
|
15
|
+
"description": "Port to listen on.",
|
|
16
|
+
"x-priority": "important"
|
|
17
|
+
},
|
|
18
|
+
"hmr": {
|
|
19
|
+
"description": "Enable hot module replacement. For more options, use the 'hmr' option in the Vite configuration file.",
|
|
20
|
+
"type": "boolean"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"definitions": {},
|
|
24
|
+
"required": ["buildTarget"]
|
|
25
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/vite-plugin-angular-tools/src/index.ts"],"names":[],"mappings":""}
|