@nx/react 0.0.0-pr-26891-2baa5df → 0.0.0-pr-26898-984dfaf
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 +1 -1
- package/mf/dynamic-federation.js +4 -3
- package/package.json +6 -6
- package/plugins/component-testing/index.js +2 -1
- package/plugins/component-testing/webpack-fallback.js +2 -1
- package/plugins/nx-react-webpack-plugin/lib/apply-react-config.js +2 -1
- package/plugins/with-react.js +2 -1
- package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js +3 -2
- package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js +1 -1
- package/src/generators/application/application.js +3 -2
- package/src/generators/application/files/nx-welcome/src/app/nx-welcome.tsx +1 -1
- package/src/generators/application/lib/add-e2e.js +2 -1
- package/src/generators/application/lib/add-jest.js +2 -1
- package/src/generators/application/lib/add-project.js +2 -1
- package/src/generators/application/lib/add-routing.js +2 -1
- package/src/generators/application/lib/create-application-files.js +2 -1
- package/src/generators/application/lib/find-free-port.js +2 -1
- package/src/generators/application/lib/get-app-tests.js +2 -1
- package/src/generators/application/lib/install-common-dependencies.js +2 -1
- package/src/generators/application/lib/normalize-options.js +4 -3
- package/src/generators/application/lib/set-defaults.js +2 -1
- package/src/generators/application/lib/show-possible-warnings.js +2 -1
- package/src/generators/application/lib/update-jest-config.js +2 -1
- package/src/generators/component/component.js +3 -2
- package/src/generators/component/lib/get-component-tests.js +2 -1
- package/src/generators/component/lib/normalize-options.js +2 -1
- package/src/generators/component-cypress-spec/component-cypress-spec.js +4 -3
- package/src/generators/component-story/component-story.js +4 -3
- package/src/generators/component-test/component-test.js +2 -1
- package/src/generators/cypress-component-configuration/cypress-component-configuration.js +3 -2
- package/src/generators/cypress-component-configuration/lib/add-files.js +2 -1
- package/src/generators/federate-module/federate-module.js +2 -1
- package/src/generators/federate-module/lib/utils.js +9 -8
- package/src/generators/hook/hook.js +3 -2
- package/src/generators/host/host.js +3 -2
- package/src/generators/host/lib/add-module-federation-files.js +2 -1
- package/src/generators/host/lib/normalize-remote.js +3 -2
- package/src/generators/host/lib/setup-ssr-for-host.js +2 -1
- package/src/generators/host/lib/update-module-federation-e2e-project.js +2 -1
- package/src/generators/init/init.js +2 -1
- package/src/generators/library/lib/add-linting.js +2 -1
- package/src/generators/library/lib/add-rollup-build-target.js +2 -1
- package/src/generators/library/lib/create-files.js +2 -1
- package/src/generators/library/lib/install-common-dependencies.js +2 -1
- package/src/generators/library/lib/normalize-options.js +2 -1
- package/src/generators/library/lib/set-defaults.js +2 -1
- package/src/generators/library/lib/update-app-routes.js +2 -1
- package/src/generators/library/library.js +3 -2
- package/src/generators/redux/redux.js +3 -2
- package/src/generators/remote/lib/add-remote-to-dynamic-host.js +2 -1
- package/src/generators/remote/lib/setup-ssr-for-remote.js +2 -1
- package/src/generators/remote/lib/setup-tspath-for-remote.js +2 -1
- package/src/generators/remote/lib/update-host-with-remote.js +2 -1
- package/src/generators/remote/remote.js +4 -3
- package/src/generators/setup-ssr/setup-ssr.js +2 -1
- package/src/generators/setup-tailwind/lib/add-tailwind-style-imports.js +2 -1
- package/src/generators/setup-tailwind/lib/update-project.js +2 -1
- package/src/generators/setup-tailwind/setup-tailwind.js +2 -1
- package/src/generators/stories/stories.js +5 -4
- package/src/generators/storybook-configuration/configuration.js +4 -3
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +1 -1
- package/src/migrations/update-16-2-0-remove-package/update-16-2-0-remove-package.js +1 -1
- package/src/migrations/update-16-3-0/remove-types-react-router-dom-package.js +1 -1
- package/src/migrations/update-16-7-0/add-babel-core.js +1 -1
- package/src/migrations/update-16-7-0-add-typings/update-16-7-0-add-typings.js +1 -1
- package/src/migrations/update-18-0-0/add-mf-env-var-to-target-defaults.js +1 -1
- package/src/migrations/update-18-1-1/fix-target-defaults-inputs.js +1 -1
- package/src/module-federation/ast-utils.js +4 -3
- package/src/module-federation/load-config.js +2 -1
- package/src/module-federation/package-json.js +2 -1
- package/src/module-federation/utils.js +3 -2
- package/src/module-federation/with-module-federation-ssr.js +2 -1
- package/src/module-federation/with-module-federation.js +2 -1
- package/src/rules/add-styled-dependencies.js +2 -1
- package/src/rules/update-module-federation-project.js +2 -1
- package/src/utils/add-mf-env-to-inputs.js +2 -1
- package/src/utils/assertion.js +2 -1
- package/src/utils/ast-utils.js +20 -19
- package/src/utils/component-props.js +4 -3
- package/src/utils/create-ts-config.js +3 -2
- package/src/utils/ct-utils.js +5 -4
- package/src/utils/format-file.js +2 -1
- package/src/utils/get-in-source-vitest-tests-template.js +2 -1
- package/src/utils/has-vite-plugin.js +2 -1
- package/src/utils/has-webpack-plugin.js +2 -1
- package/src/utils/jest-utils.js +2 -1
- package/src/utils/lint.d.ts +12 -12
- package/src/utils/maybe-js.js +2 -1
- package/src/utils/testing-generators.js +3 -2
- package/tailwind.js +2 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getFunctionDeterminateRemoteUrl =
|
|
4
|
-
exports.getModuleFederationConfig = getModuleFederationConfig;
|
|
3
|
+
exports.getModuleFederationConfig = exports.getFunctionDeterminateRemoteUrl = void 0;
|
|
5
4
|
const module_federation_1 = require("@nx/webpack/src/utils/module-federation");
|
|
6
5
|
const devkit_1 = require("@nx/devkit");
|
|
7
6
|
const project_graph_1 = require("nx/src/project-graph/project-graph");
|
|
@@ -34,6 +33,7 @@ function getFunctionDeterminateRemoteUrl(isServer = false) {
|
|
|
34
33
|
return `${host.endsWith('/') ? host.slice(0, -1) : host}:${port}/${remoteEntry}`;
|
|
35
34
|
};
|
|
36
35
|
}
|
|
36
|
+
exports.getFunctionDeterminateRemoteUrl = getFunctionDeterminateRemoteUrl;
|
|
37
37
|
async function getModuleFederationConfig(mfConfig, options = { isServer: false }) {
|
|
38
38
|
let projectGraph;
|
|
39
39
|
try {
|
|
@@ -73,3 +73,4 @@ async function getModuleFederationConfig(mfConfig, options = { isServer: false }
|
|
|
73
73
|
}
|
|
74
74
|
return { sharedLibraries, sharedDependencies, mappedRemotes };
|
|
75
75
|
}
|
|
76
|
+
exports.getModuleFederationConfig = getModuleFederationConfig;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.withModuleFederationForSSR =
|
|
3
|
+
exports.withModuleFederationForSSR = void 0;
|
|
4
4
|
const utils_1 = require("./utils");
|
|
5
5
|
async function withModuleFederationForSSR(options, configOverride) {
|
|
6
6
|
if (global.NX_GRAPH_CREATION) {
|
|
@@ -35,3 +35,4 @@ async function withModuleFederationForSSR(options, configOverride) {
|
|
|
35
35
|
return config;
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
|
+
exports.withModuleFederationForSSR = withModuleFederationForSSR;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.withModuleFederation =
|
|
3
|
+
exports.withModuleFederation = void 0;
|
|
4
4
|
const utils_1 = require("./utils");
|
|
5
5
|
const webpack_1 = require("@module-federation/enhanced/webpack");
|
|
6
6
|
const isVarOrWindow = (libType) => libType === 'var' || libType === 'window';
|
|
@@ -56,3 +56,4 @@ async function withModuleFederation(options, configOverride) {
|
|
|
56
56
|
return config;
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
|
+
exports.withModuleFederation = withModuleFederation;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addStyledModuleDependencies =
|
|
3
|
+
exports.addStyledModuleDependencies = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const styled_1 = require("../utils/styled");
|
|
6
6
|
function addStyledModuleDependencies(host, options) {
|
|
@@ -14,3 +14,4 @@ function addStyledModuleDependencies(host, options) {
|
|
|
14
14
|
return () => { };
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
+
exports.addStyledModuleDependencies = addStyledModuleDependencies;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateModuleFederationProject =
|
|
3
|
+
exports.updateModuleFederationProject = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const versions_1 = require("../utils/versions");
|
|
6
6
|
const maybe_js_1 = require("../utils/maybe-js");
|
|
@@ -47,3 +47,4 @@ function updateModuleFederationProject(host, options) {
|
|
|
47
47
|
(0, devkit_1.updateProjectConfiguration)(host, options.projectName, projectConfig);
|
|
48
48
|
return (0, devkit_1.addDependenciesToPackageJson)(host, {}, { '@nx/web': versions_1.nxVersion });
|
|
49
49
|
}
|
|
50
|
+
exports.updateModuleFederationProject = updateModuleFederationProject;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addMfEnvToTargetDefaultInputs =
|
|
3
|
+
exports.addMfEnvToTargetDefaultInputs = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
function addMfEnvToTargetDefaultInputs(tree) {
|
|
6
6
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
@@ -24,3 +24,4 @@ function addMfEnvToTargetDefaultInputs(tree) {
|
|
|
24
24
|
(0, devkit_1.updateNxJson)(tree, nxJson);
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
+
exports.addMfEnvToTargetDefaultInputs = addMfEnvToTargetDefaultInputs;
|
package/src/utils/assertion.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.assertValidStyle =
|
|
3
|
+
exports.assertValidStyle = void 0;
|
|
4
4
|
const VALID_STYLES = [
|
|
5
5
|
'css',
|
|
6
6
|
'scss',
|
|
@@ -16,3 +16,4 @@ function assertValidStyle(style) {
|
|
|
16
16
|
throw new Error(`Unsupported style option found: ${style}. Valid values are: "${VALID_STYLES.join('", "')}"`);
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
+
exports.assertValidStyle = assertValidStyle;
|
package/src/utils/ast-utils.js
CHANGED
|
@@ -1,24 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addImport =
|
|
4
|
-
exports.findMainRenderStatement = findMainRenderStatement;
|
|
5
|
-
exports.findDefaultExport = findDefaultExport;
|
|
6
|
-
exports.findDefaultExportDeclaration = findDefaultExportDeclaration;
|
|
7
|
-
exports.findExportDeclarationsForJsx = findExportDeclarationsForJsx;
|
|
8
|
-
exports.findDefaultExportIdentifier = findDefaultExportIdentifier;
|
|
9
|
-
exports.findDefaultClassOrFunction = findDefaultClassOrFunction;
|
|
10
|
-
exports.findComponentImportPath = findComponentImportPath;
|
|
11
|
-
exports.findElements = findElements;
|
|
12
|
-
exports.findClosestOpening = findClosestOpening;
|
|
13
|
-
exports.isTag = isTag;
|
|
14
|
-
exports.addInitialRoutes = addInitialRoutes;
|
|
15
|
-
exports.addRoute = addRoute;
|
|
16
|
-
exports.addBrowserRouter = addBrowserRouter;
|
|
17
|
-
exports.addStaticRouter = addStaticRouter;
|
|
18
|
-
exports.addReduxStoreToMain = addReduxStoreToMain;
|
|
19
|
-
exports.updateReduxStore = updateReduxStore;
|
|
20
|
-
exports.getComponentNode = getComponentNode;
|
|
21
|
-
exports.getComponentPropsInterface = getComponentPropsInterface;
|
|
3
|
+
exports.getComponentPropsInterface = exports.getComponentNode = exports.updateReduxStore = exports.addReduxStoreToMain = exports.addStaticRouter = exports.addBrowserRouter = exports.addRoute = exports.addInitialRoutes = exports.isTag = exports.findClosestOpening = exports.findElements = exports.findComponentImportPath = exports.findDefaultClassOrFunction = exports.findDefaultExportIdentifier = exports.findExportDeclarationsForJsx = exports.findDefaultExportDeclaration = exports.findDefaultExport = exports.findMainRenderStatement = exports.addImport = void 0;
|
|
22
4
|
const js_1 = require("@nx/js");
|
|
23
5
|
const devkit_1 = require("@nx/devkit");
|
|
24
6
|
const ensure_typescript_1 = require("@nx/js/src/utils/typescript/ensure-typescript");
|
|
@@ -48,6 +30,7 @@ function addImport(source, statement) {
|
|
|
48
30
|
];
|
|
49
31
|
}
|
|
50
32
|
}
|
|
33
|
+
exports.addImport = addImport;
|
|
51
34
|
function findMainRenderStatement(source) {
|
|
52
35
|
if (!tsModule) {
|
|
53
36
|
tsModule = (0, ensure_typescript_1.ensureTypescript)();
|
|
@@ -83,9 +66,11 @@ function findMainRenderStatement(source) {
|
|
|
83
66
|
}
|
|
84
67
|
return null;
|
|
85
68
|
}
|
|
69
|
+
exports.findMainRenderStatement = findMainRenderStatement;
|
|
86
70
|
function findDefaultExport(source) {
|
|
87
71
|
return (findDefaultExportDeclaration(source) || findDefaultClassOrFunction(source));
|
|
88
72
|
}
|
|
73
|
+
exports.findDefaultExport = findDefaultExport;
|
|
89
74
|
function findDefaultExportDeclaration(source) {
|
|
90
75
|
if (!tsModule) {
|
|
91
76
|
tsModule = (0, ensure_typescript_1.ensureTypescript)();
|
|
@@ -105,6 +90,7 @@ function findDefaultExportDeclaration(source) {
|
|
|
105
90
|
return null;
|
|
106
91
|
}
|
|
107
92
|
}
|
|
93
|
+
exports.findDefaultExportDeclaration = findDefaultExportDeclaration;
|
|
108
94
|
function findExportDeclarationsForJsx(source) {
|
|
109
95
|
if (!tsModule) {
|
|
110
96
|
tsModule = (0, ensure_typescript_1.ensureTypescript)();
|
|
@@ -155,6 +141,7 @@ function findExportDeclarationsForJsx(source) {
|
|
|
155
141
|
});
|
|
156
142
|
return exportedDeclarations || null;
|
|
157
143
|
}
|
|
144
|
+
exports.findExportDeclarationsForJsx = findExportDeclarationsForJsx;
|
|
158
145
|
function findDefaultExportIdentifier(source) {
|
|
159
146
|
if (!tsModule) {
|
|
160
147
|
tsModule = (0, ensure_typescript_1.ensureTypescript)();
|
|
@@ -165,6 +152,7 @@ function findDefaultExportIdentifier(source) {
|
|
|
165
152
|
.find((x) => x.kind === tsModule.SyntaxKind.Identifier);
|
|
166
153
|
return identifier || null;
|
|
167
154
|
}
|
|
155
|
+
exports.findDefaultExportIdentifier = findDefaultExportIdentifier;
|
|
168
156
|
function findDefaultClassOrFunction(source) {
|
|
169
157
|
if (!tsModule) {
|
|
170
158
|
tsModule = (0, ensure_typescript_1.ensureTypescript)();
|
|
@@ -175,6 +163,7 @@ function findDefaultClassOrFunction(source) {
|
|
|
175
163
|
cls.find(hasDefaultExportModifier) ||
|
|
176
164
|
null);
|
|
177
165
|
}
|
|
166
|
+
exports.findDefaultClassOrFunction = findDefaultClassOrFunction;
|
|
178
167
|
function hasDefaultExportModifier(x) {
|
|
179
168
|
if (!tsModule) {
|
|
180
169
|
tsModule = (0, ensure_typescript_1.ensureTypescript)();
|
|
@@ -199,6 +188,7 @@ function findComponentImportPath(componentName, source) {
|
|
|
199
188
|
const appImport = matching[0];
|
|
200
189
|
return appImport.moduleSpecifier.getText().replace(/['"]/g, '');
|
|
201
190
|
}
|
|
191
|
+
exports.findComponentImportPath = findComponentImportPath;
|
|
202
192
|
function findElements(source, tagName) {
|
|
203
193
|
if (!tsModule) {
|
|
204
194
|
tsModule = (0, ensure_typescript_1.ensureTypescript)();
|
|
@@ -209,6 +199,7 @@ function findElements(source, tagName) {
|
|
|
209
199
|
]);
|
|
210
200
|
return nodes.filter((node) => isTag(tagName, node));
|
|
211
201
|
}
|
|
202
|
+
exports.findElements = findElements;
|
|
212
203
|
function findClosestOpening(tagName, node) {
|
|
213
204
|
if (!node) {
|
|
214
205
|
return null;
|
|
@@ -220,6 +211,7 @@ function findClosestOpening(tagName, node) {
|
|
|
220
211
|
return findClosestOpening(tagName, node.parent);
|
|
221
212
|
}
|
|
222
213
|
}
|
|
214
|
+
exports.findClosestOpening = findClosestOpening;
|
|
223
215
|
function isTag(tagName, node) {
|
|
224
216
|
if (!tsModule) {
|
|
225
217
|
tsModule = (0, ensure_typescript_1.ensureTypescript)();
|
|
@@ -234,6 +226,7 @@ function isTag(tagName, node) {
|
|
|
234
226
|
}
|
|
235
227
|
return false;
|
|
236
228
|
}
|
|
229
|
+
exports.isTag = isTag;
|
|
237
230
|
function addInitialRoutes(sourcePath, source) {
|
|
238
231
|
if (!tsModule) {
|
|
239
232
|
tsModule = (0, ensure_typescript_1.ensureTypescript)();
|
|
@@ -285,6 +278,7 @@ function addInitialRoutes(sourcePath, source) {
|
|
|
285
278
|
insertRoutes,
|
|
286
279
|
];
|
|
287
280
|
}
|
|
281
|
+
exports.addInitialRoutes = addInitialRoutes;
|
|
288
282
|
function addRoute(sourcePath, source, options) {
|
|
289
283
|
const routes = findElements(source, 'Route');
|
|
290
284
|
const links = findElements(source, 'Link');
|
|
@@ -322,6 +316,7 @@ function addRoute(sourcePath, source, options) {
|
|
|
322
316
|
return changes;
|
|
323
317
|
}
|
|
324
318
|
}
|
|
319
|
+
exports.addRoute = addRoute;
|
|
325
320
|
function addBrowserRouter(sourcePath, source) {
|
|
326
321
|
const app = findElements(source, 'App')[0];
|
|
327
322
|
if (app) {
|
|
@@ -344,6 +339,7 @@ function addBrowserRouter(sourcePath, source) {
|
|
|
344
339
|
return [];
|
|
345
340
|
}
|
|
346
341
|
}
|
|
342
|
+
exports.addBrowserRouter = addBrowserRouter;
|
|
347
343
|
function addStaticRouter(sourcePath, source) {
|
|
348
344
|
const app = findElements(source, 'App')[0];
|
|
349
345
|
if (app) {
|
|
@@ -366,6 +362,7 @@ function addStaticRouter(sourcePath, source) {
|
|
|
366
362
|
return [];
|
|
367
363
|
}
|
|
368
364
|
}
|
|
365
|
+
exports.addStaticRouter = addStaticRouter;
|
|
369
366
|
function addReduxStoreToMain(sourcePath, source) {
|
|
370
367
|
const renderStmt = findMainRenderStatement(source);
|
|
371
368
|
if (!renderStmt) {
|
|
@@ -403,6 +400,7 @@ const store = configureStore({
|
|
|
403
400
|
},
|
|
404
401
|
];
|
|
405
402
|
}
|
|
403
|
+
exports.addReduxStoreToMain = addReduxStoreToMain;
|
|
406
404
|
function updateReduxStore(sourcePath, source, feature) {
|
|
407
405
|
if (!tsModule) {
|
|
408
406
|
tsModule = (0, ensure_typescript_1.ensureTypescript)();
|
|
@@ -457,6 +455,7 @@ function updateReduxStore(sourcePath, source, feature) {
|
|
|
457
455
|
},
|
|
458
456
|
];
|
|
459
457
|
}
|
|
458
|
+
exports.updateReduxStore = updateReduxStore;
|
|
460
459
|
function getComponentNode(sourceFile) {
|
|
461
460
|
if (!tsModule) {
|
|
462
461
|
tsModule = (0, ensure_typescript_1.ensureTypescript)();
|
|
@@ -470,6 +469,7 @@ function getComponentNode(sourceFile) {
|
|
|
470
469
|
}
|
|
471
470
|
return defaultExport;
|
|
472
471
|
}
|
|
472
|
+
exports.getComponentNode = getComponentNode;
|
|
473
473
|
function getComponentPropsInterface(sourceFile, cmpDeclaration) {
|
|
474
474
|
if (!tsModule) {
|
|
475
475
|
tsModule = (0, ensure_typescript_1.ensureTypescript)();
|
|
@@ -519,3 +519,4 @@ function getComponentPropsInterface(sourceFile, cmpDeclaration) {
|
|
|
519
519
|
return null;
|
|
520
520
|
}
|
|
521
521
|
}
|
|
522
|
+
exports.getComponentPropsInterface = getComponentPropsInterface;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getArgsDefaultValue =
|
|
4
|
-
exports.getDefaultsForComponent = getDefaultsForComponent;
|
|
5
|
-
exports.getImportForType = getImportForType;
|
|
3
|
+
exports.getImportForType = exports.getDefaultsForComponent = exports.getArgsDefaultValue = void 0;
|
|
6
4
|
const ensure_typescript_1 = require("@nx/js/src/utils/typescript/ensure-typescript");
|
|
7
5
|
const ast_utils_1 = require("./ast-utils");
|
|
8
6
|
let tsModule;
|
|
@@ -24,6 +22,7 @@ function getArgsDefaultValue(property) {
|
|
|
24
22
|
return resolvedValue;
|
|
25
23
|
}
|
|
26
24
|
}
|
|
25
|
+
exports.getArgsDefaultValue = getArgsDefaultValue;
|
|
27
26
|
function getDefaultsForComponent(sourceFile, cmpDeclaration) {
|
|
28
27
|
if (!tsModule) {
|
|
29
28
|
tsModule = (0, ensure_typescript_1.ensureTypescript)();
|
|
@@ -53,7 +52,9 @@ function getDefaultsForComponent(sourceFile, cmpDeclaration) {
|
|
|
53
52
|
}
|
|
54
53
|
return { propsTypeName, props, argTypes };
|
|
55
54
|
}
|
|
55
|
+
exports.getDefaultsForComponent = getDefaultsForComponent;
|
|
56
56
|
function getImportForType(sourceFile, typeName) {
|
|
57
57
|
return sourceFile.statements.find((statement) => tsModule.isImportDeclaration(statement) &&
|
|
58
58
|
statement.getText().includes(typeName));
|
|
59
59
|
}
|
|
60
|
+
exports.getImportForType = getImportForType;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createTsConfig =
|
|
4
|
-
exports.extractTsConfigBase = extractTsConfigBase;
|
|
3
|
+
exports.extractTsConfigBase = exports.createTsConfig = void 0;
|
|
5
4
|
const shared = require("@nx/js/src/utils/typescript/create-ts-config");
|
|
6
5
|
const json_1 = require("nx/src/generators/utils/json");
|
|
7
6
|
function createTsConfig(host, projectRoot, type, options, relativePathToRootTsConfig) {
|
|
@@ -55,6 +54,7 @@ function createTsConfig(host, projectRoot, type, options, relativePathToRootTsCo
|
|
|
55
54
|
});
|
|
56
55
|
}
|
|
57
56
|
}
|
|
57
|
+
exports.createTsConfig = createTsConfig;
|
|
58
58
|
function extractTsConfigBase(host) {
|
|
59
59
|
shared.extractTsConfigBase(host);
|
|
60
60
|
if (host.exists('vite.config.ts')) {
|
|
@@ -62,3 +62,4 @@ function extractTsConfigBase(host) {
|
|
|
62
62
|
host.write('vite.config.ts', vite.replace(`projects: []`, `projects: ['tsconfig.base.json']`));
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
+
exports.extractTsConfigBase = extractTsConfigBase;
|
package/src/utils/ct-utils.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.configureCypressCT =
|
|
4
|
-
exports.getBundlerFromTarget = getBundlerFromTarget;
|
|
5
|
-
exports.getActualBundler = getActualBundler;
|
|
6
|
-
exports.isComponent = isComponent;
|
|
3
|
+
exports.isComponent = exports.getActualBundler = exports.getBundlerFromTarget = exports.configureCypressCT = void 0;
|
|
7
4
|
const devkit_1 = require("@nx/devkit");
|
|
8
5
|
const ensure_typescript_1 = require("@nx/js/src/utils/typescript/ensure-typescript");
|
|
9
6
|
const ast_utils_1 = require("./ast-utils");
|
|
@@ -53,6 +50,7 @@ async function configureCypressCT(tree, options) {
|
|
|
53
50
|
tree.write(cypressConfigFilePath, `import { nxComponentTestingPreset } from '@nx/react/plugins/component-testing';\n${updatedCyConfig}`);
|
|
54
51
|
return found;
|
|
55
52
|
}
|
|
53
|
+
exports.configureCypressCT = configureCypressCT;
|
|
56
54
|
function assertValidConfig(config) {
|
|
57
55
|
if (!config) {
|
|
58
56
|
throw new Error('Unable to find a valid build configuration. Try passing in a target for an app. --build-target=<project>:<target>[:<configuration>]');
|
|
@@ -72,6 +70,7 @@ async function getBundlerFromTarget(found, tree) {
|
|
|
72
70
|
? 'vite'
|
|
73
71
|
: 'webpack';
|
|
74
72
|
}
|
|
73
|
+
exports.getBundlerFromTarget = getBundlerFromTarget;
|
|
75
74
|
async function getActualBundler(tree, options, found) {
|
|
76
75
|
// Specifically undefined to allow Remix workaround of passing an empty string
|
|
77
76
|
const actualBundler = options.buildTarget !== undefined && options.bundler
|
|
@@ -79,6 +78,7 @@ async function getActualBundler(tree, options, found) {
|
|
|
79
78
|
: await getBundlerFromTarget(found, tree);
|
|
80
79
|
return actualBundler;
|
|
81
80
|
}
|
|
81
|
+
exports.getActualBundler = getActualBundler;
|
|
82
82
|
function isComponent(tree, filePath) {
|
|
83
83
|
if (!tsModule) {
|
|
84
84
|
tsModule = (0, ensure_typescript_1.ensureTypescript)();
|
|
@@ -91,3 +91,4 @@ function isComponent(tree, filePath) {
|
|
|
91
91
|
const cmpDeclaration = (0, ast_utils_1.getComponentNode)(sourceFile);
|
|
92
92
|
return !!cmpDeclaration;
|
|
93
93
|
}
|
|
94
|
+
exports.isComponent = isComponent;
|
package/src/utils/format-file.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.formatFile =
|
|
3
|
+
exports.formatFile = void 0;
|
|
4
4
|
const prettier_1 = require("prettier");
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
function formatFile(content, ...values) {
|
|
@@ -9,3 +9,4 @@ function formatFile(content, ...values) {
|
|
|
9
9
|
parser: 'typescript',
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
|
+
exports.formatFile = formatFile;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getInSourceVitestTestsTemplate =
|
|
3
|
+
exports.getInSourceVitestTestsTemplate = void 0;
|
|
4
4
|
function getInSourceVitestTestsTemplate(testContent) {
|
|
5
5
|
return `
|
|
6
6
|
if (import.meta.vitest) {
|
|
@@ -18,3 +18,4 @@ if (import.meta.vitest) {
|
|
|
18
18
|
}
|
|
19
19
|
`;
|
|
20
20
|
}
|
|
21
|
+
exports.getInSourceVitestTestsTemplate = getInSourceVitestTestsTemplate;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hasVitePlugin =
|
|
3
|
+
exports.hasVitePlugin = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
function hasVitePlugin(tree) {
|
|
6
6
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
@@ -8,3 +8,4 @@ function hasVitePlugin(tree) {
|
|
|
8
8
|
? p === '@nx/vite/plugin'
|
|
9
9
|
: p.plugin === '@nx/vite/plugin');
|
|
10
10
|
}
|
|
11
|
+
exports.hasVitePlugin = hasVitePlugin;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hasWebpackPlugin =
|
|
3
|
+
exports.hasWebpackPlugin = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
function hasWebpackPlugin(tree) {
|
|
6
6
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
@@ -8,3 +8,4 @@ function hasWebpackPlugin(tree) {
|
|
|
8
8
|
? p === '@nx/webpack/plugin'
|
|
9
9
|
: p.plugin === '@nx/webpack/plugin');
|
|
10
10
|
}
|
|
11
|
+
exports.hasWebpackPlugin = hasWebpackPlugin;
|
package/src/utils/jest-utils.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateJestConfigContent =
|
|
3
|
+
exports.updateJestConfigContent = void 0;
|
|
4
4
|
function updateJestConfigContent(content) {
|
|
5
5
|
return content
|
|
6
6
|
.replace('transform: {', "transform: {\n '^(?!.*\\\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest',")
|
|
7
7
|
.replace(`'babel-jest'`, `['babel-jest', { presets: ['@nx/react/babel'] }]`);
|
|
8
8
|
}
|
|
9
|
+
exports.updateJestConfigContent = updateJestConfigContent;
|
package/src/utils/lint.d.ts
CHANGED
|
@@ -12,25 +12,25 @@ export declare const extraEslintDependencies: {
|
|
|
12
12
|
* @deprecated Use `addExtendsToLintConfig` from `@nx/eslint` instead.
|
|
13
13
|
*/
|
|
14
14
|
export declare const extendReactEslintJson: (json: Linter.Config) => {
|
|
15
|
-
ignorePatterns?: string | string[]
|
|
16
|
-
root?: boolean
|
|
17
|
-
$schema?: string
|
|
15
|
+
ignorePatterns?: string | string[];
|
|
16
|
+
root?: boolean;
|
|
17
|
+
$schema?: string;
|
|
18
18
|
env?: {
|
|
19
19
|
[name: string]: boolean;
|
|
20
|
-
}
|
|
20
|
+
};
|
|
21
21
|
globals?: {
|
|
22
22
|
[name: string]: boolean | "off" | "readonly" | "readable" | "writable" | "writeable";
|
|
23
|
-
}
|
|
24
|
-
noInlineConfig?: boolean
|
|
23
|
+
};
|
|
24
|
+
noInlineConfig?: boolean;
|
|
25
25
|
overrides?: Linter.ConfigOverride<Linter.RulesRecord>[];
|
|
26
|
-
parser?: string
|
|
27
|
-
parserOptions?: Linter.ParserOptions
|
|
28
|
-
plugins?: string[]
|
|
29
|
-
processor?: string
|
|
30
|
-
reportUnusedDisableDirectives?: boolean
|
|
26
|
+
parser?: string;
|
|
27
|
+
parserOptions?: Linter.ParserOptions;
|
|
28
|
+
plugins?: string[];
|
|
29
|
+
processor?: string;
|
|
30
|
+
reportUnusedDisableDirectives?: boolean;
|
|
31
31
|
settings?: {
|
|
32
32
|
[name: string]: any;
|
|
33
|
-
}
|
|
33
|
+
};
|
|
34
34
|
rules?: Partial<Linter.RulesRecord>;
|
|
35
35
|
extends: string[];
|
|
36
36
|
};
|
package/src/utils/maybe-js.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.maybeJs =
|
|
3
|
+
exports.maybeJs = void 0;
|
|
4
4
|
function maybeJs(options, path) {
|
|
5
5
|
return options.js && (path.endsWith('.ts') || path.endsWith('.tsx'))
|
|
6
6
|
? path.replace(/\.tsx?$/, '.js')
|
|
7
7
|
: path;
|
|
8
8
|
}
|
|
9
|
+
exports.maybeJs = maybeJs;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createApp =
|
|
4
|
-
exports.createLib = createLib;
|
|
3
|
+
exports.createLib = exports.createApp = void 0;
|
|
5
4
|
const devkit_1 = require("@nx/devkit");
|
|
6
5
|
const application_1 = require("../generators/application/application");
|
|
7
6
|
const eslint_1 = require("@nx/eslint");
|
|
@@ -16,6 +15,7 @@ async function createApp(tree, appName) {
|
|
|
16
15
|
projectNameAndRootFormat: 'as-provided',
|
|
17
16
|
});
|
|
18
17
|
}
|
|
18
|
+
exports.createApp = createApp;
|
|
19
19
|
async function createLib(tree, libName) {
|
|
20
20
|
const { fileName } = (0, devkit_1.names)(libName);
|
|
21
21
|
tree.write(`/${fileName}/src/index.ts`, `import React from 'react';\n`);
|
|
@@ -27,3 +27,4 @@ async function createLib(tree, libName) {
|
|
|
27
27
|
targets: {},
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
|
+
exports.createLib = createLib;
|
package/tailwind.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createGlobPatternsForDependencies =
|
|
3
|
+
exports.createGlobPatternsForDependencies = void 0;
|
|
4
4
|
const generate_globs_1 = require("@nx/js/src/utils/generate-globs");
|
|
5
5
|
/**
|
|
6
6
|
* Generates a set of glob patterns based off the source root of the app and its dependencies
|
|
@@ -26,3 +26,4 @@ function createGlobPatternsForDependencies(dirPath, fileGlobPattern = '/**/*!(*.
|
|
|
26
26
|
return [];
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
+
exports.createGlobPatternsForDependencies = createGlobPatternsForDependencies;
|