@nrwl/next 15.8.6 → 15.8.8
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/migrations.json +6 -0
- package/package.json +12 -11
- package/plugins/with-less.d.ts +2 -8
- package/plugins/with-less.js +59 -57
- package/plugins/with-less.js.map +1 -1
- package/plugins/with-nx.d.ts +5 -1
- package/plugins/with-nx.js +104 -3
- package/plugins/with-nx.js.map +1 -1
- package/plugins/with-stylus.d.ts +2 -1
- package/plugins/with-stylus.js +59 -57
- package/plugins/with-stylus.js.map +1 -1
- package/src/executors/build/build.impl.js +2 -12
- package/src/executors/build/build.impl.js.map +1 -1
- package/src/executors/build/lib/create-next-config-file.d.ts +1 -1
- package/src/executors/build/lib/create-next-config-file.js +1 -35
- package/src/executors/build/lib/create-next-config-file.js.map +1 -1
- package/src/executors/export/export.impl.js +18 -28
- package/src/executors/export/export.impl.js.map +1 -1
- package/src/executors/server/server.impl.js +4 -19
- package/src/executors/server/server.impl.js.map +1 -1
- package/src/generators/application/lib/add-cypress.js +4 -2
- package/src/generators/application/lib/add-cypress.js.map +1 -1
- package/src/generators/application/lib/add-jest.js +3 -2
- package/src/generators/application/lib/add-jest.js.map +1 -1
- package/src/generators/init/init.js +4 -4
- package/src/generators/init/init.js.map +1 -1
- package/src/migrations/update-15-8-8/add-style-packages.d.ts +3 -0
- package/src/migrations/update-15-8-8/add-style-packages.js +28 -0
- package/src/migrations/update-15-8-8/add-style-packages.js.map +1 -0
- package/src/utils/buildable-libs.d.ts +0 -3
- package/src/utils/buildable-libs.js +0 -18
- package/src/utils/buildable-libs.js.map +1 -1
- package/src/utils/config.d.ts +1 -4
- package/src/utils/config.js +26 -47
- package/src/utils/config.js.map +1 -1
- package/src/utils/create-copy-plugin.d.ts +2 -0
- package/src/utils/create-copy-plugin.js +63 -0
- package/src/utils/create-copy-plugin.js.map +1 -0
- package/src/utils/styles.d.ts +2 -0
- package/src/utils/styles.js +9 -6
- package/src/utils/styles.js.map +1 -1
- package/src/utils/types.d.ts +0 -1
|
@@ -1,49 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createNextConfigFile = void 0;
|
|
4
|
-
const devkit_1 = require("@nrwl/devkit");
|
|
5
|
-
const ts = require("typescript");
|
|
6
4
|
const fs_1 = require("fs");
|
|
7
5
|
const path_1 = require("path");
|
|
8
|
-
const typescript_1 = require("nx/src/utils/typescript");
|
|
9
6
|
function createNextConfigFile(options, context) {
|
|
10
7
|
const nextConfigPath = options.nextConfig
|
|
11
8
|
? (0, path_1.join)(context.root, options.nextConfig)
|
|
12
9
|
: (0, path_1.join)(context.root, options.root, 'next.config.js');
|
|
13
|
-
// Copy config file and our `with-nx.js` file to remove dependency on @nrwl/next for production build.
|
|
14
10
|
if ((0, fs_1.existsSync)(nextConfigPath)) {
|
|
15
|
-
(0, fs_1.
|
|
16
|
-
(0, fs_1.writeFileSync)((0, path_1.join)(options.outputPath, 'next.config.js'), (0, fs_1.readFileSync)(nextConfigPath)
|
|
17
|
-
.toString()
|
|
18
|
-
.replace('@nrwl/next/plugins/with-nx', './with-nx.js'));
|
|
11
|
+
(0, fs_1.copyFileSync)(nextConfigPath, (0, path_1.join)(options.outputPath, 'next.config.js'));
|
|
19
12
|
}
|
|
20
13
|
}
|
|
21
14
|
exports.createNextConfigFile = createNextConfigFile;
|
|
22
|
-
function getWithNxContent() {
|
|
23
|
-
var _a;
|
|
24
|
-
const withNxFile = (0, path_1.join)(__dirname, '../../../../plugins/with-nx.js');
|
|
25
|
-
let withNxContent = (0, fs_1.readFileSync)(withNxFile).toString();
|
|
26
|
-
const withNxSource = ts.createSourceFile(withNxFile, withNxContent, ts.ScriptTarget.Latest, true);
|
|
27
|
-
const getWithNxContextDeclaration = (_a = (0, typescript_1.findNodes)(withNxSource, ts.SyntaxKind.FunctionDeclaration)) === null || _a === void 0 ? void 0 : _a.find((node) => { var _a; return ((_a = node.name) === null || _a === void 0 ? void 0 : _a.text) === 'getWithNxContext'; });
|
|
28
|
-
if (getWithNxContextDeclaration) {
|
|
29
|
-
withNxContent = (0, devkit_1.applyChangesToString)(withNxContent, [
|
|
30
|
-
{
|
|
31
|
-
type: devkit_1.ChangeType.Delete,
|
|
32
|
-
start: getWithNxContextDeclaration.getStart(withNxSource),
|
|
33
|
-
length: getWithNxContextDeclaration.getWidth(withNxSource),
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
type: devkit_1.ChangeType.Insert,
|
|
37
|
-
index: getWithNxContextDeclaration.getStart(withNxSource),
|
|
38
|
-
text: (0, devkit_1.stripIndents) `function getWithNxContext() {
|
|
39
|
-
return {
|
|
40
|
-
workspaceRoot: '${devkit_1.workspaceRoot}',
|
|
41
|
-
libsDir: '${(0, devkit_1.workspaceLayout)().libsDir}'
|
|
42
|
-
}
|
|
43
|
-
}`,
|
|
44
|
-
},
|
|
45
|
-
]);
|
|
46
|
-
}
|
|
47
|
-
return withNxContent;
|
|
48
|
-
}
|
|
49
15
|
//# sourceMappingURL=create-next-config-file.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-next-config-file.js","sourceRoot":"","sources":["../../../../../../../packages/next/src/executors/build/lib/create-next-config-file.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"create-next-config-file.js","sourceRoot":"","sources":["../../../../../../../packages/next/src/executors/build/lib/create-next-config-file.ts"],"names":[],"mappings":";;;AAEA,2BAA8C;AAC9C,+BAA4B;AAI5B,SAAgB,oBAAoB,CAClC,OAAgC,EAChC,OAAwB;IAExB,MAAM,cAAc,GAAG,OAAO,CAAC,UAAU;QACvC,CAAC,CAAC,IAAA,WAAI,EAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC;QACxC,CAAC,CAAC,IAAA,WAAI,EAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;IAEvD,IAAI,IAAA,eAAU,EAAC,cAAc,CAAC,EAAE;QAC9B,IAAA,iBAAY,EAAC,cAAc,EAAE,IAAA,WAAI,EAAC,OAAO,CAAC,UAAU,EAAE,gBAAgB,CAAC,CAAC,CAAC;KAC1E;AACH,CAAC;AAXD,oDAWC"}
|
|
@@ -6,12 +6,13 @@ const devkit_1 = require("@nrwl/devkit");
|
|
|
6
6
|
const export_1 = require("next/dist/export");
|
|
7
7
|
const path_1 = require("path");
|
|
8
8
|
const buildable_libs_utils_1 = require("@nrwl/workspace/src/utilities/buildable-libs-utils");
|
|
9
|
-
const devkit_2 = require("@nrwl/devkit");
|
|
10
|
-
const config_1 = require("../../utils/config");
|
|
11
|
-
const constants_1 = require("../../utils/constants");
|
|
12
9
|
const nextTrace = require("next/dist/trace");
|
|
10
|
+
const os_1 = require("os");
|
|
11
|
+
const child_process_1 = require("child_process");
|
|
12
|
+
const chalk = require("chalk");
|
|
13
|
+
// platform specific command name
|
|
14
|
+
const pmCmd = (0, os_1.platform)() === 'win32' ? `npx.cmd` : 'npx';
|
|
13
15
|
function exportExecutor(options, context) {
|
|
14
|
-
var _a, e_1, _b, _c;
|
|
15
16
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
16
17
|
let dependencies = [];
|
|
17
18
|
if (!options.buildLibsFromSource) {
|
|
@@ -19,34 +20,19 @@ function exportExecutor(options, context) {
|
|
|
19
20
|
context.configurationName);
|
|
20
21
|
dependencies = result.dependencies;
|
|
21
22
|
}
|
|
22
|
-
const libsDir = (0, path_1.join)(context.root, (0,
|
|
23
|
-
const buildTarget = (0, devkit_1.parseTargetString)(options.buildTarget);
|
|
24
|
-
const build = yield (0, devkit_1.runExecutor)(buildTarget, {}, context);
|
|
23
|
+
const libsDir = (0, path_1.join)(context.root, (0, devkit_1.workspaceLayout)().libsDir);
|
|
24
|
+
const buildTarget = (0, devkit_1.parseTargetString)(options.buildTarget, context.projectGraph);
|
|
25
25
|
try {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const result = _c;
|
|
31
|
-
if (!result.success) {
|
|
32
|
-
return result;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
finally {
|
|
36
|
-
_d = true;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
26
|
+
const args = getBuildTargetCommand(options);
|
|
27
|
+
(0, child_process_1.execFileSync)(pmCmd, args, {
|
|
28
|
+
stdio: [0, 1, 2],
|
|
29
|
+
});
|
|
39
30
|
}
|
|
40
|
-
catch (
|
|
41
|
-
|
|
42
|
-
try {
|
|
43
|
-
if (!_d && !_a && (_b = build_1.return)) yield _b.call(build_1);
|
|
44
|
-
}
|
|
45
|
-
finally { if (e_1) throw e_1.error; }
|
|
31
|
+
catch (_a) {
|
|
32
|
+
throw new Error(`Build target failed: ${chalk.bold(options.buildTarget)}`);
|
|
46
33
|
}
|
|
47
34
|
const buildOptions = (0, devkit_1.readTargetOptions)(buildTarget, context);
|
|
48
35
|
const root = (0, path_1.resolve)(context.root, buildOptions.root);
|
|
49
|
-
const config = yield (0, config_1.prepareConfig)(constants_1.PHASE_EXPORT, buildOptions, context, dependencies, libsDir);
|
|
50
36
|
// Taken from:
|
|
51
37
|
// https://github.com/vercel/next.js/blob/ead56eaab68409e96c19f7d9139747bac1197aa9/packages/next/cli/next-export.ts#L13
|
|
52
38
|
const nextExportCliSpan = nextTrace.trace('next-export-cli');
|
|
@@ -55,9 +41,13 @@ function exportExecutor(options, context) {
|
|
|
55
41
|
silent: options.silent,
|
|
56
42
|
threads: options.threads,
|
|
57
43
|
outdir: `${buildOptions.outputPath}/exported`,
|
|
58
|
-
}, nextExportCliSpan
|
|
44
|
+
}, nextExportCliSpan);
|
|
59
45
|
return { success: true };
|
|
60
46
|
});
|
|
61
47
|
}
|
|
62
48
|
exports.default = exportExecutor;
|
|
49
|
+
function getBuildTargetCommand(options) {
|
|
50
|
+
const cmd = ['nx', 'run', options.buildTarget];
|
|
51
|
+
return cmd;
|
|
52
|
+
}
|
|
63
53
|
//# sourceMappingURL=export.impl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"export.impl.js","sourceRoot":"","sources":["../../../../../../packages/next/src/executors/export/export.impl.ts"],"names":[],"mappings":";;;AAAA,yBAAuB;AACvB,yCAKsB;AACtB,6CAAyC;AACzC,+BAAqC;AACrC,6FAG4D;
|
|
1
|
+
{"version":3,"file":"export.impl.js","sourceRoot":"","sources":["../../../../../../packages/next/src/executors/export/export.impl.ts"],"names":[],"mappings":";;;AAAA,yBAAuB;AACvB,yCAKsB;AACtB,6CAAyC;AACzC,+BAAqC;AACrC,6FAG4D;AAO5D,6CAA8C;AAC9C,2BAA8B;AAC9B,iDAA6C;AAC7C,+BAA+B;AAE/B,iCAAiC;AACjC,MAAM,KAAK,GAAG,IAAA,aAAQ,GAAE,KAAK,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC;AAEzD,SAA8B,cAAc,CAC1C,OAAiC,EACjC,OAAwB;;QAExB,IAAI,YAAY,GAAoC,EAAE,CAAC;QACvD,IAAI,CAAC,OAAO,CAAC,mBAAmB,EAAE;YAChC,MAAM,MAAM,GAAG,IAAA,mDAA4B,EACzC,OAAO,CAAC,YAAY,EACpB,OAAO,CAAC,IAAI,EACZ,OAAO,CAAC,WAAW,EACnB,OAAO,EAAE,6BAA6B;YACtC,OAAO,CAAC,iBAAiB,CAC1B,CAAC;YACF,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC;SACpC;QAED,MAAM,OAAO,GAAG,IAAA,WAAI,EAAC,OAAO,CAAC,IAAI,EAAE,IAAA,wBAAe,GAAE,CAAC,OAAO,CAAC,CAAC;QAC9D,MAAM,WAAW,GAAG,IAAA,0BAAiB,EACnC,OAAO,CAAC,WAAW,EACnB,OAAO,CAAC,YAAY,CACrB,CAAC;QAEF,IAAI;YACF,MAAM,IAAI,GAAG,qBAAqB,CAAC,OAAO,CAAC,CAAC;YAC5C,IAAA,4BAAY,EAAC,KAAK,EAAE,IAAI,EAAE;gBACxB,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;aACjB,CAAC,CAAC;SACJ;QAAC,WAAM;YACN,MAAM,IAAI,KAAK,CAAC,wBAAwB,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;SAC5E;QAED,MAAM,YAAY,GAAG,IAAA,0BAAiB,EACpC,WAAW,EACX,OAAO,CACR,CAAC;QACF,MAAM,IAAI,GAAG,IAAA,cAAO,EAAC,OAAO,CAAC,IAAI,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;QAEtD,cAAc;QACd,uHAAuH;QACvH,MAAM,iBAAiB,GAAG,SAAS,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;QAE7D,MAAM,IAAA,gBAAS,EACb,IAAI,EACJ;YACE,aAAa,EAAE,WAAW;YAC1B,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,MAAM,EAAE,GAAG,YAAY,CAAC,UAAU,WAAW;SACvC,EACR,iBAAiB,CAClB,CAAC;QAEF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC3B,CAAC;CAAA;AArDD,iCAqDC;AAED,SAAS,qBAAqB,CAAC,OAAiC;IAC9D,MAAM,GAAG,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IAC/C,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -6,11 +6,8 @@ const devkit_1 = require("@nrwl/devkit");
|
|
|
6
6
|
const chalk = require("chalk");
|
|
7
7
|
const fs_1 = require("fs");
|
|
8
8
|
const path_1 = require("path");
|
|
9
|
-
const buildable_libs_utils_1 = require("@nrwl/workspace/src/utilities/buildable-libs-utils");
|
|
10
|
-
const config_1 = require("../../utils/config");
|
|
11
9
|
const custom_server_1 = require("./lib/custom-server");
|
|
12
10
|
const default_server_1 = require("./lib/default-server");
|
|
13
|
-
const constants_1 = require("../../utils/constants");
|
|
14
11
|
const infoPrefix = `[ ${chalk.dim(chalk.cyan('info'))} ] `;
|
|
15
12
|
function serveExecutor(options, context) {
|
|
16
13
|
return tslib_1.__asyncGenerator(this, arguments, function* serveExecutor_1() {
|
|
@@ -24,27 +21,16 @@ function serveExecutor(options, context) {
|
|
|
24
21
|
process.env.PORT = options.port;
|
|
25
22
|
const buildOptions = (0, devkit_1.readTargetOptions)((0, devkit_1.parseTargetString)(options.buildTarget, context.projectGraph), context);
|
|
26
23
|
const root = (0, path_1.resolve)(context.root, buildOptions.root);
|
|
27
|
-
const config = yield tslib_1.__await((0, config_1.prepareConfig)(options.dev ? constants_1.PHASE_DEVELOPMENT_SERVER : constants_1.PHASE_PRODUCTION_SERVER, buildOptions, context, getDependencies(options, context), (0, path_1.join)(context.root, (0, devkit_1.workspaceLayout)().libsDir)));
|
|
28
24
|
if (options.customServerTarget) {
|
|
29
|
-
yield tslib_1.__await(yield* tslib_1.__asyncDelegator(tslib_1.__asyncValues(runCustomServer(root,
|
|
25
|
+
yield tslib_1.__await(yield* tslib_1.__asyncDelegator(tslib_1.__asyncValues(runCustomServer(root, options, buildOptions, context))));
|
|
30
26
|
}
|
|
31
27
|
else {
|
|
32
|
-
yield tslib_1.__await(yield* tslib_1.__asyncDelegator(tslib_1.__asyncValues(runNextDevServer(root,
|
|
28
|
+
yield tslib_1.__await(yield* tslib_1.__asyncDelegator(tslib_1.__asyncValues(runNextDevServer(root, options, buildOptions, context))));
|
|
33
29
|
}
|
|
34
30
|
});
|
|
35
31
|
}
|
|
36
32
|
exports.default = serveExecutor;
|
|
37
|
-
function
|
|
38
|
-
if (options.buildLibsFromSource) {
|
|
39
|
-
return [];
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
const result = (0, buildable_libs_utils_1.calculateProjectDependencies)(context.projectGraph, context.root, context.projectName, 'build', // should be generalized
|
|
43
|
-
context.configurationName);
|
|
44
|
-
return result.dependencies;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
function runNextDevServer(root, config, options, buildOptions, context) {
|
|
33
|
+
function runNextDevServer(root, options, buildOptions, context) {
|
|
48
34
|
return tslib_1.__asyncGenerator(this, arguments, function* runNextDevServer_1() {
|
|
49
35
|
const baseUrl = `http://${options.hostname || 'localhost'}:${options.port}`;
|
|
50
36
|
const settings = {
|
|
@@ -52,7 +38,6 @@ function runNextDevServer(root, config, options, buildOptions, context) {
|
|
|
52
38
|
dir: root,
|
|
53
39
|
staticMarkup: options.staticMarkup,
|
|
54
40
|
quiet: options.quiet,
|
|
55
|
-
conf: config,
|
|
56
41
|
port: options.port,
|
|
57
42
|
customServer: !!options.customServerTarget,
|
|
58
43
|
hostname: options.hostname || 'localhost',
|
|
@@ -91,7 +76,7 @@ function runNextDevServer(root, config, options, buildOptions, context) {
|
|
|
91
76
|
}
|
|
92
77
|
});
|
|
93
78
|
}
|
|
94
|
-
function runCustomServer(root,
|
|
79
|
+
function runCustomServer(root, options, buildOptions, context) {
|
|
95
80
|
return tslib_1.__asyncGenerator(this, arguments, function* runCustomServer_1() {
|
|
96
81
|
var _a, e_1, _b, _c;
|
|
97
82
|
process.env.NX_NEXT_DIR = root;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.impl.js","sourceRoot":"","sources":["../../../../../../packages/next/src/executors/server/server.impl.ts"],"names":[],"mappings":";;;AAAA,yBAAuB;AACvB,
|
|
1
|
+
{"version":3,"file":"server.impl.js","sourceRoot":"","sources":["../../../../../../packages/next/src/executors/server/server.impl.ts"],"names":[],"mappings":";;;AAAA,yBAAuB;AACvB,yCAMsB;AACtB,+BAA+B;AAC/B,2BAAgC;AAChC,+BAAqC;AASrC,uDAAmD;AACnD,yDAAqD;AAErD,MAAM,UAAU,GAAG,KAAK,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CA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,KAAK,CACb,4EAA4E,OAAO,CAAC,WAAW,KAAK,CACrG,CAAC;aACH;SACF;IACH,CAAC;CAAA;AAED,SAAgB,eAAe,CAC7B,IAAY,EACZ,OAAgC,EAChC,YAAqC,EACrC,OAAwB;;;QAExB,OAAO,CAAC,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC;QAC/B,OAAO,CAAC,GAAG,CAAC,kBAAkB,GAAG,IAAA,WAAI,EAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAEtD,MAAM,OAAO,GAAG,UAAU,OAAO,CAAC,QAAQ,IAAI,WAAW,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QAE5E,MAAM,iBAAiB,GAAG,sBAAM,IAAA,oBAAW,EACzC,IAAA,0BAAiB,EAAC,OAAO,CAAC,kBAAkB,EAAE,OAAO,CAAC,YAAY,CAAC,EACnE;YACE,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK;SAClC,EACD,OAAO,CACR,CAAA,CAAC;;YAEF,KAA2B,eAAA,sBAAA,sBAAA,iBAAiB,CAAA,uBAAA;gBAAjB,iCAAiB;gBAAjB,WAAiB;;oBAAjC,MAAM,MAAM,KAAA,CAAA;oBACrB,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;wBACnB,6BAAO,MAAM,EAAC;qBACf;oBACD,4BAAM;wBACJ,OAAO,EAAE,IAAI;wBACb,OAAO;qBACR,CAAA,CAAC;;;;;aACH;;;;;;;;;QAED,6BAAO,EAAE,OAAO,EAAE,IAAI,EAAE,EAAC;IAC3B,CAAC;CAAA"}
|
|
@@ -2,14 +2,16 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addCypress = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const
|
|
5
|
+
const devkit_1 = require("@nrwl/devkit");
|
|
6
6
|
const linter_1 = require("@nrwl/linter");
|
|
7
|
+
const versions_1 = require("../../../utils/versions");
|
|
7
8
|
function addCypress(host, options) {
|
|
8
9
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
9
10
|
if (options.e2eTestRunner !== 'cypress') {
|
|
10
11
|
return () => { };
|
|
11
12
|
}
|
|
12
|
-
|
|
13
|
+
const { cypressProjectGenerator } = (0, devkit_1.ensurePackage)('@nrwl/cypress', versions_1.nxVersion);
|
|
14
|
+
return cypressProjectGenerator(host, Object.assign(Object.assign({}, options), { linter: linter_1.Linter.EsLint, name: `${options.name}-e2e`, directory: options.directory, project: options.projectName }));
|
|
13
15
|
});
|
|
14
16
|
}
|
|
15
17
|
exports.addCypress = addCypress;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-cypress.js","sourceRoot":"","sources":["../../../../../../../packages/next/src/generators/application/lib/add-cypress.ts"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"add-cypress.js","sourceRoot":"","sources":["../../../../../../../packages/next/src/generators/application/lib/add-cypress.ts"],"names":[],"mappings":";;;;AAAA,yCAAmD;AACnD,yCAAsC;AAEtC,sDAAoD;AAGpD,SAAsB,UAAU,CAAC,IAAU,EAAE,OAAyB;;QACpE,IAAI,OAAO,CAAC,aAAa,KAAK,SAAS,EAAE;YACvC,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC;SACjB;QAED,MAAM,EAAE,uBAAuB,EAAE,GAAG,IAAA,sBAAa,EAE/C,eAAe,EAAE,oBAAS,CAAC,CAAC;QAC9B,OAAO,uBAAuB,CAAC,IAAI,kCAC9B,OAAO,KACV,MAAM,EAAE,eAAM,CAAC,MAAM,EACrB,IAAI,EAAE,GAAG,OAAO,CAAC,IAAI,MAAM,EAC3B,SAAS,EAAE,OAAO,CAAC,SAAS,EAC5B,OAAO,EAAE,OAAO,CAAC,WAAW,IAC5B,CAAC;IACL,CAAC;CAAA;AAfD,gCAeC"}
|
|
@@ -3,13 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.addJest = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const devkit_1 = require("@nrwl/devkit");
|
|
6
|
-
const
|
|
6
|
+
const versions_1 = require("../../../utils/versions");
|
|
7
7
|
function addJest(host, options) {
|
|
8
8
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
9
9
|
if (options.unitTestRunner !== 'jest') {
|
|
10
10
|
return () => { };
|
|
11
11
|
}
|
|
12
|
-
const
|
|
12
|
+
const { jestProjectGenerator } = (0, devkit_1.ensurePackage)('@nrwl/jest', versions_1.nxVersion);
|
|
13
|
+
const jestTask = yield jestProjectGenerator(host, Object.assign(Object.assign({}, options), { project: options.projectName, supportTsx: true, skipSerializers: true, setupFile: 'none', compiler: 'babel' }));
|
|
13
14
|
const tsConfigSpecJson = (0, devkit_1.readJson)(host, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.spec.json'));
|
|
14
15
|
(0, devkit_1.updateJson)(host, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.json'), (json) => {
|
|
15
16
|
var _a, _b, _c, _d;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-jest.js","sourceRoot":"","sources":["../../../../../../../packages/next/src/generators/application/lib/add-jest.ts"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"add-jest.js","sourceRoot":"","sources":["../../../../../../../packages/next/src/generators/application/lib/add-jest.ts"],"names":[],"mappings":";;;;AAAA,yCAMsB;AAEtB,sDAAoD;AAGpD,SAAsB,OAAO,CAAC,IAAU,EAAE,OAAyB;;QACjE,IAAI,OAAO,CAAC,cAAc,KAAK,MAAM,EAAE;YACrC,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC;SACjB;QAED,MAAM,EAAE,oBAAoB,EAAE,GAAG,IAAA,sBAAa,EAC5C,YAAY,EACZ,oBAAS,CACV,CAAC;QACF,MAAM,QAAQ,GAAG,MAAM,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AC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,gBAAgB,CAAC,CAAC;aACvE;YACD,OAAO,IAAI,CAAC;QACd,CAAC,CACF,CAAC;QAEF,OAAO,QAAQ,CAAC;IAClB,CAAC;CAAA;AAvDD,0BAuDC"}
|
|
@@ -4,8 +4,6 @@ exports.nextInitSchematic = exports.nextInitGenerator = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const devkit_1 = require("@nrwl/devkit");
|
|
6
6
|
const run_tasks_in_serial_1 = require("@nrwl/workspace/src/utilities/run-tasks-in-serial");
|
|
7
|
-
const jest_1 = require("@nrwl/jest");
|
|
8
|
-
const cypress_1 = require("@nrwl/cypress");
|
|
9
7
|
const versions_1 = require("@nrwl/react/src/utils/versions");
|
|
10
8
|
const init_1 = require("@nrwl/react/src/generators/init/init");
|
|
11
9
|
const js_1 = require("@nrwl/js");
|
|
@@ -27,11 +25,13 @@ function nextInitGenerator(host, schema) {
|
|
|
27
25
|
const tasks = [];
|
|
28
26
|
tasks.push(yield (0, js_1.initGenerator)(host, Object.assign(Object.assign({}, schema), { skipFormat: true })));
|
|
29
27
|
if (!schema.unitTestRunner || schema.unitTestRunner === 'jest') {
|
|
30
|
-
const
|
|
28
|
+
const { jestInitGenerator } = (0, devkit_1.ensurePackage)('@nrwl/jest', versions_2.nxVersion);
|
|
29
|
+
const jestTask = yield jestInitGenerator(host, schema);
|
|
31
30
|
tasks.push(jestTask);
|
|
32
31
|
}
|
|
33
32
|
if (!schema.e2eTestRunner || schema.e2eTestRunner === 'cypress') {
|
|
34
|
-
const
|
|
33
|
+
const { cypressInitGenerator } = (0, devkit_1.ensurePackage)('@nrwl/cypress', versions_2.nxVersion);
|
|
34
|
+
const cypressTask = yield cypressInitGenerator(host, {});
|
|
35
35
|
tasks.push(cypressTask);
|
|
36
36
|
}
|
|
37
37
|
const reactTask = yield (0, init_1.default)(host, schema);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../../../../packages/next/src/generators/init/init.ts"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../../../../packages/next/src/generators/init/init.ts"],"names":[],"mappings":";;;;AAAA,yCAMsB;AACtB,2FAAqF;AACrF,6DAA+E;AAC/E,+DAAsE;AACtE,iCAA4D;AAE5D,mDAK8B;AAE9B,yEAAoE;AAEpE,SAAS,kBAAkB,CAAC,IAAU;IACpC,OAAO,IAAA,qCAA4B,EACjC,IAAI,EACJ;QACE,YAAY,EAAE,oBAAS;QACvB,IAAI,EAAE,sBAAW;QACjB,KAAK,EAAE,uBAAY;QACnB,WAAW,EAAE,0BAAe;QAC5B,KAAK,EAAE,uBAAY;KACpB,EACD;QACE,oBAAoB,EAAE,kCAAuB;KAC9C,CACF,CAAC;AACJ,CAAC;AAED,SAAsB,iBAAiB,CAAC,IAAU,EAAE,MAAkB;;QACpE,MAAM,KAAK,GAAwB,EAAE,CAAC;QAEtC,KAAK,CAAC,IAAI,CACR,MAAM,IAAA,kBAAe,EAAC,IAAI,kCACrB,MAAM,KACT,UAAU,EAAE,IAAI,IAChB,CACH,CAAC;QAEF,IAAI,CAAC,MAAM,CAAC,cAAc,IAAI,MAAM,CAAC,cAAc,KAAK,MAAM,EAAE;YAC9D,MAAM,EAAE,iBAAiB,EAAE,GAAG,IAAA,sBAAa,EACzC,YAAY,EACZ,oBAAS,CACV,CAAC;YACF,MAAM,QAAQ,GAAG,MAAM,iBAAiB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;YACvD,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SACtB;QACD,IAAI,CAAC,MAAM,CAAC,aAAa,IAAI,MAAM,CAAC,aAAa,KAAK,SAAS,EAAE;YAC/D,MAAM,EAAE,oBAAoB,EAAE,GAAG,IAAA,sBAAa,EAE5C,eAAe,EAAE,oBAAS,CAAC,CAAC;YAC9B,MAAM,WAAW,GAAG,MAAM,oBAAoB,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YACzD,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;SACzB;QAED,MAAM,SAAS,GAAG,MAAM,IAAA,cAAkB,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACzD,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAEtB,MAAM,WAAW,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAC;QAC7C,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAExB,IAAA,uCAAiB,EAAC,IAAI,CAAC,CAAC;QAExB,OAAO,IAAA,sCAAgB,EAAC,GAAG,KAAK,CAAC,CAAC;IACpC,CAAC;CAAA;AAnCD,8CAmCC;AAED,kBAAe,iBAAiB,CAAC;AACpB,QAAA,iBAAiB,GAAG,IAAA,2BAAkB,EAAC,iBAAiB,CAAC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.update = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const devkit_1 = require("@nrwl/devkit");
|
|
6
|
+
function update(tree) {
|
|
7
|
+
var _a, _b;
|
|
8
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
9
|
+
const projects = (0, devkit_1.getProjects)(tree);
|
|
10
|
+
const missingDeps = {};
|
|
11
|
+
for (const [, config] of projects) {
|
|
12
|
+
if (((_b = (_a = config.targets) === null || _a === void 0 ? void 0 : _a.build) === null || _b === void 0 ? void 0 : _b.executor) === '@nrwl/next:build' &&
|
|
13
|
+
tree.exists((0, devkit_1.joinPathFragments)(config.root, 'next.config.js'))) {
|
|
14
|
+
const nextConfigContent = tree.read((0, devkit_1.joinPathFragments)(config.root, 'next.config.js'), 'utf-8');
|
|
15
|
+
if (nextConfigContent.includes('@nrwl/next/plugins/with-less')) {
|
|
16
|
+
missingDeps['less'] = '3.12.2';
|
|
17
|
+
}
|
|
18
|
+
if (nextConfigContent.includes('@nrwl/next/plugins/with-stylus')) {
|
|
19
|
+
missingDeps['stylus'] = '^0.55.0';
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return (0, devkit_1.addDependenciesToPackageJson)(tree, {}, missingDeps);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
exports.update = update;
|
|
27
|
+
exports.default = update;
|
|
28
|
+
//# sourceMappingURL=add-style-packages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-style-packages.js","sourceRoot":"","sources":["../../../../../../packages/next/src/migrations/update-15-8-8/add-style-packages.ts"],"names":[],"mappings":";;;;AAAA,yCAKsB;AAEtB,SAAsB,MAAM,CAAC,IAAU;;;QACrC,MAAM,QAAQ,GAAG,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;QACnC,MAAM,WAAW,GAAG,EAAE,CAAC;QAEvB,KAAK,MAAM,CAAC,EAAE,MAAM,CAAC,IAAI,QAAQ,EAAE;YACjC,IACE,CAAA,MAAA,MAAA,MAAM,CAAC,OAAO,0CAAE,KAAK,0CAAE,QAAQ,MAAK,kBAAkB;gBACtD,IAAI,CAAC,MAAM,CAAC,IAAA,0BAAiB,EAAC,MAAM,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC,EAC7D;gBACA,MAAM,iBAAiB,GAAG,IAAI,CAAC,IAAI,CACjC,IAAA,0BAAiB,EAAC,MAAM,CAAC,IAAI,EAAE,gBAAgB,CAAC,EAChD,OAAO,CACR,CAAC;gBAEF,IAAI,iBAAiB,CAAC,QAAQ,CAAC,8BAA8B,CAAC,EAAE;oBAC9D,WAAW,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC;iBAChC;gBAED,IAAI,iBAAiB,CAAC,QAAQ,CAAC,gCAAgC,CAAC,EAAE;oBAChE,WAAW,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;iBACnC;aACF;SACF;QAED,OAAO,IAAA,qCAA4B,EAAC,IAAI,EAAE,EAAE,EAAE,WAAW,CAAC,CAAC;;CAC5D;AAzBD,wBAyBC;AAED,kBAAe,MAAM,CAAC"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { DependentBuildableProjectNode } from '@nrwl/workspace/src/utilities/buildable-libs-utils';
|
|
2
|
-
import { ExecutorContext } from '@nrwl/devkit';
|
|
3
|
-
export declare function assertDependentProjectsHaveBeenBuilt(dependencies: DependentBuildableProjectNode[], context: ExecutorContext): void;
|
|
@@ -1,19 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.assertDependentProjectsHaveBeenBuilt = void 0;
|
|
4
|
-
const buildable_libs_utils_1 = require("@nrwl/workspace/src/utilities/buildable-libs-utils");
|
|
5
|
-
const chalk = require("chalk");
|
|
6
|
-
const devkit_1 = require("@nrwl/devkit");
|
|
7
|
-
function assertDependentProjectsHaveBeenBuilt(dependencies, context) {
|
|
8
|
-
const missing = (0, buildable_libs_utils_1.findMissingBuildDependencies)(context.root, context.projectName, context.targetName, dependencies);
|
|
9
|
-
if (missing.length > 0) {
|
|
10
|
-
throw new Error(chalk.red((0, devkit_1.stripIndents) `
|
|
11
|
-
Some of the project ${context.projectName}'s dependencies have not been built yet.
|
|
12
|
-
|
|
13
|
-
Please build these libraries first:
|
|
14
|
-
${missing.map((x) => ` - ${x.node.name}`).join('\n')}
|
|
15
|
-
`));
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
exports.assertDependentProjectsHaveBeenBuilt = assertDependentProjectsHaveBeenBuilt;
|
|
19
1
|
//# sourceMappingURL=buildable-libs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildable-libs.js","sourceRoot":"","sources":["../../../../../packages/next/src/utils/buildable-libs.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"buildable-libs.js","sourceRoot":"","sources":["../../../../../packages/next/src/utils/buildable-libs.ts"],"names":[],"mappings":""}
|
package/src/utils/config.d.ts
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import { ExecutorContext } from '@nrwl/devkit';
|
|
2
|
-
import type { PHASE_DEVELOPMENT_SERVER, PHASE_EXPORT, PHASE_PRODUCTION_BUILD, PHASE_PRODUCTION_SERVER } from 'next/dist/shared/lib/constants';
|
|
3
1
|
import { Configuration } from 'webpack';
|
|
4
|
-
import { FileReplacement
|
|
2
|
+
import { FileReplacement } from './types';
|
|
5
3
|
import { DependentBuildableProjectNode } from '@nrwl/workspace/src/utilities/buildable-libs-utils';
|
|
6
4
|
export declare function createWebpackConfig(workspaceRoot: string, projectRoot: string, fileReplacements?: FileReplacement[], assets?: any, dependencies?: DependentBuildableProjectNode[], libsDir?: string): (a: any, b: any) => Configuration;
|
|
7
|
-
export declare function prepareConfig(phase: typeof PHASE_PRODUCTION_BUILD | typeof PHASE_EXPORT | typeof PHASE_DEVELOPMENT_SERVER | typeof PHASE_PRODUCTION_SERVER, options: NextBuildBuilderOptions, context: ExecutorContext, dependencies: DependentBuildableProjectNode[], libsDir: string): Promise<any>;
|
package/src/utils/config.js
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const devkit_1 = require("@nrwl/devkit");
|
|
3
|
+
exports.createWebpackConfig = void 0;
|
|
6
4
|
const path_1 = require("path");
|
|
7
5
|
const tsconfig_paths_webpack_plugin_1 = require("tsconfig-paths-webpack-plugin");
|
|
8
|
-
const
|
|
6
|
+
const create_copy_plugin_1 = require("./create-copy-plugin");
|
|
9
7
|
const buildable_libs_utils_1 = require("@nrwl/workspace/src/utilities/buildable-libs-utils");
|
|
10
|
-
const loadConfig = require('next/dist/server/config').default;
|
|
11
8
|
function createWebpackConfig(workspaceRoot, projectRoot, fileReplacements = [], assets = null, dependencies = [], libsDir = '') {
|
|
12
|
-
return function webpackConfig(config, { isServer,
|
|
9
|
+
return function webpackConfig(config, { isServer, }) {
|
|
13
10
|
const mainFields = ['es2015', 'module', 'main'];
|
|
14
11
|
const extensions = ['.ts', '.tsx', '.mjs', '.js', '.jsx'];
|
|
15
12
|
let tsConfigPath = (0, path_1.join)(projectRoot, 'tsconfig.json');
|
|
@@ -32,55 +29,37 @@ function createWebpackConfig(workspaceRoot, projectRoot, fileReplacements = [],
|
|
|
32
29
|
alias[replacement.replace] = replacement.with;
|
|
33
30
|
return alias;
|
|
34
31
|
}, config.resolve.alias);
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
32
|
+
// Apply any rules that work on ts files to the libsDir as well
|
|
33
|
+
const rulesToAdd = [];
|
|
34
|
+
for (const r of config.module.rules) {
|
|
35
|
+
if (typeof r === 'string') {
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
if (isTsRule(r)) {
|
|
39
|
+
rulesToAdd.push(Object.assign(Object.assign({}, r), { include: [libsDir] }));
|
|
40
|
+
}
|
|
41
|
+
else if (r.oneOf && r.oneOf.find(isTsRule)) {
|
|
42
|
+
rulesToAdd.push(Object.assign(Object.assign({}, r), { oneOf: r.oneOf
|
|
43
|
+
.filter(isTsRule)
|
|
44
|
+
.map((subRule) => (Object.assign(Object.assign({}, subRule), { include: [libsDir] }))) }));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
config.module.rules.push(...rulesToAdd);
|
|
41
48
|
// Copy (shared) assets to `public` folder during client-side compilation
|
|
42
49
|
if (!isServer && Array.isArray(assets) && assets.length > 0) {
|
|
43
|
-
config.plugins.push((0,
|
|
50
|
+
config.plugins.push((0, create_copy_plugin_1.createCopyPlugin)(assets, workspaceRoot, projectRoot));
|
|
44
51
|
}
|
|
45
52
|
return config;
|
|
46
53
|
};
|
|
47
54
|
}
|
|
48
55
|
exports.createWebpackConfig = createWebpackConfig;
|
|
49
|
-
function
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
const userWebpack = config.webpack;
|
|
53
|
-
const userNextConfig = getConfigEnhancer(options.nextConfig, context.root);
|
|
54
|
-
// Yes, these do have different capitalisation...
|
|
55
|
-
const outputDir = `${(0, devkit_1.offsetFromRoot)(options.root)}${options.outputPath}`;
|
|
56
|
-
config.distDir =
|
|
57
|
-
config.distDir && config.distDir !== '.next'
|
|
58
|
-
? (0, devkit_1.joinPathFragments)(outputDir, config.distDir)
|
|
59
|
-
: (0, devkit_1.joinPathFragments)(outputDir, '.next');
|
|
60
|
-
config.webpack = (a, b) => createWebpackConfig(context.root, options.root, options.fileReplacements, options.assets, dependencies, libsDir)(userWebpack ? userWebpack(a, b) : a, b);
|
|
61
|
-
if (typeof userNextConfig !== 'function') {
|
|
62
|
-
throw new Error(`Module specified by 'nextConfig' option does not export a function. It should be of form 'module.exports = (phase, config, options) => config;'`);
|
|
63
|
-
}
|
|
64
|
-
return userNextConfig(phase, config, { options });
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
exports.prepareConfig = prepareConfig;
|
|
68
|
-
function getConfigEnhancer(pluginPath, workspaceRoot) {
|
|
69
|
-
if (!pluginPath) {
|
|
70
|
-
return (_, x) => x;
|
|
71
|
-
}
|
|
72
|
-
let fullPath;
|
|
73
|
-
try {
|
|
74
|
-
fullPath = require.resolve(pluginPath);
|
|
75
|
-
}
|
|
76
|
-
catch (_a) {
|
|
77
|
-
fullPath = (0, path_1.join)(workspaceRoot, pluginPath);
|
|
78
|
-
}
|
|
79
|
-
try {
|
|
80
|
-
return require(fullPath);
|
|
56
|
+
function isTsRule(r) {
|
|
57
|
+
if (typeof r === 'string') {
|
|
58
|
+
return false;
|
|
81
59
|
}
|
|
82
|
-
|
|
83
|
-
|
|
60
|
+
if (!(r.test instanceof RegExp)) {
|
|
61
|
+
return false;
|
|
84
62
|
}
|
|
63
|
+
return r.test.test('a.ts');
|
|
85
64
|
}
|
|
86
65
|
//# sourceMappingURL=config.js.map
|
package/src/utils/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../../packages/next/src/utils/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../../packages/next/src/utils/config.ts"],"names":[],"mappings":";;;AAAA,+BAAqC;AACrC,iFAAoE;AAGpE,6DAAwD;AACxD,6FAG4D;AAE5D,SAAgB,mBAAmB,CACjC,aAAqB,EACrB,WAAmB,EACnB,mBAAsC,EAAE,EACxC,SAAc,IAAI,EAClB,eAAgD,EAAE,EAClD,OAAO,GAAG,EAAE;IAEZ,OAAO,SAAS,aAAa,CAC3B,MAAqB,EACrB,EACE,QAAQ,GAKT;QAED,MAAM,UAAU,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;QAChD,MAAM,UAAU,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;QAC1D,IAAI,YAAY,GAAG,IAAA,WAAI,EAAC,WAAW,EAAE,eAAe,CAAC,CAAC;QACtD,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE;YAC3B,YAAY,GAAG,IAAA,wCAAiB,EAC9B,IAAA,WAAI,EAAC,aAAa,EAAE,YAAY,CAAC,EACjC,aAAa,EACb,WAAW,EACX,YAAY,CACb,CAAC;SACH;QAED,MAAM,CAAC,OAAO,CAAC,OAAO,GAAG;YACvB,IAAI,mDAAmB,CAAC;gBACtB,UAAU,EAAE,YAAY;gBACxB,UAAU;gBACV,UAAU;aACX,CAAU;SACZ,CAAC;QAEF,gBAAgB;aACb,GAAG,CAAC,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;YACzB,OAAO,EAAE,IAAA,cAAO,EAAC,aAAa,EAAE,eAAe,CA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M,EAAE,aAAa,EAAE,WAAW,CAAC,CAAC,CAAC;SAC3E;QAED,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC;AA1ED,kDA0EC;AAED,SAAS,QAAQ,CAAC,CAAc;IAC9B,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE;QACzB,OAAO,KAAK,CAAC;KACd;IACD,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,YAAY,MAAM,CAAC,EAAE;QAC/B,OAAO,KAAK,CAAC;KACd;IAED,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createCopyPlugin = void 0;
|
|
4
|
+
const CopyWebpackPlugin = require("copy-webpack-plugin");
|
|
5
|
+
const path_1 = require("nx/src/utils/path");
|
|
6
|
+
const path_2 = require("path");
|
|
7
|
+
const fs_1 = require("fs");
|
|
8
|
+
function normalizeAssets(assets, root, sourceRoot) {
|
|
9
|
+
return assets.map((asset) => {
|
|
10
|
+
if (typeof asset === 'string') {
|
|
11
|
+
const assetPath = (0, path_1.normalizePath)(asset);
|
|
12
|
+
const resolvedAssetPath = (0, path_2.resolve)(root, assetPath);
|
|
13
|
+
const resolvedSourceRoot = (0, path_2.resolve)(root, sourceRoot);
|
|
14
|
+
if (!resolvedAssetPath.startsWith(resolvedSourceRoot)) {
|
|
15
|
+
throw new Error(`The ${resolvedAssetPath} asset path must start with the project source root: ${sourceRoot}`);
|
|
16
|
+
}
|
|
17
|
+
const isDirectory = (0, fs_1.statSync)(resolvedAssetPath).isDirectory();
|
|
18
|
+
const input = isDirectory
|
|
19
|
+
? resolvedAssetPath
|
|
20
|
+
: (0, path_2.dirname)(resolvedAssetPath);
|
|
21
|
+
const output = (0, path_2.relative)(resolvedSourceRoot, (0, path_2.resolve)(root, input));
|
|
22
|
+
const glob = isDirectory ? '**/*' : (0, path_2.basename)(resolvedAssetPath);
|
|
23
|
+
return {
|
|
24
|
+
input,
|
|
25
|
+
output,
|
|
26
|
+
glob,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
if (asset.output.startsWith('..')) {
|
|
31
|
+
throw new Error('An asset cannot be written to a location outside of the output path.');
|
|
32
|
+
}
|
|
33
|
+
const assetPath = (0, path_1.normalizePath)(asset.input);
|
|
34
|
+
const resolvedAssetPath = (0, path_2.resolve)(root, assetPath);
|
|
35
|
+
return Object.assign(Object.assign({}, asset), { input: resolvedAssetPath,
|
|
36
|
+
// Now we remove starting slash to make Webpack place it from the output root.
|
|
37
|
+
output: asset.output.replace(/^\//, '') });
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
function createCopyPlugin(assets, root, sourceRoot) {
|
|
42
|
+
return new CopyWebpackPlugin({
|
|
43
|
+
patterns: normalizeAssets(assets, root, sourceRoot).map((asset) => {
|
|
44
|
+
var _a;
|
|
45
|
+
return {
|
|
46
|
+
context: asset.input,
|
|
47
|
+
to: (0, path_2.join)('../public', asset.output),
|
|
48
|
+
from: asset.glob,
|
|
49
|
+
globOptions: {
|
|
50
|
+
ignore: [
|
|
51
|
+
'.gitkeep',
|
|
52
|
+
'**/.DS_Store',
|
|
53
|
+
'**/Thumbs.db',
|
|
54
|
+
...((_a = asset.ignore) !== null && _a !== void 0 ? _a : []),
|
|
55
|
+
],
|
|
56
|
+
dot: true,
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
}),
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
exports.createCopyPlugin = createCopyPlugin;
|
|
63
|
+
//# sourceMappingURL=create-copy-plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-copy-plugin.js","sourceRoot":"","sources":["../../../../../packages/next/src/utils/create-copy-plugin.ts"],"names":[],"mappings":";;;AAA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K,CAAC,KAAK,CAAC,CAAC;YAC7C,MAAM,iBAAiB,GAAG,IAAA,cAAO,EAAC,IAAI,EAAE,SAAS,CAAC,CAAC;YACnD,uCACK,KAAK,KACR,KAAK,EAAE,iBAAiB;gBACxB,8EAA8E;gBAC9E,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,IACvC;SACH;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAgB,gBAAgB,CAC9B,MAAa,EACb,IAAY,EACZ,UAAkB;IAElB,OAAO,IAAI,iBAAiB,CAAC;QAC3B,QAAQ,EAAE,eAAe,CAAC,MAAM,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;;YAChE,OAAO;gBACL,OAAO,EAAE,KAAK,CAAC,KAAK;gBACpB,EAAE,EAAE,IAAA,WAAI,EAAC,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC;gBACnC,IAAI,EAAE,KAAK,CAAC,IAAI;gBAChB,WAAW,EAAE;oBACX,MAAM,EAAE;wBACN,UAAU;wBACV,cAAc;wBACd,cAAc;wBACd,GAAG,CAAC,MAAA,KAAK,CAAC,MAAM,mCAAI,EAAE,CAAC;qBACxB;oBACD,GAAG,EAAE,IAAI;iBACV;aACF,CAAC;QACJ,CAAC,CAAC;KACH,CAAC,CAAC;AACL,CAAC;AAvBD,4CAuBC"}
|
package/src/utils/styles.d.ts
CHANGED
|
@@ -25,11 +25,13 @@ export declare const NEXT_SPECIFIC_STYLE_DEPENDENCIES: {
|
|
|
25
25
|
less: {
|
|
26
26
|
dependencies: {};
|
|
27
27
|
devDependencies: {
|
|
28
|
+
less: string;
|
|
28
29
|
'less-loader': string;
|
|
29
30
|
};
|
|
30
31
|
};
|
|
31
32
|
styl: {
|
|
32
33
|
dependencies: {
|
|
34
|
+
stylus: string;
|
|
33
35
|
'stylus-loader': string;
|
|
34
36
|
};
|
|
35
37
|
devDependencies: {};
|