@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
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normalizeOptions = exports.normalizeProjectName = exports.normalizeDirectory = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
function normalizeDirectory(options) {
|
|
6
|
+
const { projectDirectory } = (0, devkit_1.extractLayoutDirectory)(options.directory);
|
|
7
|
+
return projectDirectory
|
|
8
|
+
? `${(0, devkit_1.names)(projectDirectory).fileName}/${(0, devkit_1.names)(options.name).fileName}`
|
|
9
|
+
: (0, devkit_1.names)(options.name).fileName;
|
|
10
|
+
}
|
|
11
|
+
exports.normalizeDirectory = normalizeDirectory;
|
|
12
|
+
function normalizeProjectName(options) {
|
|
13
|
+
return normalizeDirectory(options).replace(new RegExp('/', 'g'), '-');
|
|
14
|
+
}
|
|
15
|
+
exports.normalizeProjectName = normalizeProjectName;
|
|
16
|
+
function normalizeOptions(host, options) {
|
|
17
|
+
var _a, _b;
|
|
18
|
+
// --monorepo takes precedence over --rootProject
|
|
19
|
+
// This won't be needed once we add --bundler=rspack to the @nx/react:app preset
|
|
20
|
+
const rootProject = !options.monorepo && options.rootProject;
|
|
21
|
+
const appDirectory = normalizeDirectory(options);
|
|
22
|
+
const appProjectName = normalizeProjectName(options);
|
|
23
|
+
const e2eProjectName = options.rootProject
|
|
24
|
+
? 'e2e'
|
|
25
|
+
: `${(0, devkit_1.names)(options.name).fileName}-e2e`;
|
|
26
|
+
const { layoutDirectory } = (0, devkit_1.extractLayoutDirectory)(options.directory);
|
|
27
|
+
const appsDir = layoutDirectory !== null && layoutDirectory !== void 0 ? layoutDirectory : (0, devkit_1.getWorkspaceLayout)(host).appsDir;
|
|
28
|
+
const appProjectRoot = rootProject
|
|
29
|
+
? '.'
|
|
30
|
+
: (0, devkit_1.normalizePath)(`${appsDir}/${appDirectory}`);
|
|
31
|
+
const normalized = Object.assign(Object.assign({}, options), { rootProject, name: (0, devkit_1.names)(options.name).fileName, projectName: appProjectName, appProjectRoot,
|
|
32
|
+
e2eProjectName, fileName: 'app' });
|
|
33
|
+
(_a = normalized.unitTestRunner) !== null && _a !== void 0 ? _a : (normalized.unitTestRunner = 'jest');
|
|
34
|
+
(_b = normalized.e2eTestRunner) !== null && _b !== void 0 ? _b : (normalized.e2eTestRunner = 'cypress');
|
|
35
|
+
return normalized;
|
|
36
|
+
}
|
|
37
|
+
exports.normalizeOptions = normalizeOptions;
|
|
38
|
+
//# sourceMappingURL=normalize-options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize-options.js","sourceRoot":"","sources":["../../../../../../../packages/rspack/src/generators/application/lib/normalize-options.ts"],"names":[],"mappings":";;;AAAA,uCAMoB;AAGpB,SAAgB,kBAAkB,CAAC,OAAmC;IACpE,MAAM,EAAE,gBAAgB,EAAE,GAAG,IAAA,+BAAsB,EAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACvE,OAAO,gBAAgB;QACrB,CAAC,CAAC,GAAG,IAAA,cAAK,EAAC,gBAAgB,CAAC,CAAC,QAAQ,IAAI,IAAA,cAAK,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE;QACvE,CAAC,CAAC,IAAA,cAAK,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC;AACnC,CAAC;AALD,gDAKC;AAED,SAAgB,oBAAoB,CAAC,OAAmC;IACtE,OAAO,kBAAkB,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;AACxE,CAAC;AAFD,oDAEC;AAED,SAAgB,gBAAgB,CAC9B,IAAU,EACV,OAAmC;;IAEnC,iDAAiD;IACjD,gFAAgF;IAChF,MAAM,WAAW,GAAG,CAAC,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,WAAW,CAAC;IAC7D,MAAM,YAAY,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACjD,MAAM,cAAc,GAAG,oBAAoB,CAAC,OAAO,CAAC,CAAC;IACrD,MAAM,cAAc,GAAG,OAAO,CAAC,WAAW;QACxC,CAAC,CAAC,KAAK;QACP,CAAC,CAAC,GAAG,IAAA,cAAK,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,MAAM,CAAC;IAE1C,MAAM,EAAE,eAAe,EAAE,GAAG,IAAA,+BAAsB,EAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACtE,MAAM,OAAO,GAAG,eAAe,aAAf,eAAe,cAAf,eAAe,GAAI,IAAA,2BAAkB,EAAC,IAAI,CAAC,CAAC,OAAO,CAAC;IACpE,MAAM,cAAc,GAAG,WAAW;QAChC,CAAC,CAAC,GAAG;QACL,CAAC,CAAC,IAAA,sBAAa,EAAC,GAAG,OAAO,IAAI,YAAY,EAAE,CAAC,CAAC;IAEhD,MAAM,UAAU,GAAG,gCACd,OAAO,KACV,WAAW,EACX,IAAI,EAAE,IAAA,cAAK,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,EAClC,WAAW,EAAE,cAAc,EAC3B,cAAc;QACd,cAAc,EACd,QAAQ,EAAE,KAAK,GACI,CAAC;IAEtB,MAAA,UAAU,CAAC,cAAc,oCAAzB,UAAU,CAAC,cAAc,GAAK,MAAM,EAAC;IACrC,MAAA,UAAU,CAAC,aAAa,oCAAxB,UAAU,CAAC,aAAa,GAAK,SAAS,EAAC;IAEvC,OAAO,UAAU,CAAC;AACpB,CAAC;AAjCD,4CAiCC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface ApplicationGeneratorSchema {
|
|
2
|
+
name: string;
|
|
3
|
+
framework?: Framework;
|
|
4
|
+
style: 'css' | 'scss' | 'less' | 'styl';
|
|
5
|
+
unitTestRunner?: 'none' | 'jest';
|
|
6
|
+
e2eTestRunner?: 'none' | 'cypress';
|
|
7
|
+
directory?: string;
|
|
8
|
+
tags?: string;
|
|
9
|
+
rootProject?: boolean;
|
|
10
|
+
monorepo?: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface NormalizedSchema extends ApplicationGeneratorSchema {
|
|
14
|
+
appProjectRoot: string;
|
|
15
|
+
e2eProjectName: string;
|
|
16
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "Application",
|
|
4
|
+
"title": "Application generator for React + rspack",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"examples": [
|
|
7
|
+
{
|
|
8
|
+
"command": "nx g app myapp --directory=myorg",
|
|
9
|
+
"description": "Generate `apps/myorg/myapp` and `apps/myorg/myapp-e2e`"
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"properties": {
|
|
13
|
+
"name": {
|
|
14
|
+
"description": "The name of the application.",
|
|
15
|
+
"type": "string",
|
|
16
|
+
"$default": {
|
|
17
|
+
"$source": "argv",
|
|
18
|
+
"index": 0
|
|
19
|
+
},
|
|
20
|
+
"x-prompt": "What name would you like to use for the application?",
|
|
21
|
+
"pattern": "^[a-zA-Z].*$",
|
|
22
|
+
"x-priority": "important"
|
|
23
|
+
},
|
|
24
|
+
"framework": {
|
|
25
|
+
"type": "string",
|
|
26
|
+
"description": "The framework to use for the application.",
|
|
27
|
+
"x-prompt": "What framework do you want to use when generating this application?",
|
|
28
|
+
"enum": ["none", "react", "web", "nest"],
|
|
29
|
+
"alias": ["uiFramework"],
|
|
30
|
+
"x-priority": "important",
|
|
31
|
+
"default": "react"
|
|
32
|
+
},
|
|
33
|
+
"style": {
|
|
34
|
+
"description": "The file extension to be used for style files.",
|
|
35
|
+
"type": "string",
|
|
36
|
+
"default": "css",
|
|
37
|
+
"alias": "s",
|
|
38
|
+
"x-prompt": {
|
|
39
|
+
"message": "Which stylesheet format would you like to use?",
|
|
40
|
+
"type": "list",
|
|
41
|
+
"items": [
|
|
42
|
+
{
|
|
43
|
+
"value": "css",
|
|
44
|
+
"label": "CSS"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"value": "scss",
|
|
48
|
+
"label": "SASS(.scss) [ http://sass-lang.com ]"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"value": "styl",
|
|
52
|
+
"label": "Stylus(.styl) [ http://stylus-lang.com ]"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"value": "less",
|
|
56
|
+
"label": "LESS [ http://lesscss.org ]"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"value": "none",
|
|
60
|
+
"label": "None"
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"unitTestRunner": {
|
|
66
|
+
"type": "string",
|
|
67
|
+
"description": "The unit test runner to use.",
|
|
68
|
+
"enum": ["none", "jest"],
|
|
69
|
+
"default": "jest"
|
|
70
|
+
},
|
|
71
|
+
"e2eTestRunner": {
|
|
72
|
+
"type": "string",
|
|
73
|
+
"description": "The e2e test runner to use.",
|
|
74
|
+
"enum": ["none", "cypress"],
|
|
75
|
+
"default": "cypress"
|
|
76
|
+
},
|
|
77
|
+
"directory": {
|
|
78
|
+
"type": "string",
|
|
79
|
+
"description": "The directory to nest the app under."
|
|
80
|
+
},
|
|
81
|
+
"tags": {
|
|
82
|
+
"type": "string",
|
|
83
|
+
"description": "Add tags to the application (used for linting).",
|
|
84
|
+
"alias": "t"
|
|
85
|
+
},
|
|
86
|
+
"monorepo": {
|
|
87
|
+
"type": "boolean",
|
|
88
|
+
"description": "Creates an integrated monorepo.",
|
|
89
|
+
"aliases": ["integrated"]
|
|
90
|
+
},
|
|
91
|
+
"rootProject": {
|
|
92
|
+
"type": "boolean",
|
|
93
|
+
"x-priority": "internal"
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"required": ["name"]
|
|
97
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.configurationGenerator = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
const generator_utils_1 = require("../../utils/generator-utils");
|
|
7
|
+
const create_ts_config_1 = require("../application/lib/create-ts-config");
|
|
8
|
+
const init_1 = require("../init/init");
|
|
9
|
+
function configurationGenerator(tree, options) {
|
|
10
|
+
var _a, _b, _c, _d, _e, _f;
|
|
11
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
12
|
+
const task = yield (0, init_1.default)(tree, options);
|
|
13
|
+
const { targets, root, projectType } = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
14
|
+
const { target, framework } = (0, generator_utils_1.determineFrameworkAndTarget)(tree, options, root, targets);
|
|
15
|
+
options.framework = framework;
|
|
16
|
+
options.target = target;
|
|
17
|
+
let foundStylePreprocessorOptions;
|
|
18
|
+
let buildTargetName = 'build';
|
|
19
|
+
let serveTargetName = 'serve';
|
|
20
|
+
/**
|
|
21
|
+
* This is for when we are converting an existing project
|
|
22
|
+
* to use the vite executors.
|
|
23
|
+
*/
|
|
24
|
+
let projectAlreadyHasRspackTargets = {};
|
|
25
|
+
if (!options.newProject) {
|
|
26
|
+
const userProvidedTargetName = {
|
|
27
|
+
build: options.buildTarget,
|
|
28
|
+
serve: options.serveTarget,
|
|
29
|
+
};
|
|
30
|
+
const { validFoundTargetName, projectContainsUnsupportedExecutor, userProvidedTargetIsUnsupported, alreadyHasNxRspackTargets, } = (0, generator_utils_1.findExistingTargetsInProject)(targets, userProvidedTargetName);
|
|
31
|
+
projectAlreadyHasRspackTargets = alreadyHasNxRspackTargets;
|
|
32
|
+
if (alreadyHasNxRspackTargets.build &&
|
|
33
|
+
(alreadyHasNxRspackTargets.serve ||
|
|
34
|
+
projectType === 'library' ||
|
|
35
|
+
options.framework === 'nest')) {
|
|
36
|
+
throw new Error(`The project ${options.project} is already configured to use the @nx/rspack executors.
|
|
37
|
+
Please try a different project, or remove the existing targets
|
|
38
|
+
and re-run this generator to reset the existing Rspack Configuration.
|
|
39
|
+
`);
|
|
40
|
+
}
|
|
41
|
+
if (!validFoundTargetName.build && projectContainsUnsupportedExecutor) {
|
|
42
|
+
throw new Error(`The project ${options.project} cannot be converted to use the @nx/rspack executors.`);
|
|
43
|
+
}
|
|
44
|
+
if (!projectContainsUnsupportedExecutor &&
|
|
45
|
+
!validFoundTargetName.build &&
|
|
46
|
+
!validFoundTargetName.serve) {
|
|
47
|
+
yield (0, generator_utils_1.handleUnknownExecutors)(options.project);
|
|
48
|
+
}
|
|
49
|
+
yield (0, generator_utils_1.handleUnsupportedUserProvidedTargets)(userProvidedTargetIsUnsupported, userProvidedTargetName, validFoundTargetName, options.framework);
|
|
50
|
+
/**
|
|
51
|
+
* Once the user is at this stage, then they can go ahead and convert.
|
|
52
|
+
*/
|
|
53
|
+
buildTargetName = (_a = validFoundTargetName.build) !== null && _a !== void 0 ? _a : buildTargetName;
|
|
54
|
+
serveTargetName = (_b = validFoundTargetName.serve) !== null && _b !== void 0 ? _b : serveTargetName;
|
|
55
|
+
// Not needed atm
|
|
56
|
+
// if (projectType === 'application' && options.target !== 'node') {
|
|
57
|
+
// moveAndEditIndexHtml(tree, options, buildTargetName);
|
|
58
|
+
// }
|
|
59
|
+
foundStylePreprocessorOptions =
|
|
60
|
+
(_d = (_c = targets === null || targets === void 0 ? void 0 : targets[buildTargetName]) === null || _c === void 0 ? void 0 : _c.options) === null || _d === void 0 ? void 0 : _d.stylePreprocessorOptions;
|
|
61
|
+
(0, generator_utils_1.deleteWebpackConfig)(tree, root, (_f = (_e = targets === null || targets === void 0 ? void 0 : targets[buildTargetName]) === null || _e === void 0 ? void 0 : _e.options) === null || _f === void 0 ? void 0 : _f.webpackConfig);
|
|
62
|
+
(0, create_ts_config_1.editTsConfig)(tree, root, options.framework, (0, devkit_1.joinPathFragments)((0, devkit_1.offsetFromRoot)(root), 'tsconfig.base.json'));
|
|
63
|
+
}
|
|
64
|
+
if (!projectAlreadyHasRspackTargets.build) {
|
|
65
|
+
(0, generator_utils_1.addOrChangeBuildTarget)(tree, options, buildTargetName);
|
|
66
|
+
}
|
|
67
|
+
if ((options.framework !== 'none' || options.devServer) &&
|
|
68
|
+
options.framework !== 'nest' &&
|
|
69
|
+
!projectAlreadyHasRspackTargets.serve) {
|
|
70
|
+
(0, generator_utils_1.addOrChangeServeTarget)(tree, options, serveTargetName);
|
|
71
|
+
}
|
|
72
|
+
(0, generator_utils_1.writeRspackConfigFile)(tree, options, foundStylePreprocessorOptions);
|
|
73
|
+
yield (0, devkit_1.formatFiles)(tree);
|
|
74
|
+
return task;
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
exports.configurationGenerator = configurationGenerator;
|
|
78
|
+
exports.default = configurationGenerator;
|
|
79
|
+
//# sourceMappingURL=configuration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configuration.js","sourceRoot":"","sources":["../../../../../../packages/rspack/src/generators/configuration/configuration.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { InitGeneratorSchema } from '../init/schema';
|
|
2
|
+
|
|
3
|
+
export interface ConfigurationSchema extends InitGeneratorSchema {
|
|
4
|
+
project: string;
|
|
5
|
+
main?: string;
|
|
6
|
+
tsConfig?: string;
|
|
7
|
+
target?: 'node' | 'web';
|
|
8
|
+
skipValidation?: boolean;
|
|
9
|
+
newProject?: boolean;
|
|
10
|
+
buildTarget?: string;
|
|
11
|
+
serveTarget?: string;
|
|
12
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "Rspack",
|
|
4
|
+
"title": "",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"project": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "The name of the project.",
|
|
10
|
+
"$default": {
|
|
11
|
+
"$source": "argv",
|
|
12
|
+
"index": 0
|
|
13
|
+
},
|
|
14
|
+
"x-dropdown": "project",
|
|
15
|
+
"x-prompt": "What is the name of the project to set up a rspack for?",
|
|
16
|
+
"x-priority": "important"
|
|
17
|
+
},
|
|
18
|
+
"framework": {
|
|
19
|
+
"type": "string",
|
|
20
|
+
"description": "The framework used by the project.",
|
|
21
|
+
"x-prompt": "What framework is the project you want to convert using?",
|
|
22
|
+
"enum": ["none", "react", "web", "nest"],
|
|
23
|
+
"alias": ["uiFramework"],
|
|
24
|
+
"x-priority": "important"
|
|
25
|
+
},
|
|
26
|
+
"main": {
|
|
27
|
+
"type": "string",
|
|
28
|
+
"description": "Path relative to the workspace root for the main entry file. Defaults to '<projectRoot>/src/main.ts'.",
|
|
29
|
+
"x-priority": "important"
|
|
30
|
+
},
|
|
31
|
+
"tsConfig": {
|
|
32
|
+
"type": "string",
|
|
33
|
+
"description": "Path relative to the workspace root for the tsconfig file to build with. Defaults to '<projectRoot>/tsconfig.app.json'.",
|
|
34
|
+
"x-priority": "important"
|
|
35
|
+
},
|
|
36
|
+
"target": {
|
|
37
|
+
"type": "string",
|
|
38
|
+
"description": "Target platform for the build, same as the rspack config option.",
|
|
39
|
+
"enum": ["node", "web"],
|
|
40
|
+
"default": "web"
|
|
41
|
+
},
|
|
42
|
+
"devServer": {
|
|
43
|
+
"type": "boolean",
|
|
44
|
+
"description": "Add a serve target to run a local rspack dev-server",
|
|
45
|
+
"default": false
|
|
46
|
+
},
|
|
47
|
+
"style": {
|
|
48
|
+
"type": "string",
|
|
49
|
+
"description": "The style solution to use.",
|
|
50
|
+
"enum": ["none", "css", "scss", "less"]
|
|
51
|
+
},
|
|
52
|
+
"newProject": {
|
|
53
|
+
"type": "boolean",
|
|
54
|
+
"description": "Is this a new project?",
|
|
55
|
+
"default": false,
|
|
56
|
+
"hidden": true
|
|
57
|
+
},
|
|
58
|
+
"buildTarget": {
|
|
59
|
+
"type": "string",
|
|
60
|
+
"description": "The build target of the project to be transformed to use the @nrwl/vite:build executor."
|
|
61
|
+
},
|
|
62
|
+
"serveTarget": {
|
|
63
|
+
"type": "string",
|
|
64
|
+
"description": "The serve target of the project to be transformed to use the @nrwl/vite:dev-server and @nrwl/vite:preview-server executors."
|
|
65
|
+
},
|
|
66
|
+
"rootProject": {
|
|
67
|
+
"type": "boolean",
|
|
68
|
+
"x-priority": "internal"
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"required": ["project"]
|
|
72
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { GeneratorCallback, Tree } from '@nx/devkit';
|
|
2
|
+
import { InitGeneratorSchema } from './schema';
|
|
3
|
+
export declare function rspackInitGenerator(tree: Tree, schema: InitGeneratorSchema): Promise<GeneratorCallback>;
|
|
4
|
+
export default rspackInitGenerator;
|
|
5
|
+
export declare const rspackInitSchematic: (generatorOptions: InitGeneratorSchema) => (tree: any, context: any) => Promise<any>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.rspackInitSchematic = exports.rspackInitGenerator = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
const js_1 = require("@nx/js");
|
|
7
|
+
const versions_1 = require("../../utils/versions");
|
|
8
|
+
function rspackInitGenerator(tree, schema) {
|
|
9
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
10
|
+
const tasks = [];
|
|
11
|
+
const jsInitTask = yield (0, js_1.initGenerator)(tree, Object.assign(Object.assign({}, schema), { tsConfigName: schema.rootProject ? 'tsconfig.json' : 'tsconfig.base.json', skipFormat: true }));
|
|
12
|
+
tasks.push(jsInitTask);
|
|
13
|
+
const devDependencies = {
|
|
14
|
+
'@rspack/core': versions_1.rspackCoreVersion,
|
|
15
|
+
'@rspack/plugin-minify': versions_1.rspackPluginMinifyVersion,
|
|
16
|
+
};
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
18
|
+
const version = require('../../../package.json').version;
|
|
19
|
+
if (version !== '0.0.1') {
|
|
20
|
+
// Ignored for local dev / e2e tests.
|
|
21
|
+
devDependencies['@nx/rspack'] = version;
|
|
22
|
+
}
|
|
23
|
+
if (schema.style === 'less') {
|
|
24
|
+
devDependencies['@rspack/less-loader'] = versions_1.rspackLessLoaderVersion;
|
|
25
|
+
}
|
|
26
|
+
if (schema.framework !== 'none' || schema.devServer) {
|
|
27
|
+
devDependencies['@rspack/dev-server'] = versions_1.rspackDevServerVersion;
|
|
28
|
+
}
|
|
29
|
+
const installTask = (0, devkit_1.addDependenciesToPackageJson)(tree, {}, devDependencies);
|
|
30
|
+
tasks.push(installTask);
|
|
31
|
+
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
exports.rspackInitGenerator = rspackInitGenerator;
|
|
35
|
+
exports.default = rspackInitGenerator;
|
|
36
|
+
exports.rspackInitSchematic = (0, devkit_1.convertNxGenerator)(rspackInitGenerator);
|
|
37
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../../../../packages/rspack/src/generators/init/init.ts"],"names":[],"mappings":";;;;AAAA,uCAMoB;AACpB,+BAAuC;AACvC,mDAK8B;AAG9B,SAAsB,mBAAmB,CACvC,IAAU,EACV,MAA2B;;QAE3B,MAAM,KAAK,GAAwB,EAAE,CAAC;QACtC,MAAM,UAAU,GAAG,MAAM,IAAA,kBAAa,EAAC,IAAI,kCACtC,MAAM,KACT,YAAY,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,oBAAoB,EACzE,UAAU,EAAE,IAAI,IAChB,CAAC;QAEH,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAEvB,MAAM,eAAe,GAAG;YACtB,cAAc,EAAE,4BAAiB;YACjC,uBAAuB,EAAE,oCAAyB;SACnD,CAAC;QAEF,8DAA8D;QAC9D,MAAM,OAAO,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC,OAAO,CAAC;QACzD,IAAI,OAAO,KAAK,OAAO,EAAE;YACvB,qCAAqC;YACrC,eAAe,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC;SACzC;QAED,IAAI,MAAM,CAAC,KAAK,KAAK,MAAM,EAAE;YAC3B,eAAe,CAAC,qBAAqB,CAAC,GAAG,kCAAuB,CAAC;SAClE;QAED,IAAI,MAAM,CAAC,SAAS,KAAK,MAAM,IAAI,MAAM,CAAC,SAAS,EAAE;YACnD,eAAe,CAAC,oBAAoB,CAAC,GAAG,iCAAsB,CAAC;SAChE;QAED,MAAM,WAAW,GAAG,IAAA,qCAA4B,EAAC,IAAI,EAAE,EAAE,EAAE,eAAe,CAAC,CAAC;QAC5E,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAExB,OAAO,IAAA,yBAAgB,EAAC,GAAG,KAAK,CAAC,CAAC;IACpC,CAAC;CAAA;AArCD,kDAqCC;AAED,kBAAe,mBAAmB,CAAC;AAEtB,QAAA,mBAAmB,GAAG,IAAA,2BAAkB,EAAC,mBAAmB,CAAC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "Init",
|
|
4
|
+
"title": "",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"framework": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "The UI framework used by the project.",
|
|
10
|
+
"enum": ["none", "react", "web", "nest"],
|
|
11
|
+
"alias": ["uiFramework"]
|
|
12
|
+
},
|
|
13
|
+
"style": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"description": "The style solution to use.",
|
|
16
|
+
"enum": ["none", "css", "scss", "less", "styl"]
|
|
17
|
+
},
|
|
18
|
+
"rootProject": {
|
|
19
|
+
"type": "boolean",
|
|
20
|
+
"x-priority": "internal"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"required": []
|
|
24
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
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 application_1 = require("../application/application");
|
|
6
|
+
function default_1(tree, options) {
|
|
7
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
8
|
+
const appTask = (0, application_1.default)(tree, Object.assign(Object.assign({}, options), {
|
|
9
|
+
// Since `--style` is not passed down to custom preset, we're using individual flags for now.
|
|
10
|
+
style: options.sass
|
|
11
|
+
? 'scss'
|
|
12
|
+
: options.less
|
|
13
|
+
? 'less'
|
|
14
|
+
: options.stylus
|
|
15
|
+
? 'styl'
|
|
16
|
+
: 'css' }));
|
|
17
|
+
(0, devkit_1.updateJson)(tree, 'package.json', (json) => {
|
|
18
|
+
var _a, _b, _c, _d, _e, _f;
|
|
19
|
+
var _g, _h, _j, _k, _l;
|
|
20
|
+
(_a = json.scripts) !== null && _a !== void 0 ? _a : (json.scripts = {});
|
|
21
|
+
(_b = (_g = json.scripts).build) !== null && _b !== void 0 ? _b : (_g.build = 'npx nx build');
|
|
22
|
+
(_c = (_h = json.scripts).start) !== null && _c !== void 0 ? _c : (_h.start = 'npx nx serve');
|
|
23
|
+
(_d = (_j = json.scripts).lint) !== null && _d !== void 0 ? _d : (_j.lint = 'npx nx lint');
|
|
24
|
+
(_e = (_k = json.scripts).test) !== null && _e !== void 0 ? _e : (_k.test = 'npx nx test');
|
|
25
|
+
(_f = (_l = json.scripts).e2e) !== null && _f !== void 0 ? _f : (_l.e2e = 'npx nx e2e e2e');
|
|
26
|
+
return json;
|
|
27
|
+
});
|
|
28
|
+
if (options.rootProject) {
|
|
29
|
+
// Remove these folders so projects will be generated at the root.
|
|
30
|
+
tree.delete('apps');
|
|
31
|
+
tree.delete('libs');
|
|
32
|
+
}
|
|
33
|
+
return appTask;
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
exports.default = default_1;
|
|
37
|
+
//# sourceMappingURL=preset.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preset.js","sourceRoot":"","sources":["../../../../../../packages/rspack/src/generators/preset/preset.ts"],"names":[],"mappings":";;;AAAA,uCAA8C;AAE9C,4DAA8D;AAG9D,mBAA+B,IAAU,EAAE,OAA8B;;QACvE,MAAM,OAAO,GAAG,IAAA,qBAAoB,EAAC,IAAI,kCACpC,OAAO;YACV,6FAA6F;YAC7F,KAAK,EAAE,OAAO,CAAC,IAAI;gBACjB,CAAC,CAAC,MAAM;gBACR,CAAC,CAAC,OAAO,CAAC,IAAI;oBACd,CAAC,CAAC,MAAM;oBACR,CAAC,CAAC,OAAO,CAAC,MAAM;wBAChB,CAAC,CAAC,MAAM;wBACR,CAAC,CAAC,KAAK,IACT,CAAC;QAEH,IAAA,mBAAU,EAAC,IAAI,EAAE,cAAc,EAAE,CAAC,IAAI,EAAE,EAAE;;;YACxC,MAAA,IAAI,CAAC,OAAO,oCAAZ,IAAI,CAAC,OAAO,GAAK,EAAE,EAAC;YACpB,YAAA,IAAI,CAAC,OAAO,EAAC,KAAK,uCAAL,KAAK,GAAK,cAAc,EAAC;YACtC,YAAA,IAAI,CAAC,OAAO,EAAC,KAAK,uCAAL,KAAK,GAAK,cAAc,EAAC;YACtC,YAAA,IAAI,CAAC,OAAO,EAAC,IAAI,uCAAJ,IAAI,GAAK,aAAa,EAAC;YACpC,YAAA,IAAI,CAAC,OAAO,EAAC,IAAI,uCAAJ,IAAI,GAAK,aAAa,EAAC;YACpC,YAAA,IAAI,CAAC,OAAO,EAAC,GAAG,uCAAH,GAAG,GAAK,gBAAgB,EAAC;YACtC,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;QAEH,IAAI,OAAO,CAAC,WAAW,EAAE;YACvB,kEAAkE;YAClE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YACpB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;SACrB;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CAAA;AA9BD,4BA8BC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface PresetGeneratorSchema {
|
|
2
|
+
name: string;
|
|
3
|
+
framework?: Framework;
|
|
4
|
+
less?: boolean;
|
|
5
|
+
sass?: boolean;
|
|
6
|
+
stylus?: boolean;
|
|
7
|
+
unitTestRunner?: 'none' | 'jest';
|
|
8
|
+
e2eTestRunner?: 'none' | 'cypress';
|
|
9
|
+
directory?: string;
|
|
10
|
+
tags?: string;
|
|
11
|
+
rootProject?: boolean;
|
|
12
|
+
monorepo?: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface NormalizedSchema extends PresetGeneratorSchema {
|
|
16
|
+
appProjectRoot: string;
|
|
17
|
+
e2eProjectName: string;
|
|
18
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "Preset",
|
|
4
|
+
"title": "Standalone React and rspack preset",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"name": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "",
|
|
10
|
+
"$default": {
|
|
11
|
+
"$source": "argv",
|
|
12
|
+
"index": 0
|
|
13
|
+
},
|
|
14
|
+
"x-priority": "important"
|
|
15
|
+
},
|
|
16
|
+
"framework": {
|
|
17
|
+
"type": "string",
|
|
18
|
+
"description": "The framework to use for the application.",
|
|
19
|
+
"enum": ["none", "react", "web", "nest"],
|
|
20
|
+
"alias": ["uiFramework"],
|
|
21
|
+
"x-priority": "important",
|
|
22
|
+
"default": "react"
|
|
23
|
+
},
|
|
24
|
+
"less": {
|
|
25
|
+
"type": "boolean",
|
|
26
|
+
"description": "Use less for styling."
|
|
27
|
+
},
|
|
28
|
+
"sass": {
|
|
29
|
+
"type": "boolean",
|
|
30
|
+
"description": "Use sass for styling."
|
|
31
|
+
},
|
|
32
|
+
"stylus": {
|
|
33
|
+
"type": "boolean",
|
|
34
|
+
"description": "Use stylus for styling."
|
|
35
|
+
},
|
|
36
|
+
"unitTestRunner": {
|
|
37
|
+
"type": "string",
|
|
38
|
+
"description": "The unit test runner to use.",
|
|
39
|
+
"enum": ["none", "jest"],
|
|
40
|
+
"default": "jest"
|
|
41
|
+
},
|
|
42
|
+
"e2eTestRunner": {
|
|
43
|
+
"type": "string",
|
|
44
|
+
"description": "The e2e test runner to use.",
|
|
45
|
+
"enum": ["none", "cypress"],
|
|
46
|
+
"default": "cypress"
|
|
47
|
+
},
|
|
48
|
+
"directory": {
|
|
49
|
+
"type": "string",
|
|
50
|
+
"description": "The directory to nest the app under."
|
|
51
|
+
},
|
|
52
|
+
"tags": {
|
|
53
|
+
"type": "string",
|
|
54
|
+
"description": "Add tags to the project (used for linting).",
|
|
55
|
+
"alias": "t"
|
|
56
|
+
},
|
|
57
|
+
"monorepo": {
|
|
58
|
+
"type": "boolean",
|
|
59
|
+
"description": "Creates an integrated monorepo.",
|
|
60
|
+
"default": false,
|
|
61
|
+
"aliases": ["integrated"]
|
|
62
|
+
},
|
|
63
|
+
"rootProject": {
|
|
64
|
+
"type": "boolean",
|
|
65
|
+
"x-priority": "internal",
|
|
66
|
+
"default": true
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"required": ["name"]
|
|
70
|
+
}
|
package/src/index.d.ts
ADDED
package/src/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./generators/configuration/configuration"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./generators/init/init"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./utils/config"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./utils/with-nx"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./utils/with-react"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./utils/with-web"), exports);
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/rspack/src/index.ts"],"names":[],"mappings":";;;AAAA,mFAAyD;AACzD,iEAAuC;AACvC,yDAA+B;AAC/B,0DAAgC;AAChC,6DAAmC;AACnC,2DAAiC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.composePlugins = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
function composePlugins(...plugins) {
|
|
6
|
+
return function combined(config, ctx) {
|
|
7
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
8
|
+
for (const plugin of plugins) {
|
|
9
|
+
const fn = yield plugin;
|
|
10
|
+
config = yield fn(config, ctx);
|
|
11
|
+
}
|
|
12
|
+
return config;
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
exports.composePlugins = composePlugins;
|
|
17
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../../packages/rspack/src/utils/config.ts"],"names":[],"mappings":";;;;AAGA,SAAgB,cAAc,CAAC,GAAG,OAAc;IAC9C,OAAO,SAAe,QAAQ,CAC5B,MAAqB,EACrB,GAAwB;;YAExB,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;gBAC5B,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC;gBACxB,MAAM,GAAG,MAAM,EAAE,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;aAChC;YACD,OAAO,MAAM,CAAC;QAChB,CAAC;KAAA,CAAC;AACJ,CAAC;AAXD,wCAWC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ExecutorContext } from '@nx/devkit';
|
|
2
|
+
import { Compiler } from '@rspack/core';
|
|
3
|
+
import { RspackExecutorSchema } from '../executors/rspack/schema';
|
|
4
|
+
export declare function createCompiler(options: RspackExecutorSchema, context: ExecutorContext): Promise<Compiler>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createCompiler = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const core_1 = require("@rspack/core");
|
|
6
|
+
const path = require("path");
|
|
7
|
+
function createCompiler(options, context) {
|
|
8
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
9
|
+
var _a;
|
|
10
|
+
let userDefinedConfig = yield (_a = path.join(context.root, options.rspackConfig), Promise.resolve().then(() => require(_a))).then((x) => x.default || x);
|
|
11
|
+
if (typeof userDefinedConfig.then === 'function') {
|
|
12
|
+
userDefinedConfig = yield userDefinedConfig;
|
|
13
|
+
}
|
|
14
|
+
const config = yield userDefinedConfig({}, { options, context });
|
|
15
|
+
return (0, core_1.createCompiler)(config);
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
exports.createCompiler = createCompiler;
|
|
19
|
+
//# sourceMappingURL=create-compiler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-compiler.js","sourceRoot":"","sources":["../../../../../packages/rspack/src/utils/create-compiler.ts"],"names":[],"mappings":";;;;AACA,uCAA2E;AAC3E,6BAA6B;AAG7B,SAAsB,cAAc,CAClC,OAA6B,EAC7B,OAAwB;;;QAExB,IAAI,iBAAiB,GAAG,MAAM,MAC5B,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,YAAY,CAAC,6CAC7C,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC;QAE9B,IAAI,OAAO,iBAAiB,CAAC,IAAI,KAAK,UAAU,EAAE;YAChD,iBAAiB,GAAG,MAAM,iBAAiB,CAAC;SAC7C;QAED,MAAM,MAAM,GAAG,MAAM,iBAAiB,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;QAEjE,OAAO,IAAA,qBAAe,EAAC,MAAM,CAAC,CAAC;IACjC,CAAC;CAAA;AAfD,wCAeC"}
|