@nx/rspack 16.0.0-beta.0
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/README.md +81 -0
- package/executors.json +15 -0
- package/generators.json +31 -0
- package/package.json +35 -0
- package/src/executors/dev-server/dev-server.impl.d.ts +3 -0
- package/src/executors/dev-server/dev-server.impl.js +47 -0
- package/src/executors/dev-server/dev-server.impl.js.map +1 -0
- package/src/executors/dev-server/schema.d.ts +8 -0
- package/src/executors/dev-server/schema.json +23 -0
- package/src/executors/rspack/rspack.impl.d.ts +6 -0
- package/src/executors/rspack/rspack.impl.js +102 -0
- package/src/executors/rspack/rspack.impl.js.map +1 -0
- package/src/executors/rspack/schema.d.ts +15 -0
- package/src/executors/rspack/schema.json +104 -0
- package/src/generators/application/application.d.ts +3 -0
- package/src/generators/application/application.js +81 -0
- package/src/generators/application/application.js.map +1 -0
- package/src/generators/application/lib/create-ts-config.d.ts +3 -0
- package/src/generators/application/lib/create-ts-config.js +48 -0
- package/src/generators/application/lib/create-ts-config.js.map +1 -0
- package/src/generators/application/lib/normalize-options.d.ts +5 -0
- package/src/generators/application/lib/normalize-options.js +38 -0
- package/src/generators/application/lib/normalize-options.js.map +1 -0
- package/src/generators/application/schema.d.ts +16 -0
- package/src/generators/application/schema.json +97 -0
- package/src/generators/configuration/configuration.d.ts +4 -0
- package/src/generators/configuration/configuration.js +79 -0
- package/src/generators/configuration/configuration.js.map +1 -0
- package/src/generators/configuration/schema.d.ts +12 -0
- package/src/generators/configuration/schema.json +72 -0
- package/src/generators/init/init.d.ts +5 -0
- package/src/generators/init/init.js +37 -0
- package/src/generators/init/init.js.map +1 -0
- package/src/generators/init/schema.d.ts +8 -0
- package/src/generators/init/schema.json +24 -0
- package/src/generators/preset/preset.d.ts +3 -0
- package/src/generators/preset/preset.js +37 -0
- package/src/generators/preset/preset.js.map +1 -0
- package/src/generators/preset/schema.d.ts +18 -0
- package/src/generators/preset/schema.json +70 -0
- package/src/index.d.ts +6 -0
- package/src/index.js +10 -0
- package/src/index.js.map +1 -0
- package/src/utils/config.d.ts +3 -0
- package/src/utils/config.js +17 -0
- package/src/utils/config.js.map +1 -0
- package/src/utils/create-compiler.d.ts +4 -0
- package/src/utils/create-compiler.js +19 -0
- package/src/utils/create-compiler.js.map +1 -0
- package/src/utils/generator-utils.d.ts +34 -0
- package/src/utils/generator-utils.js +456 -0
- package/src/utils/generator-utils.js.map +1 -0
- package/src/utils/get-copy-patterns.d.ts +9 -0
- package/src/utils/get-copy-patterns.js +25 -0
- package/src/utils/get-copy-patterns.js.map +1 -0
- package/src/utils/jest-utils.d.ts +1 -0
- package/src/utils/jest-utils.js +10 -0
- package/src/utils/jest-utils.js.map +1 -0
- package/src/utils/mode-utils.d.ts +2 -0
- package/src/utils/mode-utils.js +8 -0
- package/src/utils/mode-utils.js.map +1 -0
- package/src/utils/model.d.ts +6 -0
- package/src/utils/model.js +3 -0
- package/src/utils/model.js.map +1 -0
- package/src/utils/normalize-assets.d.ts +1 -0
- package/src/utils/normalize-assets.js +41 -0
- package/src/utils/normalize-assets.js.map +1 -0
- package/src/utils/versions.d.ts +19 -0
- package/src/utils/versions.js +23 -0
- package/src/utils/versions.js.map +1 -0
- package/src/utils/with-nx.d.ts +3 -0
- package/src/utils/with-nx.js +75 -0
- package/src/utils/with-nx.js.map +1 -0
- package/src/utils/with-react.d.ts +3 -0
- package/src/utils/with-react.js +20 -0
- package/src/utils/with-react.js.map +1 -0
- package/src/utils/with-web.d.ts +9 -0
- package/src/utils/with-web.js +82 -0
- package/src/utils/with-web.js.map +1 -0
package/README.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
<p style="text-align: center;"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx.png" width="600" alt="Nx - Smart, Fast and Extensible Build System"></p>
|
|
2
|
+
|
|
3
|
+
<hr>
|
|
4
|
+
|
|
5
|
+
# Nx: Smart, Fast and Extensible Build System
|
|
6
|
+
|
|
7
|
+
Nx is a next generation build system with first class monorepo support and powerful integrations.
|
|
8
|
+
|
|
9
|
+
This package is a Rspack plugin for Nx.
|
|
10
|
+
|
|
11
|
+
## Getting Started
|
|
12
|
+
|
|
13
|
+
Use `--preset=@nrwl/rspack` when creating new workspace.
|
|
14
|
+
|
|
15
|
+
e.g.
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npx create-nx-workspace@latest rspack-demo --preset=@nrwl/rspack
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Now, you can go into the `rspack-demo` folder and start development.
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
cd rspack-demo
|
|
25
|
+
npm start
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
You can also run lint, test, and e2e scripts for the project.
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npm run lint
|
|
32
|
+
npm run test
|
|
33
|
+
npm run e2e
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Existing workspaces
|
|
37
|
+
|
|
38
|
+
You can add Rspack to any existing Nx workspace.
|
|
39
|
+
|
|
40
|
+
First, install the plugin:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
npm install --save-dev @nrwl/rspack
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Then, run the `rspack-project` generator:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
npx nx g @nrwl/rspack:rspack-project --skipValidation
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**Note:** The `--skipValidation` option allows you to overwrite existing build targets.
|
|
53
|
+
|
|
54
|
+
## Workspace libraries
|
|
55
|
+
|
|
56
|
+
The `@nrwl/rspack` executor support importing workspace libs into the app.
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
npx nx g @nx/react:lib mylib
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Import the new library in your app.
|
|
63
|
+
|
|
64
|
+
```typescript jsx
|
|
65
|
+
// src/app/app.tsx
|
|
66
|
+
import { Mylib } from '@rspack-demo/mylib';
|
|
67
|
+
|
|
68
|
+
// ...
|
|
69
|
+
|
|
70
|
+
export default function App() {
|
|
71
|
+
return <MyLib />;
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Now, run the dev server again to see the new library in action.
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
npm start
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
**Note:** You must restart the server if you make any changes to your library.
|
package/executors.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"executors": {
|
|
4
|
+
"rspack": {
|
|
5
|
+
"implementation": "./src/executors/rspack/rspack.impl",
|
|
6
|
+
"schema": "./src/executors/rspack/schema.json",
|
|
7
|
+
"description": "rspack executor"
|
|
8
|
+
},
|
|
9
|
+
"dev-server": {
|
|
10
|
+
"implementation": "./src/executors/dev-server/dev-server.impl",
|
|
11
|
+
"schema": "./src/executors/dev-server/schema.json",
|
|
12
|
+
"description": "dev-server executor"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
package/generators.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"name": "rspack",
|
|
4
|
+
"version": "0.0.1",
|
|
5
|
+
"generators": {
|
|
6
|
+
"configuration": {
|
|
7
|
+
"factory": "./src/generators/configuration/configuration",
|
|
8
|
+
"schema": "./src/generators/configuration/schema.json",
|
|
9
|
+
"description": "Rspack configuration generator."
|
|
10
|
+
},
|
|
11
|
+
"init": {
|
|
12
|
+
"factory": "./src/generators/init/init",
|
|
13
|
+
"schema": "./src/generators/init/schema.json",
|
|
14
|
+
"description": "Rspack init generator.",
|
|
15
|
+
"hidden": true
|
|
16
|
+
},
|
|
17
|
+
"preset": {
|
|
18
|
+
"factory": "./src/generators/preset/preset",
|
|
19
|
+
"schema": "./src/generators/preset/schema.json",
|
|
20
|
+
"description": "React preset generator.",
|
|
21
|
+
"hidden": true
|
|
22
|
+
},
|
|
23
|
+
"application": {
|
|
24
|
+
"factory": "./src/generators/application/application",
|
|
25
|
+
"schema": "./src/generators/application/schema.json",
|
|
26
|
+
"aliases": ["app"],
|
|
27
|
+
"x-type": "application",
|
|
28
|
+
"description": "React application generator."
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nx/rspack",
|
|
3
|
+
"version": "16.0.0-beta.0",
|
|
4
|
+
"type": "commonjs",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/nrwl/nx-labs.git",
|
|
8
|
+
"directory": "packages/rspack"
|
|
9
|
+
},
|
|
10
|
+
"keywords": [
|
|
11
|
+
"Monorepo",
|
|
12
|
+
"Next",
|
|
13
|
+
"Vercel"
|
|
14
|
+
],
|
|
15
|
+
"author": "Jack Hsu",
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"homepage": "https://nx.dev",
|
|
18
|
+
"main": "src/index.js",
|
|
19
|
+
"generators": "./generators.json",
|
|
20
|
+
"executors": "./executors.json",
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@nx/devkit": "^16.0.0",
|
|
23
|
+
"@nx/js": "^16.0.0",
|
|
24
|
+
"@nx/linter": "^16.0.0",
|
|
25
|
+
"@phenomnomnominal/tsquery": "~5.0.1",
|
|
26
|
+
"ajv": "^8.12.0",
|
|
27
|
+
"ajv-keywords": "5.1.0",
|
|
28
|
+
"enquirer": "2.3.6",
|
|
29
|
+
"less-loader": "11.1.0",
|
|
30
|
+
"sass-loader": "^12.2.0",
|
|
31
|
+
"stylus-loader": "^7.1.0",
|
|
32
|
+
"tsconfig-paths": "4.2.0"
|
|
33
|
+
},
|
|
34
|
+
"types": "./src/index.d.ts"
|
|
35
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const async_iterable_1 = require("@nx/devkit/src/utils/async-iterable");
|
|
6
|
+
const dev_server_1 = require("@rspack/dev-server");
|
|
7
|
+
const create_compiler_1 = require("../../utils/create-compiler");
|
|
8
|
+
const mode_utils_1 = require("../../utils/mode-utils");
|
|
9
|
+
function runExecutor(options, context) {
|
|
10
|
+
var _a, _b, _c;
|
|
11
|
+
var _d;
|
|
12
|
+
return tslib_1.__asyncGenerator(this, arguments, function* runExecutor_1() {
|
|
13
|
+
(_a = (_d = process.env).NODE_ENV) !== null && _a !== void 0 ? _a : (_d.NODE_ENV = (_b = options.mode) !== null && _b !== void 0 ? _b : 'development');
|
|
14
|
+
if ((0, mode_utils_1.isMode)(process.env.NODE_ENV)) {
|
|
15
|
+
options.mode = process.env.NODE_ENV;
|
|
16
|
+
}
|
|
17
|
+
const buildTarget = (0, devkit_1.parseTargetString)(options.buildTarget, context.projectGraph);
|
|
18
|
+
// If I don't typecast, it throws an error
|
|
19
|
+
// that port does not exist on type DevServer
|
|
20
|
+
// however, it does exist, since DevServer extends
|
|
21
|
+
// WebpackDevServer.Configuration which has port
|
|
22
|
+
let devServerConfig = {
|
|
23
|
+
port: (_c = options.port) !== null && _c !== void 0 ? _c : 4200,
|
|
24
|
+
hot: true,
|
|
25
|
+
};
|
|
26
|
+
const buildOptions = (0, devkit_1.readTargetOptions)(buildTarget, context);
|
|
27
|
+
const compiler = yield tslib_1.__await((0, create_compiler_1.createCompiler)(Object.assign(Object.assign({}, buildOptions), { devServer: devServerConfig, mode: options.mode }), context));
|
|
28
|
+
devServerConfig = Object.assign(Object.assign({}, devServerConfig), compiler.options.devServer);
|
|
29
|
+
yield tslib_1.__await(yield* tslib_1.__asyncDelegator(tslib_1.__asyncValues((0, async_iterable_1.createAsyncIterable)(({ next }) => {
|
|
30
|
+
const server = new dev_server_1.RspackDevServer(
|
|
31
|
+
// If I don't typecast, it throws an error
|
|
32
|
+
// that onListening does not exist on type DevServer
|
|
33
|
+
// however, it does exist, since DevServer extends
|
|
34
|
+
// WebpackDevServer.Configuration which has onListening
|
|
35
|
+
Object.assign(Object.assign({}, devServerConfig), { onListening: (server) => {
|
|
36
|
+
var _a;
|
|
37
|
+
next({
|
|
38
|
+
success: true,
|
|
39
|
+
baseUrl: `http://localhost:${(_a = options.port) !== null && _a !== void 0 ? _a : 4200}`,
|
|
40
|
+
});
|
|
41
|
+
} }), compiler);
|
|
42
|
+
server.start();
|
|
43
|
+
}))));
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
exports.default = runExecutor;
|
|
47
|
+
//# sourceMappingURL=dev-server.impl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev-server.impl.js","sourceRoot":"","sources":["../../../../../../packages/rspack/src/executors/dev-server/dev-server.impl.ts"],"names":[],"mappings":";;;AAAA,uCAIoB;AACpB,wEAA0E;AAE1E,mDAAqD;AACrD,iEAA6D;AAC7D,uDAAgD;AAGhD,SAA+B,WAAW,CACxC,OAAgC,EAChC,OAAwB;;;;QAExB,YAAA,OAAO,CAAC,GAAG,EAAC,QAAQ,uCAAR,QAAQ,GAAK,MAAA,OAAO,CAAC,IAAI,mCAAI,aAAa,EAAC;QAEvD,IAAI,IAAA,mBAAM,EAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;YAChC,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;SACrC;QAED,MAAM,WAAW,GAAG,IAAA,0BAAiB,EACnC,OAAO,CAAC,WAAW,EACnB,OAAO,CAAC,YAAY,CACrB,CAAC;QAEF,0CAA0C;QAC1C,6CAA6C;QAC7C,kDAAkD;QAClD,gDAAgD;QAChD,IAAI,eAAe,GAAc;YAC/B,IAAI,EAAE,MAAA,OAAO,CAAC,IAAI,mCAAI,IAAI;YAC1B,GAAG,EAAE,IAAI;SACG,CAAC;QAEf,MAAM,YAAY,GAAG,IAAA,0BAAiB,EAAM,WAAW,EAAE,OAAO,CAAC,CAAC;QAClE,MAAM,QAAQ,GAAG,sBAAM,IAAA,gCAAc,kCAC9B,YAAY,KAAE,SAAS,EAAE,eAAe,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,KACjE,OAAO,CACR,CAAA,CAAC;QAEF,eAAe,mCACV,eAAe,GACf,QAAQ,CAAC,OAAO,CAAC,SAAS,CAC9B,CAAC;QAEF,sBAAA,KAAK,CAAC,CAAC,yBAAA,sBAAA,IAAA,oCAAmB,EAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE;YACtC,MAAM,MAAM,GAAQ,IAAI,4BAAe;YACrC,0CAA0C;YAC1C,oDAAoD;YACpD,kDAAkD;YAClD,uDAAuD;YACvD,gCACK,eAAe,KAClB,WAAW,EAAE,CAAC,MAAW,EAAE,EAAE;;oBAC3B,IAAI,CAAC;wBACH,OAAO,EAAE,IAAI;wBACb,OAAO,EAAE,oBAAoB,MAAA,OAAO,CAAC,IAAI,mCAAI,IAAI,EAAE;qBACpD,CAAC,CAAC;gBACL,CAAC,GACW,EAEd,QAAQ,CACT,CAAC;YACF,MAAM,CAAC,KAAK,EAAE,CAAC;QACjB,CAAC,CAAC,CAAA,CAAA,CAAA,CAAC;;CACJ;AAvDD,8BAuDC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"version": 2,
|
|
4
|
+
"title": "Rspack dev-server executor",
|
|
5
|
+
"description": "",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"buildTarget": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "The build target for rspack."
|
|
11
|
+
},
|
|
12
|
+
"port": {
|
|
13
|
+
"type": "number",
|
|
14
|
+
"description": "The port to for the dev-server to listen on."
|
|
15
|
+
},
|
|
16
|
+
"mode": {
|
|
17
|
+
"type": "string",
|
|
18
|
+
"description": "Mode to run the server in.",
|
|
19
|
+
"enum": ["development", "production", "none"]
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"required": ["buildTarget"]
|
|
23
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ExecutorContext } from '@nx/devkit';
|
|
2
|
+
import { RspackExecutorSchema } from './schema';
|
|
3
|
+
export default function runExecutor(options: RspackExecutorSchema, context: ExecutorContext): AsyncGenerator<{
|
|
4
|
+
success: boolean;
|
|
5
|
+
outfile?: string;
|
|
6
|
+
}, void, undefined>;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const async_iterable_1 = require("@nx/devkit/src/utils/async-iterable");
|
|
6
|
+
const fs_1 = require("fs");
|
|
7
|
+
const path = require("path");
|
|
8
|
+
const create_compiler_1 = require("../../utils/create-compiler");
|
|
9
|
+
const mode_utils_1 = require("../../utils/mode-utils");
|
|
10
|
+
function runExecutor(options, context) {
|
|
11
|
+
var _a, _b;
|
|
12
|
+
var _c;
|
|
13
|
+
return tslib_1.__asyncGenerator(this, arguments, function* runExecutor_1() {
|
|
14
|
+
(_a = (_c = process.env).NODE_ENV) !== null && _a !== void 0 ? _a : (_c.NODE_ENV = (_b = options.mode) !== null && _b !== void 0 ? _b : 'production');
|
|
15
|
+
if ((0, mode_utils_1.isMode)(process.env.NODE_ENV)) {
|
|
16
|
+
options.mode = process.env.NODE_ENV;
|
|
17
|
+
}
|
|
18
|
+
// Mimic --clean from webpack.
|
|
19
|
+
(0, fs_1.rmSync)(path.join(context.root, options.outputPath), {
|
|
20
|
+
force: true,
|
|
21
|
+
recursive: true,
|
|
22
|
+
});
|
|
23
|
+
const compiler = yield tslib_1.__await((0, create_compiler_1.createCompiler)(options, context));
|
|
24
|
+
const iterable = (0, async_iterable_1.createAsyncIterable)(({ next, done }) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
if (options.watch) {
|
|
26
|
+
const watcher = compiler.watch({}, (err, stats) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
if (err) {
|
|
28
|
+
devkit_1.logger.error(err);
|
|
29
|
+
next({ success: false });
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (!compiler || !stats) {
|
|
33
|
+
devkit_1.logger.error(new Error('Compiler or stats not available'));
|
|
34
|
+
next({ success: false });
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const statsOptions = compiler.options
|
|
38
|
+
? compiler.options.stats
|
|
39
|
+
: undefined;
|
|
40
|
+
const printedStats = stats.toString(statsOptions);
|
|
41
|
+
// Avoid extra empty line when `stats: 'none'`
|
|
42
|
+
if (printedStats) {
|
|
43
|
+
console.error(printedStats);
|
|
44
|
+
}
|
|
45
|
+
next({
|
|
46
|
+
success: !stats.hasErrors(),
|
|
47
|
+
outfile: path.resolve(context.root, options.outputPath, 'main.js'),
|
|
48
|
+
});
|
|
49
|
+
}));
|
|
50
|
+
registerCleanupCallback(() => {
|
|
51
|
+
watcher.close(() => {
|
|
52
|
+
devkit_1.logger.info('Watcher closed');
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
compiler.run((err, stats) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
compiler.close(() => {
|
|
59
|
+
if (err) {
|
|
60
|
+
devkit_1.logger.error(err);
|
|
61
|
+
next({ success: false });
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
if (!compiler || !stats) {
|
|
65
|
+
devkit_1.logger.error(new Error('Compiler or stats not available'));
|
|
66
|
+
next({ success: false });
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const statsOptions = compiler.options
|
|
70
|
+
? compiler.options.stats
|
|
71
|
+
: undefined;
|
|
72
|
+
const printedStats = stats.toString(statsOptions);
|
|
73
|
+
// Avoid extra empty line when `stats: 'none'`
|
|
74
|
+
if (printedStats) {
|
|
75
|
+
console.error(printedStats);
|
|
76
|
+
}
|
|
77
|
+
next({
|
|
78
|
+
success: !stats.hasErrors(),
|
|
79
|
+
outfile: path.resolve(context.root, options.outputPath, 'main.js'),
|
|
80
|
+
});
|
|
81
|
+
done();
|
|
82
|
+
});
|
|
83
|
+
}));
|
|
84
|
+
}
|
|
85
|
+
}));
|
|
86
|
+
yield tslib_1.__await(yield* tslib_1.__asyncDelegator(tslib_1.__asyncValues(iterable)));
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
exports.default = runExecutor;
|
|
90
|
+
// copied from packages/esbuild/src/executors/esbuild/esbuild.impl.ts
|
|
91
|
+
function registerCleanupCallback(callback) {
|
|
92
|
+
const wrapped = () => {
|
|
93
|
+
callback();
|
|
94
|
+
process.off('SIGINT', wrapped);
|
|
95
|
+
process.off('SIGTERM', wrapped);
|
|
96
|
+
process.off('exit', wrapped);
|
|
97
|
+
};
|
|
98
|
+
process.on('SIGINT', wrapped);
|
|
99
|
+
process.on('SIGTERM', wrapped);
|
|
100
|
+
process.on('exit', wrapped);
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=rspack.impl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rspack.impl.js","sourceRoot":"","sources":["../../../../../../packages/rspack/src/executors/rspack/rspack.impl.ts"],"names":[],"mappings":";;;AAAA,uCAAqD;AACrD,wEAA0E;AAG1E,2BAA4B;AAC5B,6BAA6B;AAC7B,iEAA6D;AAC7D,uDAAgD;AAGhD,SAA+B,WAAW,CACxC,OAA6B,EAC7B,OAAwB;;;;QAExB,YAAA,OAAO,CAAC,GAAG,EAAC,QAAQ,uCAAR,QA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YAAY,EAAE;4BAChB,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;yBAC7B;wBACD,IAAI,CAAC;4BACH,OAAO,EAAE,CAAC,KAAK,CAAC,SAAS,EAAE;4BAC3B,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,UAAU,EAAE,SAAS,CAAC;yBACnE,CAAC,CAAC;wBACH,IAAI,EAAE,CAAC;oBACT,CAAC,CAAC,CAAC;gBACL,CAAC,CAAA,CAAC,CAAC;aACJ;QACH,CAAC,CAAA,CAAC,CAAC;QAEH,sBAAA,KAAK,CAAC,CAAC,yBAAA,sBAAA,QAAQ,CAAA,CAAA,CAAA,CAAC;;CACjB;AAzFD,8BAyFC;AAED,qEAAqE;AACrE,SAAS,uBAAuB,CAAC,QAAoB;IACnD,MAAM,OAAO,GAAG,GAAG,EAAE;QACnB,QAAQ,EAAE,CAAC;QACX,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC/B,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAChC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,CAAC,CAAC;IAEF,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC9B,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAC/B,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Mode } from '@rspack/core';
|
|
2
|
+
export interface RspackExecutorSchema {
|
|
3
|
+
target: 'web' | 'node';
|
|
4
|
+
main: string;
|
|
5
|
+
tsConfig: string;
|
|
6
|
+
outputPath: string;
|
|
7
|
+
indexHtml?: string;
|
|
8
|
+
mode?: Mode;
|
|
9
|
+
watch?: boolean;
|
|
10
|
+
|
|
11
|
+
rspackConfig: string;
|
|
12
|
+
optimization?: boolean;
|
|
13
|
+
sourceMap?: boolean | string;
|
|
14
|
+
assets?: any[];
|
|
15
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"version": 2,
|
|
4
|
+
"title": "Rspack build executor",
|
|
5
|
+
"description": "",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"target": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "The platform to target (e.g. web, node).",
|
|
11
|
+
"enum": ["web", "node"]
|
|
12
|
+
},
|
|
13
|
+
"main": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"description": "The main entry file."
|
|
16
|
+
},
|
|
17
|
+
"outputPath": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"description": "The output path for the bundle."
|
|
20
|
+
},
|
|
21
|
+
"tsConfig": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"description": "The tsconfig file to build the project."
|
|
24
|
+
},
|
|
25
|
+
"indexHtml": {
|
|
26
|
+
"type": "string",
|
|
27
|
+
"description": "The path to the index.html file."
|
|
28
|
+
},
|
|
29
|
+
"rspackConfig": {
|
|
30
|
+
"type": "string",
|
|
31
|
+
"description": "The path to the rspack config file."
|
|
32
|
+
},
|
|
33
|
+
"optimization": {
|
|
34
|
+
"type": "boolean",
|
|
35
|
+
"description": "Enables optimization of the build output."
|
|
36
|
+
},
|
|
37
|
+
"sourceMap": {
|
|
38
|
+
"description": "Output sourcemaps. Use 'hidden' for use with error reporting tools without generating sourcemap comment.",
|
|
39
|
+
"default": true,
|
|
40
|
+
"oneOf": [
|
|
41
|
+
{
|
|
42
|
+
"type": "boolean"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"type": "string"
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
"assets": {
|
|
50
|
+
"type": "array",
|
|
51
|
+
"description": "List of static application assets.",
|
|
52
|
+
"default": [],
|
|
53
|
+
"items": {
|
|
54
|
+
"$ref": "#/definitions/assetPattern"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"mode": {
|
|
58
|
+
"type": "string",
|
|
59
|
+
"description": "Mode to run the build in.",
|
|
60
|
+
"enum": ["development", "production", "none"]
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"required": ["target", "main", "outputPath", "tsConfig", "rspackConfig"],
|
|
64
|
+
"definitions": {
|
|
65
|
+
"assetPattern": {
|
|
66
|
+
"oneOf": [
|
|
67
|
+
{
|
|
68
|
+
"type": "object",
|
|
69
|
+
"properties": {
|
|
70
|
+
"glob": {
|
|
71
|
+
"type": "string",
|
|
72
|
+
"description": "The pattern to match."
|
|
73
|
+
},
|
|
74
|
+
"input": {
|
|
75
|
+
"type": "string",
|
|
76
|
+
"description": "The input directory path in which to apply 'glob'. Defaults to the project root."
|
|
77
|
+
},
|
|
78
|
+
"ignore": {
|
|
79
|
+
"description": "An array of globs to ignore.",
|
|
80
|
+
"type": "array",
|
|
81
|
+
"items": {
|
|
82
|
+
"type": "string"
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
"output": {
|
|
86
|
+
"type": "string",
|
|
87
|
+
"description": "Absolute path within the output."
|
|
88
|
+
},
|
|
89
|
+
"watch": {
|
|
90
|
+
"type": "boolean",
|
|
91
|
+
"description": "Enable re-building when files change.",
|
|
92
|
+
"default": false
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
"additionalProperties": false,
|
|
96
|
+
"required": ["glob", "input", "output"]
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"type": "string"
|
|
100
|
+
}
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const package_json_1 = require("nx/package.json");
|
|
6
|
+
const configuration_1 = require("../configuration/configuration");
|
|
7
|
+
const init_1 = require("../init/init");
|
|
8
|
+
const normalize_options_1 = require("./lib/normalize-options");
|
|
9
|
+
function default_1(tree, _options) {
|
|
10
|
+
var _a, _b, _c, _d;
|
|
11
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
12
|
+
const tasks = [];
|
|
13
|
+
const initTask = yield (0, init_1.default)(tree, _options);
|
|
14
|
+
tasks.push(initTask);
|
|
15
|
+
const options = (0, normalize_options_1.normalizeOptions)(tree, _options);
|
|
16
|
+
(_a = options.style) !== null && _a !== void 0 ? _a : (options.style = 'css');
|
|
17
|
+
if (options.framework === 'nest') {
|
|
18
|
+
const { applicationGenerator: nestAppGenerator } = (0, devkit_1.ensurePackage)('@nx/nest', package_json_1.version);
|
|
19
|
+
const createAppTask = yield nestAppGenerator(tree, Object.assign(Object.assign({}, options), { skipFormat: true, tags: (_b = options.tags) !== null && _b !== void 0 ? _b : '' }));
|
|
20
|
+
const convertAppTask = yield (0, configuration_1.default)(tree, {
|
|
21
|
+
project: options.name,
|
|
22
|
+
target: 'node',
|
|
23
|
+
newProject: false,
|
|
24
|
+
buildTarget: 'build',
|
|
25
|
+
framework: 'nest',
|
|
26
|
+
});
|
|
27
|
+
tasks.push(createAppTask, convertAppTask);
|
|
28
|
+
}
|
|
29
|
+
else if (options.framework === 'web') {
|
|
30
|
+
const { applicationGenerator: webAppGenerator } = (0, devkit_1.ensurePackage)('@nrwl/web', package_json_1.version);
|
|
31
|
+
const createAppTask = yield webAppGenerator(tree, {
|
|
32
|
+
bundler: 'webpack',
|
|
33
|
+
name: options.name,
|
|
34
|
+
style: options.style,
|
|
35
|
+
directorsy: options.directory,
|
|
36
|
+
tags: (_c = options.tags) !== null && _c !== void 0 ? _c : '',
|
|
37
|
+
unitTestRunner: options.unitTestRunner,
|
|
38
|
+
e2eTestRunner: options.e2eTestRunner,
|
|
39
|
+
rootProject: options.rootProject,
|
|
40
|
+
skipFormat: true,
|
|
41
|
+
});
|
|
42
|
+
const convertAppTask = yield (0, configuration_1.default)(tree, {
|
|
43
|
+
project: options.name,
|
|
44
|
+
target: 'web',
|
|
45
|
+
newProject: false,
|
|
46
|
+
buildTarget: 'build',
|
|
47
|
+
serveTarget: 'serve',
|
|
48
|
+
framework: 'web',
|
|
49
|
+
});
|
|
50
|
+
tasks.push(createAppTask, convertAppTask);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
// default to react
|
|
54
|
+
const { applicationGenerator: reactAppGenerator } = (0, devkit_1.ensurePackage)('@nx/react', package_json_1.version);
|
|
55
|
+
const createAppTask = yield reactAppGenerator(tree, {
|
|
56
|
+
bundler: 'webpack',
|
|
57
|
+
name: options.name,
|
|
58
|
+
style: options.style,
|
|
59
|
+
directorsy: options.directory,
|
|
60
|
+
tags: (_d = options.tags) !== null && _d !== void 0 ? _d : '',
|
|
61
|
+
unitTestRunner: options.unitTestRunner,
|
|
62
|
+
e2eTestRunner: options.e2eTestRunner,
|
|
63
|
+
rootProject: options.rootProject,
|
|
64
|
+
skipFormat: true,
|
|
65
|
+
});
|
|
66
|
+
const convertAppTask = yield (0, configuration_1.default)(tree, {
|
|
67
|
+
project: options.name,
|
|
68
|
+
target: 'web',
|
|
69
|
+
newProject: false,
|
|
70
|
+
buildTarget: 'build',
|
|
71
|
+
serveTarget: 'serve',
|
|
72
|
+
framework: 'react',
|
|
73
|
+
});
|
|
74
|
+
tasks.push(createAppTask, convertAppTask);
|
|
75
|
+
}
|
|
76
|
+
yield (0, devkit_1.formatFiles)(tree);
|
|
77
|
+
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
exports.default = default_1;
|
|
81
|
+
//# sourceMappingURL=application.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"application.js","sourceRoot":"","sources":["../../../../../../packages/rspack/src/generators/application/application.ts"],"names":[],"mappings":";;;AAAA,uCAAgF;AAChF,kDAAuD;AACvD,kEAAoE;AACpE,uCAA+C;AAC/C,+DAA2D;AAG3D,mBACE,IAAU,EACV,QAAoC;;;QAEpC,MAAM,KAAK,GAAG,EAAE,CAAC;QACjB,MAAM,QAAQ,GAAG,MAAM,IAAA,cAAmB,EAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAC3D,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAErB,MAAM,OAAO,GAAG,IAAA,oCAAgB,EAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAEjD,MAAA,OAAO,CAAC,KAAK,oCAAb,OAAO,CAAC,KAAK,GAAK,KAAK,EAAC;QAExB,IAAI,OAAO,CAAC,SAAS,KAAK,MAAM,EAAE;YAChC,MAAM,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,GAAG,IAAA,sBAAa,EAC9D,UAAU,EACV,sBAAS,CACV,CAAC;YACF,MAAM,aAAa,GAAG,MAAM,gBAAgB,CAAC,IAAI,kCAC5C,OAAO,KACV,UAAU,EAAE,IAAI,EAChB,IAAI,EAAE,MAAA,OAAO,CAAC,IAAI,mCAAI,EAAE,IACxB,CAAC;YAEH,MAAM,cAAc,GAAG,MAAM,IAAA,uBAAsB,EAAC,IAAI,EAAE;gBACxD,OAAO,EAAE,OAAO,CAAC,IAAI;gBACrB,MAAM,EAAE,MAAM;gBACd,UAAU,EAAE,KAAK;gBACjB,WAAW,EAAE,OAAO;gBACpB,SAAS,EAAE,MAAM;aAClB,CAAC,CAAC;YAEH,KAAK,CAAC,IAAI,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC;SAC3C;aAAM,IAAI,OAAO,CAAC,SAAS,KAAK,KAAK,EAAE;YACtC,MAAM,EAAE,oBAAoB,EAAE,eAAe,EAAE,GAAG,IAAA,sBAAa,EAC7D,WAAW,EACX,sBAAS,CAC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B,CAAC,CAAC;YACH,MAAM,cAAc,GAAG,MAAM,IAAA,uBAAsB,EAAC,IAAI,EAAE;gBACxD,OAAO,EAAE,OAAO,CAAC,IAAI;gBACrB,MAAM,EAAE,KAAK;gBACb,UAAU,EAAE,KAAK;gBACjB,WAAW,EAAE,OAAO;gBACpB,WAAW,EAAE,OAAO;gBACpB,SAAS,EAAE,OAAO;aACnB,CAAC,CAAC;YACH,KAAK,CAAC,IAAI,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC;SAC3C;QAED,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;QAExB,OAAO,IAAA,yBAAgB,EAAC,GAAG,KAAK,CAAC,CAAC;;CACnC;AAxFD,4BAwFC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.editTsConfig = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
function editTsConfig(tree, projectRoot, framework, relativePathToRootTsConfig) {
|
|
7
|
+
// Nx 15.8 moved util to @nx/js, but it is in @nx/workspace in 15.7
|
|
8
|
+
let shared;
|
|
9
|
+
try {
|
|
10
|
+
shared = require('@nx/js/src/utils/typescript/create-ts-config');
|
|
11
|
+
}
|
|
12
|
+
catch (_a) {
|
|
13
|
+
shared = require('@nx/workspace/src/utils/create-ts-config');
|
|
14
|
+
}
|
|
15
|
+
if (framework === 'react') {
|
|
16
|
+
const json = {
|
|
17
|
+
compilerOptions: {
|
|
18
|
+
jsx: 'react-jsx',
|
|
19
|
+
allowJs: false,
|
|
20
|
+
esModuleInterop: false,
|
|
21
|
+
allowSyntheticDefaultImports: true,
|
|
22
|
+
strict: true,
|
|
23
|
+
},
|
|
24
|
+
files: [],
|
|
25
|
+
include: [],
|
|
26
|
+
references: [
|
|
27
|
+
{
|
|
28
|
+
path: './tsconfig.app.json',
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
};
|
|
32
|
+
// inline tsconfig.base.json into the project
|
|
33
|
+
if (projectIsRootProjectInStandaloneWorkspace(projectRoot)) {
|
|
34
|
+
json.compileOnSave = false;
|
|
35
|
+
json.compilerOptions = Object.assign(Object.assign({}, shared.tsConfigBaseOptions), json.compilerOptions);
|
|
36
|
+
json.exclude = ['node_modules', 'tmp'];
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
json.extends = relativePathToRootTsConfig;
|
|
40
|
+
}
|
|
41
|
+
(0, devkit_1.writeJson)(tree, `${projectRoot}/tsconfig.json`, json);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.editTsConfig = editTsConfig;
|
|
45
|
+
function projectIsRootProjectInStandaloneWorkspace(projectRoot) {
|
|
46
|
+
return (0, path_1.relative)(devkit_1.workspaceRoot, projectRoot).length === 0;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=create-ts-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-ts-config.js","sourceRoot":"","sources":["../../../../../../../packages/rspack/src/generators/application/lib/create-ts-config.ts"],"names":[],"mappings":";;;AAAA,uCAA4D;AAC5D,+BAAgC;AAGhC,SAAgB,YAAY,CAC1B,IAAU,EACV,WAAmB,EACnB,SAAoB,EACpB,0BAAkC;IAElC,mEAAmE;IACnE,IAAI,MAAW,CAAC;IAChB,IAAI;QACF,MAAM,GAAG,OAAO,CAAC,8CAA8C,CAAC,CAAC;KAClE;IAAC,WAAM;QACN,MAAM,GAAG,OAAO,CAAC,0CAA0C,CAAC,CAAC;KAC9D;IAED,IAAI,SAAS,KAAK,OAAO,EAAE;QACzB,MAAM,IAAI,GAAG;YACX,eAAe,EAAE;gBACf,GAAG,EAAE,WAAW;gBAChB,OAAO,EAAE,KAAK;gBACd,eAAe,EAAE,KAAK;gBACtB,4BAA4B,EAAE,IAAI;gBAClC,MAAM,EAAE,IAAI;aACb;YACD,KAAK,EAAE,EAAE;YACT,OAAO,EAAE,EAAE;YACX,UAAU,EAAE;gBACV;oBACE,IAAI,EAAE,qBAAqB;iBAC5B;aACF;SACK,CAAC;QAET,6CAA6C;QAC7C,IAAI,yCAAyC,CAAC,WAAW,CAAC,EAAE;YAC1D,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;YAC3B,IAAI,CAAC,eAAe,mCACf,MAAM,CAAC,mBAAmB,GAC1B,IAAI,CAAC,eAAe,CACxB,CAAC;YACF,IAAI,CAAC,OAAO,GAAG,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;SACxC;aAAM;YACL,IAAI,CAAC,OAAO,GAAG,0BAA0B,CAAC;SAC3C;QAED,IAAA,kBAAS,EAAC,IAAI,EAAE,GAAG,WAAW,gBAAgB,EAAE,IAAI,CAAC,CAAC;KACvD;AACH,CAAC;AA9CD,oCA8CC;AAED,SAAS,yCAAyC,CAAC,WAAmB;IACpE,OAAO,IAAA,eAAQ,EAAC,sBAAa,EAAE,WAAW,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC;AAC3D,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Tree } from '@nx/devkit';
|
|
2
|
+
import { ApplicationGeneratorSchema, NormalizedSchema } from '../schema';
|
|
3
|
+
export declare function normalizeDirectory(options: ApplicationGeneratorSchema): string;
|
|
4
|
+
export declare function normalizeProjectName(options: ApplicationGeneratorSchema): string;
|
|
5
|
+
export declare function normalizeOptions(host: Tree, options: ApplicationGeneratorSchema): NormalizedSchema;
|