@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
package/migrations.json
CHANGED
|
@@ -53,6 +53,12 @@
|
|
|
53
53
|
"version": "14.5.3-beta.0",
|
|
54
54
|
"description": "Update development outputPath to the project root.",
|
|
55
55
|
"factory": "./src/migrations/update-14-5-3/update-dev-output-path"
|
|
56
|
+
},
|
|
57
|
+
"add-style-packages": {
|
|
58
|
+
"cli": "nx",
|
|
59
|
+
"version": "15.8.8-beta.0",
|
|
60
|
+
"description": "Add less and stylus packages if used.",
|
|
61
|
+
"factory": "./src/migrations/update-15-8-8/add-style-packages"
|
|
56
62
|
}
|
|
57
63
|
},
|
|
58
64
|
"packageJsonUpdates": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nrwl/next",
|
|
3
|
-
"version": "15.8.
|
|
3
|
+
"version": "15.8.8",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Next.js plugin for Nx contains executors and generators for managing Next.js applications and libraries within an Nx workspace. It provides:\n\n\n- Scaffolding for creating, building, serving, linting, and testing Next.js applications.\n\n- Integration with building, serving, and exporting a Next.js application.\n\n- Integration with React libraries within the workspace. \n\nWhen using Next.js in Nx, you get the out-of-the-box support for TypeScript, Cypress, and Jest. No need to configure anything: watch mode, source maps, and typings just work.",
|
|
6
6
|
"repository": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"Cypress",
|
|
17
17
|
"CLI"
|
|
18
18
|
],
|
|
19
|
-
"main": "./index
|
|
19
|
+
"main": "./index",
|
|
20
20
|
"typings": "./index.d.ts",
|
|
21
21
|
"author": "Victor Savkin",
|
|
22
22
|
"license": "MIT",
|
|
@@ -35,22 +35,23 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@babel/plugin-proposal-decorators": "^7.14.5",
|
|
38
|
-
"@nrwl/
|
|
39
|
-
"@nrwl/
|
|
40
|
-
"@nrwl/
|
|
41
|
-
"@nrwl/
|
|
42
|
-
"@nrwl/
|
|
43
|
-
"@nrwl/react": "15.8.6",
|
|
44
|
-
"@nrwl/webpack": "15.8.6",
|
|
45
|
-
"@nrwl/workspace": "15.8.6",
|
|
38
|
+
"@nrwl/devkit": "15.8.8",
|
|
39
|
+
"@nrwl/js": "15.8.8",
|
|
40
|
+
"@nrwl/linter": "15.8.8",
|
|
41
|
+
"@nrwl/react": "15.8.8",
|
|
42
|
+
"@nrwl/workspace": "15.8.8",
|
|
46
43
|
"@svgr/webpack": "^6.1.2",
|
|
47
44
|
"chalk": "^4.1.0",
|
|
45
|
+
"copy-webpack-plugin": "^10.2.4",
|
|
48
46
|
"dotenv": "~10.0.0",
|
|
47
|
+
"express": "^4.18.1",
|
|
49
48
|
"fs-extra": "^11.1.0",
|
|
49
|
+
"http-proxy-middleware": "^2.0.6",
|
|
50
50
|
"ignore": "^5.0.4",
|
|
51
51
|
"semver": "7.3.4",
|
|
52
52
|
"ts-node": "10.9.1",
|
|
53
53
|
"tsconfig-paths": "^4.1.2",
|
|
54
|
+
"tsconfig-paths-webpack-plugin": "4.0.0",
|
|
54
55
|
"url-loader": "^4.1.1",
|
|
55
56
|
"webpack-merge": "^5.8.0"
|
|
56
57
|
},
|
|
@@ -58,5 +59,5 @@
|
|
|
58
59
|
"access": "public"
|
|
59
60
|
},
|
|
60
61
|
"types": "./index.d.ts",
|
|
61
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "6711c0ba67e76c42673240ed40e7125d9a61a127"
|
|
62
63
|
}
|
package/plugins/with-less.d.ts
CHANGED
|
@@ -1,8 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
lessLoaderOptions?: {};
|
|
4
|
-
}): {
|
|
5
|
-
[x: string]: any;
|
|
6
|
-
} & {
|
|
7
|
-
webpack(config: any, opts: any): any;
|
|
8
|
-
};
|
|
1
|
+
import { NextConfigFn } from './with-nx';
|
|
2
|
+
export declare function withLess(configFn: NextConfigFn): NextConfigFn;
|
package/plugins/with-less.js
CHANGED
|
@@ -9,65 +9,67 @@ function patchNextCSSWithLess(nextCSSModule = require('next/dist/build/webpack/c
|
|
|
9
9
|
nextCSSModule.regexLikeCss = addLessToRegExp(nextCSSModule.regexLikeCss);
|
|
10
10
|
}
|
|
11
11
|
patchNextCSSWithLess();
|
|
12
|
-
function withLess(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
12
|
+
function withLess(configFn) {
|
|
13
|
+
return (phase) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
14
|
+
const _a = yield configFn(phase), { lessLoaderOptions = {} } = _a, nextConfig = tslib_1.__rest(_a, ["lessLoaderOptions"]);
|
|
15
|
+
return Object.assign({}, nextConfig, {
|
|
16
|
+
webpack(config, opts) {
|
|
17
|
+
// there are 2 relevant sass rules in next.js - css modules and global css
|
|
18
|
+
let sassModuleRule;
|
|
19
|
+
// global sass rule (does not exist in server builds)
|
|
20
|
+
let sassGlobalRule;
|
|
21
|
+
const cssRule = config.module.rules.find((rule) => { var _a; return (_a = rule.oneOf) === null || _a === void 0 ? void 0 : _a.find((r) => r === null || r === void 0 ? void 0 : r[Symbol.for('__next_css_remove')]); });
|
|
22
|
+
const addLessToRuleTest = (test) => {
|
|
23
|
+
if (Array.isArray(test)) {
|
|
24
|
+
return test.map((rx) => addLessToRegExp(rx));
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
return addLessToRegExp(test);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
cssRule.oneOf.forEach((rule) => {
|
|
31
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
32
|
+
if ((_a = rule.options) === null || _a === void 0 ? void 0 : _a.__next_css_remove)
|
|
33
|
+
return;
|
|
34
|
+
if (((_b = rule.use) === null || _b === void 0 ? void 0 : _b.loader) === 'error-loader') {
|
|
35
|
+
rule.test = addLessToRuleTest(rule.test);
|
|
36
|
+
}
|
|
37
|
+
else if ((_d = (_c = rule.use) === null || _c === void 0 ? void 0 : _c.loader) === null || _d === void 0 ? void 0 : _d.includes('file-loader')) {
|
|
38
|
+
rule.issuer = addLessToRuleTest(rule.issuer);
|
|
39
|
+
}
|
|
40
|
+
else if ((_f = (_e = rule.use) === null || _e === void 0 ? void 0 : _e.includes) === null || _f === void 0 ? void 0 : _f.call(_e, 'ignore-loader')) {
|
|
41
|
+
rule.test = addLessToRuleTest(rule.test);
|
|
42
|
+
}
|
|
43
|
+
else if (((_g = rule.test) === null || _g === void 0 ? void 0 : _g.source) === '\\.module\\.(scss|sass)$') {
|
|
44
|
+
sassModuleRule = rule;
|
|
45
|
+
}
|
|
46
|
+
else if (((_h = rule.test) === null || _h === void 0 ? void 0 : _h.source) === '(?<!\\.module)\\.(scss|sass)$') {
|
|
47
|
+
sassGlobalRule = rule;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
const lessLoader = {
|
|
51
|
+
loader: 'less-loader',
|
|
52
|
+
options: Object.assign(Object.assign({}, lessLoaderOptions), { lessOptions: Object.assign({ javascriptEnabled: true }, lessLoaderOptions.lessOptions) }),
|
|
53
|
+
};
|
|
54
|
+
let lessModuleRule = (0, webpack_merge_1.merge)(sassModuleRule);
|
|
55
|
+
const configureLessRule = (rule) => {
|
|
56
|
+
rule.test = new RegExp(rule.test.source.replace('(scss|sass)', 'less'));
|
|
57
|
+
// replace sass-loader (last entry) with less-loader
|
|
58
|
+
rule.use.splice(-1, 1, lessLoader);
|
|
59
|
+
};
|
|
60
|
+
configureLessRule(lessModuleRule);
|
|
61
|
+
cssRule.oneOf.splice(cssRule.oneOf.indexOf(sassModuleRule) + 1, 0, lessModuleRule);
|
|
62
|
+
if (sassGlobalRule) {
|
|
63
|
+
let lessGlobalRule = (0, webpack_merge_1.merge)(sassGlobalRule);
|
|
64
|
+
configureLessRule(lessGlobalRule);
|
|
65
|
+
cssRule.oneOf.splice(cssRule.oneOf.indexOf(sassGlobalRule) + 1, 0, lessGlobalRule);
|
|
24
66
|
}
|
|
25
|
-
|
|
26
|
-
return
|
|
67
|
+
if (typeof nextConfig.webpack === 'function') {
|
|
68
|
+
return nextConfig.webpack(config, opts);
|
|
27
69
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
if ((_a = rule.options) === null || _a === void 0 ? void 0 : _a.__next_css_remove)
|
|
32
|
-
return;
|
|
33
|
-
if (((_b = rule.use) === null || _b === void 0 ? void 0 : _b.loader) === 'error-loader') {
|
|
34
|
-
rule.test = addLessToRuleTest(rule.test);
|
|
35
|
-
}
|
|
36
|
-
else if ((_d = (_c = rule.use) === null || _c === void 0 ? void 0 : _c.loader) === null || _d === void 0 ? void 0 : _d.includes('file-loader')) {
|
|
37
|
-
rule.issuer = addLessToRuleTest(rule.issuer);
|
|
38
|
-
}
|
|
39
|
-
else if ((_f = (_e = rule.use) === null || _e === void 0 ? void 0 : _e.includes) === null || _f === void 0 ? void 0 : _f.call(_e, 'ignore-loader')) {
|
|
40
|
-
rule.test = addLessToRuleTest(rule.test);
|
|
41
|
-
}
|
|
42
|
-
else if (((_g = rule.test) === null || _g === void 0 ? void 0 : _g.source) === '\\.module\\.(scss|sass)$') {
|
|
43
|
-
sassModuleRule = rule;
|
|
44
|
-
}
|
|
45
|
-
else if (((_h = rule.test) === null || _h === void 0 ? void 0 : _h.source) === '(?<!\\.module)\\.(scss|sass)$') {
|
|
46
|
-
sassGlobalRule = rule;
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
const lessLoader = {
|
|
50
|
-
loader: 'less-loader',
|
|
51
|
-
options: Object.assign(Object.assign({}, lessLoaderOptions), { lessOptions: Object.assign({ javascriptEnabled: true }, lessLoaderOptions.lessOptions) }),
|
|
52
|
-
};
|
|
53
|
-
let lessModuleRule = (0, webpack_merge_1.merge)(sassModuleRule);
|
|
54
|
-
const configureLessRule = (rule) => {
|
|
55
|
-
rule.test = new RegExp(rule.test.source.replace('(scss|sass)', 'less'));
|
|
56
|
-
// replace sass-loader (last entry) with less-loader
|
|
57
|
-
rule.use.splice(-1, 1, lessLoader);
|
|
58
|
-
};
|
|
59
|
-
configureLessRule(lessModuleRule);
|
|
60
|
-
cssRule.oneOf.splice(cssRule.oneOf.indexOf(sassModuleRule) + 1, 0, lessModuleRule);
|
|
61
|
-
if (sassGlobalRule) {
|
|
62
|
-
let lessGlobalRule = (0, webpack_merge_1.merge)(sassGlobalRule);
|
|
63
|
-
configureLessRule(lessGlobalRule);
|
|
64
|
-
cssRule.oneOf.splice(cssRule.oneOf.indexOf(sassGlobalRule) + 1, 0, lessGlobalRule);
|
|
65
|
-
}
|
|
66
|
-
if (typeof nextConfig.webpack === 'function') {
|
|
67
|
-
return nextConfig.webpack(config, opts);
|
|
68
|
-
}
|
|
69
|
-
return config;
|
|
70
|
-
},
|
|
70
|
+
return config;
|
|
71
|
+
},
|
|
72
|
+
});
|
|
71
73
|
});
|
|
72
74
|
}
|
|
73
75
|
exports.withLess = withLess;
|
package/plugins/with-less.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"with-less.js","sourceRoot":"","sources":["../../../../packages/next/plugins/with-less.ts"],"names":[],"mappings":";;;;AAAA,wFAAwF;AACxF,iDAAsC;
|
|
1
|
+
{"version":3,"file":"with-less.js","sourceRoot":"","sources":["../../../../packages/next/plugins/with-less.ts"],"names":[],"mappings":";;;;AAAA,wFAAwF;AACxF,iDAAsC;AAGtC,MAAM,eAAe,GAAG,CAAC,EAAE,EAAE,EAAE,CAC7B,IAAI,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,YAAY,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC;AAEjE,SAAS,oBAAoB,CAC3B,gBAAqB,OAAO,CAAC,2CAA2C,CAAC;IAEzE,aAAa,CAAC,YAAY,GAAG,eAAe,CAAC,aAAa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C,CAAC,CAAC;gBAEF,iBAAiB,CAAC,cAAc,CAAC,CAAC;gBAClC,OAAO,CAAC,KAAK,CAAC,MAAM,CAClB,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC,EACzC,CAAC,EACD,cAAc,CACf,CAAC;gBAEF,IAAI,cAAc,EAAE;oBAClB,IAAI,cAAc,GAAG,IAAA,qBAAK,EAAC,cAAc,CAAC,CAAC;oBAC3C,iBAAiB,CAAC,cAAc,CAAC,CAAC;oBAClC,OAAO,CAAC,KAAK,CAAC,MAAM,CAClB,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC,EACzC,CAAC,EACD,cAAc,CACf,CAAC;iBACH;gBAED,IAAI,OAAO,UAAU,CAAC,OAAO,KAAK,UAAU,EAAE;oBAC5C,OAAO,UAAU,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;iBACzC;gBAED,OAAO,MAAM,CAAC;YAChB,CAAC;SACF,CAAC,CAAC;IACL,CAAC,CAAA,CAAC;AACJ,CAAC;AAtFD,4BAsFC;AAED,MAAM,CAAC,OAAO,GAAG,QAAQ,CAAC;AAC1B,MAAM,CAAC,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;AACnC,MAAM,CAAC,OAAO,CAAC,SAAS,GAAG,oBAAoB,CAAC"}
|
package/plugins/with-nx.d.ts
CHANGED
|
@@ -4,8 +4,12 @@ export interface WithNxOptions extends NextConfig {
|
|
|
4
4
|
svgr?: boolean;
|
|
5
5
|
};
|
|
6
6
|
}
|
|
7
|
+
export interface NextConfigFn {
|
|
8
|
+
(phase: string): Promise<NextConfig>;
|
|
9
|
+
}
|
|
7
10
|
export interface WithNxContext {
|
|
8
11
|
workspaceRoot: string;
|
|
9
12
|
libsDir: string;
|
|
10
13
|
}
|
|
11
|
-
export declare function withNx(
|
|
14
|
+
export declare function withNx(_nextConfig?: WithNxOptions, context?: WithNxContext): NextConfigFn;
|
|
15
|
+
export declare function getNextConfig(nextConfig?: WithNxOptions, context?: WithNxContext): NextConfig;
|
package/plugins/with-nx.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.withNx = void 0;
|
|
3
|
+
exports.getNextConfig = exports.withNx = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
+
const devkit_1 = require("@nrwl/devkit");
|
|
6
|
+
const buildable_libs_utils_1 = require("@nrwl/workspace/src/utilities/buildable-libs-utils");
|
|
7
|
+
const constants_1 = require("next/constants");
|
|
8
|
+
const path = require("path");
|
|
9
|
+
const config_1 = require("../src/utils/config");
|
|
5
10
|
function regexEqual(x, y) {
|
|
6
11
|
return (x instanceof RegExp &&
|
|
7
12
|
y instanceof RegExp &&
|
|
@@ -21,7 +26,102 @@ function getWithNxContext() {
|
|
|
21
26
|
libsDir: workspaceLayout().libsDir,
|
|
22
27
|
};
|
|
23
28
|
}
|
|
24
|
-
function
|
|
29
|
+
function getTargetConfig(graph, target) {
|
|
30
|
+
const projectNode = graph.nodes[target.project];
|
|
31
|
+
return projectNode.data.targets[target.target];
|
|
32
|
+
}
|
|
33
|
+
function getOptions(graph, target) {
|
|
34
|
+
const targetConfig = getTargetConfig(graph, target);
|
|
35
|
+
const options = targetConfig.options;
|
|
36
|
+
if (target.configuration) {
|
|
37
|
+
Object.assign(options, targetConfig.configurations[target.configuration]);
|
|
38
|
+
}
|
|
39
|
+
return options;
|
|
40
|
+
}
|
|
41
|
+
function getNxContext(graph, target) {
|
|
42
|
+
const targetConfig = getTargetConfig(graph, target);
|
|
43
|
+
if ('@nrwl/next:build' === targetConfig.executor) {
|
|
44
|
+
return {
|
|
45
|
+
node: graph.nodes[target.project],
|
|
46
|
+
options: getOptions(graph, target),
|
|
47
|
+
projectName: target.project,
|
|
48
|
+
targetName: target.target,
|
|
49
|
+
configurationName: target.configuration,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
const targetOptions = getOptions(graph, target);
|
|
53
|
+
// If we are running serve or export pull the options from the dependent target first (ex. build)
|
|
54
|
+
if (targetOptions.devServerTarget) {
|
|
55
|
+
const devServerTarget = (0, devkit_1.parseTargetString)(targetOptions.devServerTarget, graph);
|
|
56
|
+
return getNxContext(graph, devServerTarget);
|
|
57
|
+
}
|
|
58
|
+
else if (['@nrwl/next:server', '@nrwl/next:export'].includes(targetConfig.executor)) {
|
|
59
|
+
const buildTarget = (0, devkit_1.parseTargetString)(targetOptions.buildTarget, graph);
|
|
60
|
+
return getNxContext(graph, buildTarget);
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
throw new Error('Could not determine the config for this Next application.');
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Try to read output dir from project, and default to '.next' if executing outside of Nx (e.g. dist is added to a docker image).
|
|
68
|
+
*/
|
|
69
|
+
function determineDistDirForProdServer(nextConfig) {
|
|
70
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
71
|
+
const project = process.env.NX_TASK_TARGET_PROJECT;
|
|
72
|
+
const target = process.env.NX_TASK_TARGET_TARGET;
|
|
73
|
+
const configuration = process.env.NX_TASK_TARGET_CONFIGURATION;
|
|
74
|
+
if (project && target) {
|
|
75
|
+
const originalTarget = { project, target, configuration };
|
|
76
|
+
const graph = yield (0, devkit_1.createProjectGraphAsync)();
|
|
77
|
+
const { options, node: projectNode } = getNxContext(graph, originalTarget);
|
|
78
|
+
const outputDir = `${(0, devkit_1.offsetFromRoot)(projectNode.data.root)}${options.outputPath}`;
|
|
79
|
+
return nextConfig.distDir && nextConfig.distDir !== '.next'
|
|
80
|
+
? (0, devkit_1.joinPathFragments)(outputDir, nextConfig.distDir)
|
|
81
|
+
: (0, devkit_1.joinPathFragments)(outputDir, '.next');
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
return '.next';
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
function withNx(_nextConfig = {}, context = getWithNxContext()) {
|
|
89
|
+
return (phase) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
90
|
+
if (phase === constants_1.PHASE_PRODUCTION_SERVER) {
|
|
91
|
+
// If we are running an already built production server, just return the configuration.
|
|
92
|
+
const { nx } = _nextConfig, validNextConfig = tslib_1.__rest(_nextConfig, ["nx"]);
|
|
93
|
+
return Object.assign(Object.assign({}, validNextConfig), { distDir: yield determineDistDirForProdServer(validNextConfig) });
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
// Otherwise, add in webpack and eslint configuration for build or test.
|
|
97
|
+
let dependencies = [];
|
|
98
|
+
const graph = yield (0, devkit_1.createProjectGraphAsync)();
|
|
99
|
+
const originalTarget = {
|
|
100
|
+
project: process.env.NX_TASK_TARGET_PROJECT,
|
|
101
|
+
target: process.env.NX_TASK_TARGET_TARGET,
|
|
102
|
+
configuration: process.env.NX_TASK_TARGET_CONFIGURATION,
|
|
103
|
+
};
|
|
104
|
+
const { node: projectNode, options, projectName: project, targetName, configurationName, } = getNxContext(graph, originalTarget);
|
|
105
|
+
const projectDirectory = projectNode.data.root;
|
|
106
|
+
if (options.buildLibsFromSource === false && targetName) {
|
|
107
|
+
const result = (0, buildable_libs_utils_1.calculateProjectDependencies)(graph, devkit_1.workspaceRoot, project, targetName, configurationName);
|
|
108
|
+
dependencies = result.dependencies;
|
|
109
|
+
}
|
|
110
|
+
// Get next config
|
|
111
|
+
const nextConfig = getNextConfig(_nextConfig, context);
|
|
112
|
+
const outputDir = `${(0, devkit_1.offsetFromRoot)(projectDirectory)}${options.outputPath}`;
|
|
113
|
+
nextConfig.distDir =
|
|
114
|
+
nextConfig.distDir && nextConfig.distDir !== '.next'
|
|
115
|
+
? (0, devkit_1.joinPathFragments)(outputDir, nextConfig.distDir)
|
|
116
|
+
: (0, devkit_1.joinPathFragments)(outputDir, '.next');
|
|
117
|
+
const userWebpackConfig = nextConfig.webpack;
|
|
118
|
+
nextConfig.webpack = (a, b) => (0, config_1.createWebpackConfig)(devkit_1.workspaceRoot, options.root, options.fileReplacements, options.assets, dependencies, path.join(devkit_1.workspaceRoot, context.libsDir))(userWebpackConfig ? userWebpackConfig(a, b) : a, b);
|
|
119
|
+
return nextConfig;
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
exports.withNx = withNx;
|
|
124
|
+
function getNextConfig(nextConfig = {}, context = getWithNxContext()) {
|
|
25
125
|
var _a;
|
|
26
126
|
// If `next-compose-plugins` is used, the context argument is invalid.
|
|
27
127
|
if (!context.libsDir || !context.workspaceRoot) {
|
|
@@ -147,7 +247,7 @@ function withNx(nextConfig = {}, context = getWithNxContext()) {
|
|
|
147
247
|
return userWebpack(config, options);
|
|
148
248
|
} });
|
|
149
249
|
}
|
|
150
|
-
exports.
|
|
250
|
+
exports.getNextConfig = getNextConfig;
|
|
151
251
|
function getNxEnvironmentVariables() {
|
|
152
252
|
return Object.keys(process.env)
|
|
153
253
|
.filter((env) => /^NX_/i.test(env))
|
|
@@ -174,4 +274,5 @@ function addNxEnvVariables(config) {
|
|
|
174
274
|
module.exports = withNx;
|
|
175
275
|
// Support for newer generated code: `const { withNx } = require(...);`
|
|
176
276
|
module.exports.withNx = withNx;
|
|
277
|
+
module.exports.getNextConfig = getNextConfig;
|
|
177
278
|
//# sourceMappingURL=with-nx.js.map
|
package/plugins/with-nx.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"with-nx.js","sourceRoot":"","sources":["../../../../packages/next/plugins/with-nx.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"with-nx.js","sourceRoot":"","sources":["../../../../packages/next/plugins/with-nx.ts"],"names":[],"mappings":";;;;AAAA,yCASsB;AACtB,6FAG4D;AAE5D,8CAAyD;AAEzD,6BAA6B;AAC7B,gDAA0D;AAkB1D,SAAS,UAAU,CAAC,CAAC,EAA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I,KAAK,GAAG,CAAC,CAAC;aAC7D,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,iBAAiB,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;aACxD,OAAO,CACN,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,iBAAiB,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,CACjE,CAAC;KACL;AACH,CAAC;AAED,4FAA4F;AAC5F,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC;AACxB,uEAAuE;AACvE,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC;AAC/B,MAAM,CAAC,OAAO,CAAC,aAAa,GAAG,aAAa,CAAC"}
|
package/plugins/with-stylus.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { NextConfigFn } from './with-nx';
|
|
2
|
+
export declare function withStylus(configFn: NextConfigFn): NextConfigFn;
|
package/plugins/with-stylus.js
CHANGED
|
@@ -9,65 +9,67 @@ function patchNextCSSWithStylus(nextCSSModule = require('next/dist/build/webpack
|
|
|
9
9
|
nextCSSModule.regexLikeCss = addStylusToRegExp(nextCSSModule.regexLikeCss);
|
|
10
10
|
}
|
|
11
11
|
patchNextCSSWithStylus();
|
|
12
|
-
function withStylus(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
12
|
+
function withStylus(configFn) {
|
|
13
|
+
return (phase) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
14
|
+
const _a = yield configFn(phase), { stylusLoaderOptions = {} } = _a, nextConfig = tslib_1.__rest(_a, ["stylusLoaderOptions"]);
|
|
15
|
+
return Object.assign({}, nextConfig, {
|
|
16
|
+
webpack(config, opts) {
|
|
17
|
+
// there are 2 relevant sass rules in next.js - css modules and global css
|
|
18
|
+
let sassModuleRule;
|
|
19
|
+
// global sass rule (does not exist in server builds)
|
|
20
|
+
let sassGlobalRule;
|
|
21
|
+
const cssRule = config.module.rules.find((rule) => { var _a; return (_a = rule.oneOf) === null || _a === void 0 ? void 0 : _a.find((r) => r === null || r === void 0 ? void 0 : r[Symbol.for('__next_css_remove')]); });
|
|
22
|
+
const addStylusRuleToTest = (test) => {
|
|
23
|
+
if (Array.isArray(test)) {
|
|
24
|
+
return test.map((rx) => addStylusToRegExp(rx));
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
return addStylusToRegExp(test);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
cssRule.oneOf.forEach((rule) => {
|
|
31
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
32
|
+
if ((_a = rule.options) === null || _a === void 0 ? void 0 : _a.__next_css_remove)
|
|
33
|
+
return;
|
|
34
|
+
if (((_b = rule.use) === null || _b === void 0 ? void 0 : _b.loader) === 'error-loader') {
|
|
35
|
+
rule.test = addStylusRuleToTest(rule.test);
|
|
36
|
+
}
|
|
37
|
+
else if ((_d = (_c = rule.use) === null || _c === void 0 ? void 0 : _c.loader) === null || _d === void 0 ? void 0 : _d.includes('file-loader')) {
|
|
38
|
+
rule.issuer = addStylusRuleToTest(rule.issuer);
|
|
39
|
+
}
|
|
40
|
+
else if ((_f = (_e = rule.use) === null || _e === void 0 ? void 0 : _e.includes) === null || _f === void 0 ? void 0 : _f.call(_e, 'ignore-loader')) {
|
|
41
|
+
rule.test = addStylusRuleToTest(rule.test);
|
|
42
|
+
}
|
|
43
|
+
else if (((_g = rule.test) === null || _g === void 0 ? void 0 : _g.source) === '\\.module\\.(scss|sass)$') {
|
|
44
|
+
sassModuleRule = rule;
|
|
45
|
+
}
|
|
46
|
+
else if (((_h = rule.test) === null || _h === void 0 ? void 0 : _h.source) === '(?<!\\.module)\\.(scss|sass)$') {
|
|
47
|
+
sassGlobalRule = rule;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
const stylusLoader = {
|
|
51
|
+
loader: 'stylus-loader',
|
|
52
|
+
options: Object.assign(Object.assign({}, stylusLoaderOptions), { stylusOptions: Object.assign({ javascriptEnabled: true }, stylusLoaderOptions.stylusOptions) }),
|
|
53
|
+
};
|
|
54
|
+
let stylusModuleRule = (0, webpack_merge_1.merge)({}, sassModuleRule);
|
|
55
|
+
const configureStylusRule = (rule) => {
|
|
56
|
+
rule.test = new RegExp(rule.test.source.replace('(scss|sass)', 'styl'));
|
|
57
|
+
// replace sass-loader (last entry) with stylus-loader
|
|
58
|
+
rule.use.splice(-1, 1, stylusLoader);
|
|
59
|
+
};
|
|
60
|
+
configureStylusRule(stylusModuleRule);
|
|
61
|
+
cssRule.oneOf.splice(cssRule.oneOf.indexOf(sassModuleRule) + 1, 0, stylusModuleRule);
|
|
62
|
+
if (sassGlobalRule) {
|
|
63
|
+
let stylusGlobalRule = (0, webpack_merge_1.merge)({}, sassGlobalRule);
|
|
64
|
+
configureStylusRule(stylusGlobalRule);
|
|
65
|
+
cssRule.oneOf.splice(cssRule.oneOf.indexOf(sassGlobalRule) + 1, 0, stylusGlobalRule);
|
|
24
66
|
}
|
|
25
|
-
|
|
26
|
-
return
|
|
67
|
+
if (typeof nextConfig.webpack === 'function') {
|
|
68
|
+
return nextConfig.webpack(config, opts);
|
|
27
69
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
if ((_a = rule.options) === null || _a === void 0 ? void 0 : _a.__next_css_remove)
|
|
32
|
-
return;
|
|
33
|
-
if (((_b = rule.use) === null || _b === void 0 ? void 0 : _b.loader) === 'error-loader') {
|
|
34
|
-
rule.test = addStylusRuleToTest(rule.test);
|
|
35
|
-
}
|
|
36
|
-
else if ((_d = (_c = rule.use) === null || _c === void 0 ? void 0 : _c.loader) === null || _d === void 0 ? void 0 : _d.includes('file-loader')) {
|
|
37
|
-
rule.issuer = addStylusRuleToTest(rule.issuer);
|
|
38
|
-
}
|
|
39
|
-
else if ((_f = (_e = rule.use) === null || _e === void 0 ? void 0 : _e.includes) === null || _f === void 0 ? void 0 : _f.call(_e, 'ignore-loader')) {
|
|
40
|
-
rule.test = addStylusRuleToTest(rule.test);
|
|
41
|
-
}
|
|
42
|
-
else if (((_g = rule.test) === null || _g === void 0 ? void 0 : _g.source) === '\\.module\\.(scss|sass)$') {
|
|
43
|
-
sassModuleRule = rule;
|
|
44
|
-
}
|
|
45
|
-
else if (((_h = rule.test) === null || _h === void 0 ? void 0 : _h.source) === '(?<!\\.module)\\.(scss|sass)$') {
|
|
46
|
-
sassGlobalRule = rule;
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
const stylusLoader = {
|
|
50
|
-
loader: 'stylus-loader',
|
|
51
|
-
options: Object.assign(Object.assign({}, stylusLoaderOptions), { stylusOptions: Object.assign({ javascriptEnabled: true }, stylusLoaderOptions.stylusOptions) }),
|
|
52
|
-
};
|
|
53
|
-
let stylusModuleRule = (0, webpack_merge_1.merge)({}, sassModuleRule);
|
|
54
|
-
const configureStylusRule = (rule) => {
|
|
55
|
-
rule.test = new RegExp(rule.test.source.replace('(scss|sass)', 'styl'));
|
|
56
|
-
// replace sass-loader (last entry) with stylus-loader
|
|
57
|
-
rule.use.splice(-1, 1, stylusLoader);
|
|
58
|
-
};
|
|
59
|
-
configureStylusRule(stylusModuleRule);
|
|
60
|
-
cssRule.oneOf.splice(cssRule.oneOf.indexOf(sassModuleRule) + 1, 0, stylusModuleRule);
|
|
61
|
-
if (sassGlobalRule) {
|
|
62
|
-
let stylusGlobalRule = (0, webpack_merge_1.merge)({}, sassGlobalRule);
|
|
63
|
-
configureStylusRule(stylusGlobalRule);
|
|
64
|
-
cssRule.oneOf.splice(cssRule.oneOf.indexOf(sassGlobalRule) + 1, 0, stylusGlobalRule);
|
|
65
|
-
}
|
|
66
|
-
if (typeof nextConfig.webpack === 'function') {
|
|
67
|
-
return nextConfig.webpack(config, opts);
|
|
68
|
-
}
|
|
69
|
-
return config;
|
|
70
|
-
},
|
|
70
|
+
return config;
|
|
71
|
+
},
|
|
72
|
+
});
|
|
71
73
|
});
|
|
72
74
|
}
|
|
73
75
|
exports.withStylus = withStylus;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"with-stylus.js","sourceRoot":"","sources":["../../../../packages/next/plugins/with-stylus.ts"],"names":[],"mappings":";;;;AAAA,wFAAwF;AACxF,iDAAsC;
|
|
1
|
+
{"version":3,"file":"with-stylus.js","sourceRoot":"","sources":["../../../../packages/next/plugins/with-stylus.ts"],"names":[],"mappings":";;;;AAAA,wFAAwF;AACxF,iDAAsC;AAGtC,MAAM,iBAAiB,GAAG,CAAC,EAAE,EAAE,EAAE,CAC/B,IAAI,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,YAAY,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC;AAEjE,SAAS,sBAAsB,CAC7B,gBAAgB,OAAO,CAAC,2CAA2C,CAAQ;IAE3E,aAAa,CAAC,YAAY,GAAG,iBAAiB,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;AAC7E,CAAC;AAED,sBAAsB,EAAE,CAAC;AAEzB,SAAgB,UAAU,CAAC,QAAsB;IAC/C,OAAO,CAAO,KAAa,EAAE,EAAE;QAC7B,MAAM,KAA8C,MAAM,QAAQ,CAAC,KAAK,CAAC,EAAnE,EAAE,mBAAmB,GAAG,EAAE,OAAyC,EAApC,UAAU,sBAAzC,uBAA2C,CAAwB,CAAC;QAE1E,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,UAAU,EAAE;YACnC,OAAO,CAAC,MAAM,EAAE,IAAI;gBAClB,0EAA0E;gBAC1E,IAAI,cAAc,CAAC;gBACnB,qDAAqD;gBACrD,IAAI,cAAc,CAAC;gBAEnB,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAA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AAC,OAAO,KAAK,UAAU,EAAE;oBAC5C,OAAO,UAAU,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;iBACzC;gBAED,OAAO,MAAM,CAAC;YAChB,CAAC;SACF,CAAC,CAAC;IACL,CAAC,CAAA,CAAC;AACJ,CAAC;AArFD,gCAqFC;AAED,MAAM,CAAC,OAAO,GAAG,UAAU,CAAC;AAC5B,MAAM,CAAC,OAAO,CAAC,UAAU,GAAG,UAAU,CAAC;AACvC,MAAM,CAAC,OAAO,CAAC,SAAS,GAAG,sBAAsB,CAAC"}
|
|
@@ -9,13 +9,10 @@ const path_1 = require("path");
|
|
|
9
9
|
const fs_extra_1 = require("fs-extra");
|
|
10
10
|
const semver_1 = require("semver");
|
|
11
11
|
const fileutils_1 = require("@nrwl/workspace/src/utilities/fileutils");
|
|
12
|
-
const
|
|
13
|
-
const version_utils_1 = require("@nrwl/workspace/src/utilities/version-utils");
|
|
14
|
-
const config_1 = require("../../utils/config");
|
|
12
|
+
const version_utils_1 = require("@nrwl/workspace/src/utils/version-utils");
|
|
15
13
|
const update_package_json_1 = require("./lib/update-package-json");
|
|
16
14
|
const create_next_config_file_1 = require("./lib/create-next-config-file");
|
|
17
15
|
const check_project_1 = require("./lib/check-project");
|
|
18
|
-
const constants_1 = require("../../utils/constants");
|
|
19
16
|
const lock_file_1 = require("nx/src/lock-file/lock-file");
|
|
20
17
|
function buildExecutor(options, context) {
|
|
21
18
|
var _a, _b, _c;
|
|
@@ -23,14 +20,8 @@ function buildExecutor(options, context) {
|
|
|
23
20
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
24
21
|
// Cast to any to overwrite NODE_ENV
|
|
25
22
|
(_d = process.env).NODE_ENV || (_d.NODE_ENV = 'production');
|
|
26
|
-
let dependencies = [];
|
|
27
23
|
const root = (0, path_1.resolve)(context.root, options.root);
|
|
28
|
-
const libsDir = (0, path_1.join)(context.root, (0, devkit_1.workspaceLayout)().libsDir);
|
|
29
24
|
(0, check_project_1.checkPublicDirectory)(root);
|
|
30
|
-
if (!options.buildLibsFromSource && context.targetName) {
|
|
31
|
-
const result = (0, buildable_libs_utils_1.calculateProjectDependencies)(context.projectGraph, context.root, context.projectName, context.targetName, context.configurationName);
|
|
32
|
-
dependencies = result.dependencies;
|
|
33
|
-
}
|
|
34
25
|
// Set `__NEXT_REACT_ROOT` based on installed ReactDOM version
|
|
35
26
|
const packageJsonPath = (0, path_1.join)(root, 'package.json');
|
|
36
27
|
const packageJson = (0, fs_extra_1.existsSync)(packageJsonPath)
|
|
@@ -43,8 +34,7 @@ function buildExecutor(options, context) {
|
|
|
43
34
|
if (hasReact18) {
|
|
44
35
|
(_e = process.env).__NEXT_REACT_ROOT || (_e.__NEXT_REACT_ROOT = 'true');
|
|
45
36
|
}
|
|
46
|
-
|
|
47
|
-
yield (0, build_1.default)(root, config);
|
|
37
|
+
yield (0, build_1.default)(root);
|
|
48
38
|
if (!(0, fileutils_1.directoryExists)(options.outputPath)) {
|
|
49
39
|
(0, fs_extra_1.mkdir)(options.outputPath);
|
|
50
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.impl.js","sourceRoot":"","sources":["../../../../../../packages/next/src/executors/build/build.impl.ts"],"names":[],"mappings":";;;AAAA,yBAAuB;AACvB,
|
|
1
|
+
{"version":3,"file":"build.impl.js","sourceRoot":"","sources":["../../../../../../packages/next/src/executors/build/build.impl.ts"],"names":[],"mappings":";;;AAAA,yBAAuB;AACvB,yCAKsB;AACtB,iCAA6D;AAC7D,2CAAoC;AACpC,+BAAqC;AACrC,uCAAsE;AACtE,mCAA6B;AAC7B,uEAA0E;AAC1E,2EAAkF;AAElF,mEAA8D;AAC9D,2EAAqE;AACrE,uDAA2D;AAG3D,0DAA6D;AAE7D,SAA8B,aAAa,CACzC,OAAgC,EAChC,OAAwB;;;;QAExB,oCAAoC;QACpC,MAAC,OAAO,CAAC,GAAW,EAAC,QAAQ,QAAR,QAAQ,GAAK,YAA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CACF,CAAC;QACF,IAAA,uCAAiB,EAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;QAC7C,IAAA,sBAAa,EAAC,GAAG,OAAO,CAAC,UAAU,eAAe,EAAE,gBAAgB,CAAC,CAAC;QAEtE,IAAI,OAAO,CAAC,gBAAgB,EAAE;YAC5B,MAAM,QAAQ,GAAG,IAAA,mBAAc,EAAC,gBAAgB,CAAC,CAAC;YAClD,IAAA,wBAAa,EAAC,GAAG,OAAO,CAAC,UAAU,IAAI,IAAA,2BAAe,GAAE,EAAE,EAAE,QAAQ,EAAE;gBACpE,QAAQ,EAAE,OAAO;aAClB,CAAC,CAAC;SACJ;QAED,IAAA,8CAAoB,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAEvC,IAAA,mBAAQ,EAAC,IAAA,WAAI,EAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,IAAA,WAAI,EAAC,OAAO,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC;QAEnE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;CAC1B;AAxDD,gCAwDC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ExecutorContext } from '@nrwl/devkit';
|
|
2
2
|
import type { NextBuildBuilderOptions } from '../../../utils/types';
|
|
3
3
|
export declare function createNextConfigFile(options: NextBuildBuilderOptions, context: ExecutorContext): void;
|