@trackunit/iris-app-sdk-rspack 0.0.4 → 0.0.5
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/CHANGELOG.md +8 -0
- package/executors.json +15 -0
- package/package.json +6 -7
- package/src/executors/build/executor.js +18 -0
- package/src/executors/build/executor.js.map +1 -1
- package/src/executors/build/schema.json +20 -0
- package/src/executors/serve/schema.json +20 -0
- package/README.internal.md +0 -5
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [0.0.5](https://github.com/Trackunit/manager/compare/iris-app-sdk-rspack/0.0.4...iris-app-sdk-rspack/0.0.5) (2025-01-14)
|
|
6
|
+
|
|
7
|
+
### Dependency Updates
|
|
8
|
+
|
|
9
|
+
* `iris-app-build-utilities` updated to version `0.0.4`
|
|
10
|
+
* `shared-utils` updated to version `0.0.4`
|
|
11
|
+
* `iris-app-api` updated to version `0.0.4`
|
|
12
|
+
* `iris-app-webpack-plugin` updated to version `0.0.4`
|
|
5
13
|
## [0.0.4](https://github.com/Trackunit/manager/compare/iris-app-sdk-rspack/0.0.3...iris-app-sdk-rspack/0.0.4) (2025-01-10)
|
|
6
14
|
|
|
7
15
|
### Dependency Updates
|
package/executors.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"executors": {
|
|
4
|
+
"serve": {
|
|
5
|
+
"implementation": "./src/executors/serve/executor",
|
|
6
|
+
"schema": "./src/executors/serve/schema.json",
|
|
7
|
+
"description": "serve executor"
|
|
8
|
+
},
|
|
9
|
+
"build": {
|
|
10
|
+
"implementation": "./src/executors/build/executor",
|
|
11
|
+
"schema": "./src/executors/build/schema.json",
|
|
12
|
+
"description": "build executor"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/iris-app-sdk-rspack",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"repository": "https://github.com/Trackunit/manager",
|
|
6
6
|
"executors": "./executors.json",
|
|
@@ -10,17 +10,16 @@
|
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@rspack/core": "^1.1.8",
|
|
12
12
|
"@rspack/dev-server": "^1.0.10",
|
|
13
|
-
"@trackunit/iris-app-api": "*",
|
|
14
|
-
"@trackunit/iris-app-build-utilities": "*",
|
|
15
|
-
"@trackunit/shared-utils": "*",
|
|
16
|
-
"@trackunit/iris-app-webpack-plugin": "*",
|
|
17
|
-
"tslib": "^2.6.2",
|
|
18
13
|
"@nx/devkit": "19.8.3",
|
|
19
14
|
"rxjs": "7.8.1",
|
|
20
15
|
"win-ca": "^3.5.1",
|
|
21
16
|
"pacote": "17.0.6",
|
|
22
17
|
"semver": "7.5.4",
|
|
23
|
-
"webpack-bundle-analyzer": "^4.8.0"
|
|
18
|
+
"webpack-bundle-analyzer": "^4.8.0",
|
|
19
|
+
"@trackunit/iris-app-build-utilities": "^0.0.464",
|
|
20
|
+
"@trackunit/shared-utils": "^0.0.92",
|
|
21
|
+
"@trackunit/iris-app-api": "^0.2.19",
|
|
22
|
+
"@trackunit/iris-app-webpack-plugin": "^0.0.237"
|
|
24
23
|
},
|
|
25
24
|
"main": "./src/index.js",
|
|
26
25
|
"type": "commonjs",
|
|
@@ -51,6 +51,20 @@ async function* default_1(options, context) {
|
|
|
51
51
|
const observable = new rxjs_1.Observable(subscriber => {
|
|
52
52
|
// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires, local-rules/no-typescript-assertion
|
|
53
53
|
const compiler = require("@rspack/core").rspack(config);
|
|
54
|
+
// Add signal handlers
|
|
55
|
+
const signals = ["SIGINT", "SIGTERM", "SIGQUIT"];
|
|
56
|
+
const cleanup = () => {
|
|
57
|
+
compiler.close((err) => {
|
|
58
|
+
if (err) {
|
|
59
|
+
// eslint-disable-next-line no-console
|
|
60
|
+
console.error(err);
|
|
61
|
+
}
|
|
62
|
+
process.exit(0);
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
signals.forEach(signal => {
|
|
66
|
+
process.on(signal, cleanup);
|
|
67
|
+
});
|
|
54
68
|
compiler.run((err, stats) => {
|
|
55
69
|
if (err) {
|
|
56
70
|
// eslint-disable-next-line no-console
|
|
@@ -61,7 +75,11 @@ async function* default_1(options, context) {
|
|
|
61
75
|
subscriber.next(stats);
|
|
62
76
|
subscriber.complete();
|
|
63
77
|
});
|
|
78
|
+
// Update cleanup function to remove signal handlers
|
|
64
79
|
return () => {
|
|
80
|
+
signals.forEach(signal => {
|
|
81
|
+
process.off(signal, cleanup);
|
|
82
|
+
});
|
|
65
83
|
compiler.close((err) => {
|
|
66
84
|
if (err) {
|
|
67
85
|
// eslint-disable-next-line no-console
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/rspack/src/executors/build/executor.ts"],"names":[],"mappings":";;AAmCA,
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/rspack/src/executors/build/executor.ts"],"names":[],"mappings":";;AAmCA,4BAqFC;;AAtHD,wEAAoE;AACpE,kFAAyE;AACzE,2BAA4B;AAC5B,+BAAqC;AACrC,+BAAkC;AAClC,2DAAqC;AAGrC,kBAAgB;AAChB,sEAAmE;AACnE,sEAAgE;AAQhE,MAAM,eAAe,GAAG,CAAC,IAAY,EAAE,UAAkB,EAAE,EAAE;IAC3D,MAAM,kBAAkB,GAAG,IAAA,cAAO,EAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IACrD,IAAI,kBAAkB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C;QAEH,oDAAoD;QACpD,OAAO,GAAG,EAAE;YACV,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;gBACvB,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAC/B,CAAC,CAAC,CAAC;YACH,QAAQ,CAAC,KAAK,CAAC,CAAC,GAAiB,EAAE,EAAE;gBACnC,IAAI,GAAG,EAAE,CAAC;oBACR,sCAAsC;oBACtC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBACrB,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC,IAAI,CACL,EAAE,CAAC,GAAG,CAAC,CAAC,KAAU,EAAE,EAAE;QACpB,sCAAsC;QACtC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IAC7C,CAAC,CAAC,EACF,EAAE,CAAC,GAAG,CAAC,CAAC,KAAU,EAAE,EAAE;QACpB,+DAA+D;QAC/D,OAAO;YACL,OAAO,EAAE,CAAC,KAAK,CAAC,SAAS,EAAE;YAC3B,OAAO,EAAE,IAAA,cAAO,EAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC;SACjC,CAAC;IACtB,CAAC,CAAC,CACH,CAAC;IAEF,+DAA+D;IAC/D,OAAO,KAAK,CAAC,CAAC,IAAA,8BAAa,EAAC,UAA6B,CAAC,CAAC;AAC7D,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { ExecutorContext } from \"@nx/devkit\";\nimport { eachValueFrom } from \"@nx/devkit/src/utils/rxjs-for-await\";\nimport { enableTsConfigPath } from \"@trackunit/iris-app-build-utilities\";\nimport { rmSync } from \"fs\";\nimport { join, resolve } from \"path\";\nimport { Observable } from \"rxjs\";\nimport * as op from \"rxjs/operators\";\n\nimport { Configuration } from \"@rspack/core\";\nimport \"win-ca\";\nimport { checkPackageVersion } from \"../utils/checkPackageVersion\";\nimport { getDefaultConfig } from \"../utils/defaultRspackConfig\";\nimport { BuildExecutorSchema } from \"./schema\";\n\nexport type NodeBuildEvent = {\n outfile: string;\n success: boolean;\n};\n\nconst deleteOutputDir = (root: string, outputPath: string) => {\n const resolvedOutputPath = resolve(root, outputPath);\n if (resolvedOutputPath === root) {\n throw new Error(\"Output path MUST not be project root directory!\");\n }\n rmSync(resolvedOutputPath, { recursive: true, force: true });\n};\n\n/**\n * Build executor for building iris apps.\n *\n * @param {BuildExecutorSchema} options build executor options for this nx executor\n * @param {ExecutorContext} context build executor context for this nx executor\n * @yields {NodeBuildEvent} the build event\n */\nexport default async function* (options: BuildExecutorSchema, context: ExecutorContext) {\n await checkPackageVersion(false);\n if (!context.projectsConfigurations) {\n throw new Error(\"context projectsConfigurations is required\");\n }\n const projectRoot = context.projectsConfigurations.projects[context.projectName!]!.root;\n const projectRootDir = join(context.root, projectRoot);\n const tileManifestPath = join(context.root, projectRoot, \"iris-app-manifest.ts\");\n enableTsConfigPath({\n projectRootDir,\n });\n if (!options.rspackConfig) {\n throw new Error(\"option.rspackConfig is required\");\n }\n const IrisAppManifest = (await import(tileManifestPath)).default;\n const defaultConfig = await getDefaultConfig(\"production\", context.root, projectRootDir, IrisAppManifest, context);\n\n const customConfigFile = await import(options.rspackConfig);\n\n let config = customConfigFile.default(await defaultConfig);\n const isPromise = config instanceof Promise;\n if (isPromise) {\n config = await config;\n }\n deleteOutputDir(context.root, options.outputPath);\n const observable = new Observable(subscriber => {\n // eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires, local-rules/no-typescript-assertion\n const compiler = require(\"@rspack/core\").rspack(config as Configuration);\n\n // Add signal handlers\n const signals: NodeJS.Signals[] = [\"SIGINT\", \"SIGTERM\", \"SIGQUIT\"];\n const cleanup = () => {\n compiler.close((err: Error | null) => {\n if (err) {\n // eslint-disable-next-line no-console\n console.error(err);\n }\n process.exit(0);\n });\n };\n\n signals.forEach(signal => {\n process.on(signal, cleanup);\n });\n\n compiler.run((err: Error | null, stats: any) => {\n if (err) {\n // eslint-disable-next-line no-console\n console.error(err);\n subscriber.error(err);\n return;\n }\n\n subscriber.next(stats);\n subscriber.complete();\n });\n\n // Update cleanup function to remove signal handlers\n return () => {\n signals.forEach(signal => {\n process.off(signal, cleanup);\n });\n compiler.close((err: Error | null) => {\n if (err) {\n // eslint-disable-next-line no-console\n console.error(err);\n }\n });\n };\n }).pipe(\n op.tap((stats: any) => {\n // eslint-disable-next-line no-console\n console.info(stats.toString(config.stats));\n }),\n op.map((stats: any) => {\n // eslint-disable-next-line local-rules/no-typescript-assertion\n return {\n success: !stats.hasErrors(),\n outfile: resolve(context.root, options.outputPath),\n } as NodeBuildEvent;\n })\n );\n\n // eslint-disable-next-line local-rules/no-typescript-assertion\n return yield* eachValueFrom(observable as Observable<any>);\n}\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 2,
|
|
3
|
+
"outputCapture": "direct-nodejs",
|
|
4
|
+
"$schema": "http://json-schema.org/schema",
|
|
5
|
+
"title": "Build executor for apps from the Iris App SDK",
|
|
6
|
+
"description": "",
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"rspackConfig": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"description": "",
|
|
12
|
+
"$default": {
|
|
13
|
+
"$source": "argv",
|
|
14
|
+
"index": 0
|
|
15
|
+
},
|
|
16
|
+
"x-prompt": "What is the path for the rspack config for this app?"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"required": []
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 2,
|
|
3
|
+
"outputCapture": "direct-nodejs",
|
|
4
|
+
"$schema": "http://json-schema.org/schema",
|
|
5
|
+
"title": "Serve executor for apps from the Iris App SDK",
|
|
6
|
+
"description": "",
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"rspackConfig": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"description": "",
|
|
12
|
+
"$default": {
|
|
13
|
+
"$source": "argv",
|
|
14
|
+
"index": 0
|
|
15
|
+
},
|
|
16
|
+
"x-prompt": "What is the path for the rspack config for this app?"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"required": []
|
|
20
|
+
}
|