@nrwl/next 15.8.7 → 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 +4 -1
- package/plugins/with-nx.js +54 -23
- 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/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/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.js +2 -2
- 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/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.7",
|
|
44
|
-
"@nrwl/webpack": "15.8.7",
|
|
45
|
-
"@nrwl/workspace": "15.8.7",
|
|
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,CAAC,YAAY,CAAC,CAAC;AAC3E,CAAC;AAED,oBAAoB,EAAE,CAAC;AAEvB,SAAgB,QAAQ,CAAC,QAAsB;IAC7C,OAAO,CAAO,KAAa,EAAE,EAAE;QAC7B,MAAM,KAA4C,MAAM,QAAQ,CAAC,KAAK,CAAC,EAAjE,EAAE,iBAAiB,GAAG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E;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,9 +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(_nextConfig?: WithNxOptions, context?: WithNxContext):
|
|
14
|
+
export declare function withNx(_nextConfig?: WithNxOptions, context?: WithNxContext): NextConfigFn;
|
|
12
15
|
export declare function getNextConfig(nextConfig?: WithNxOptions, context?: WithNxContext): NextConfig;
|
package/plugins/with-nx.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.getNextConfig = exports.withNx = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const devkit_1 = require("@nrwl/devkit");
|
|
6
6
|
const buildable_libs_utils_1 = require("@nrwl/workspace/src/utilities/buildable-libs-utils");
|
|
7
|
+
const constants_1 = require("next/constants");
|
|
7
8
|
const path = require("path");
|
|
8
9
|
const config_1 = require("../src/utils/config");
|
|
9
10
|
function regexEqual(x, y) {
|
|
@@ -62,31 +63,61 @@ function getNxContext(graph, target) {
|
|
|
62
63
|
throw new Error('Could not determine the config for this Next application.');
|
|
63
64
|
}
|
|
64
65
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
// Get next config
|
|
81
|
-
const nextConfig = getNextConfig(_nextConfig, context);
|
|
82
|
-
const outputDir = `${(0, devkit_1.offsetFromRoot)(projectDirectory)}${options.outputPath}`;
|
|
83
|
-
nextConfig.distDir =
|
|
84
|
-
nextConfig.distDir && nextConfig.distDir !== '.next'
|
|
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'
|
|
85
80
|
? (0, devkit_1.joinPathFragments)(outputDir, nextConfig.distDir)
|
|
86
81
|
: (0, devkit_1.joinPathFragments)(outputDir, '.next');
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
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
|
+
}
|
|
90
121
|
});
|
|
91
122
|
}
|
|
92
123
|
exports.withNx = withNx;
|
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":";;;;AAAA,yCASsB;AACtB,6FAG4D;
|
|
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,EAAE,CAAC;IACtB,OAAO,CACL,CAAC,YAAY,MAAM;QACnB,CAAC,YAAY,MAAM;QACnB,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;QACrB,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;QACrB,CAAC,CAAC,UAAU,KAAK,CAAC,CAAC,UAAU;QAC7B,CAAC,CAAC,SAAS,KAAK,CAAC,CAAC,SAAS,CAC5B,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,SAAS,gBAAgB;IACvB,MAAM,EAAE,aAAa,EAAE,eAAe,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;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/plug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AAC"}
|
|
@@ -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;
|
|
@@ -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"}
|
|
@@ -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,oBAAoB,CAAC,IAAI,kCAC3C,OAAO,KACV,OAAO,EAAE,OAAO,CAAC,WAAW,EAC5B,UAAU,EAAE,IAAI,EAChB,eAAe,EAAE,IAAI,EACrB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,OAAO,IACjB,CAAC;QAEH,MAAM,gBAAgB,GAAG,IAAA,iBAAQ,EAC/B,IAAI,EACJ,IAAA,0BAAiB,EAAC,OAAO,CAAC,cAAc,EAAE,oBAAoB,CAAC,CAChE,CAAC;QAEF,IAAA,mBAAU,EACR,IAAI,EACJ,IAAA,0BAAiB,EAAC,OAAO,CAAC,cAAc,EAAE,eAAe,CAAC,EAC1D,CAAC,IAAI,EAAE,EAAE;;;YACP,MAAA,IAAI,CAAC,eAAe,oCAApB,IAAI,CAAC,eAAe,GAAK,EAAE,EAAC;YAC5B,YAAA,IAAI,CAAC,eAAe,EAAC,KAAK,uCAAL,KAAK,GAAK,EAAE,EAAC;YAClC,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,IAAI,CAC7B,GAAG,CAAC,MAAA,MAAA,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,eAAe,0CAAE,KAAK,mCAAI,EAAE,CAAC,CACpD,CAAC;YAEF,OAAO,IAAI,CAAC;QACd,CAAC,CACF,CAAC;QAEF,IAAA,mBAAU,EACR,IAAI,EACJ,IAAA,0BAAiB,EAAC,OAAO,CAAC,cAAc,EAAE,oBAAoB,CAAC,EAC/D,CAAC,IAAI,EAAE,EAAE;YACP,IAAI,CAAC,eAAe,CAAC,GAAG,GAAG,OAAO,CAAC;YACnC,oGAAoG;YACpG,IAAI,OAAO,CAAC,uBAAuB,EAAE;gBACnC,MAAM,QAAQ,GAAG,IAAA,iBAAQ,EACvB,IAAI,EACJ,IAAA,0BAAiB,EAAC,OAAO,CAAC,cAAc,EAAE,eAAe,CAAC,CAC3D,CAAC;gBACF,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,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,CAC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
|
|
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.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createWebpackConfig = void 0;
|
|
4
4
|
const path_1 = require("path");
|
|
5
5
|
const tsconfig_paths_webpack_plugin_1 = require("tsconfig-paths-webpack-plugin");
|
|
6
|
-
const
|
|
6
|
+
const create_copy_plugin_1 = require("./create-copy-plugin");
|
|
7
7
|
const buildable_libs_utils_1 = require("@nrwl/workspace/src/utilities/buildable-libs-utils");
|
|
8
8
|
function createWebpackConfig(workspaceRoot, projectRoot, fileReplacements = [], assets = null, dependencies = [], libsDir = '') {
|
|
9
9
|
return function webpackConfig(config, { isServer, }) {
|
|
@@ -47,7 +47,7 @@ function createWebpackConfig(workspaceRoot, projectRoot, fileReplacements = [],
|
|
|
47
47
|
config.module.rules.push(...rulesToAdd);
|
|
48
48
|
// Copy (shared) assets to `public` folder during client-side compilation
|
|
49
49
|
if (!isServer && Array.isArray(assets) && assets.length > 0) {
|
|
50
|
-
config.plugins.push((0,
|
|
50
|
+
config.plugins.push((0, create_copy_plugin_1.createCopyPlugin)(assets, workspaceRoot, projectRoot));
|
|
51
51
|
}
|
|
52
52
|
return config;
|
|
53
53
|
};
|
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":";;;AAAA,+BAAqC;AACrC,iFAAoE;AAGpE,
|
|
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;SAC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OAAO,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;YAC3D,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,qCAAgB,EAAC,MAAM,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":";;;AAAA,yDAAyD;AACzD,4CAAkD;AAClD,+BAAkE;AAClE,2BAA8B;AAS9B,SAAS,eAAe,CACtB,MAAa,EACb,IAAY,EACZ,UAAkB;IAElB,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QAC1B,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YAC7B,MAAM,SAAS,GAAG,IAAA,oBAAa,EAAC,KAAK,CAAC,CAAC;YACvC,MAAM,iBAAiB,GAAG,IAAA,cAAO,EAAC,IAAI,EAAE,SAAS,CAAC,CAAC;YACnD,MAAM,kBAAkB,GAAG,IAAA,cAAO,EAAC,IAAI,EAAE,UAAU,CAAC,CAAC;YAErD,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,kBAAkB,CAAC,EAAE;gBACrD,MAAM,IAAI,KAAK,CACb,OAAO,iBAAiB,wDAAwD,UAAU,EAAE,CAC7F,CAAC;aACH;YAED,MAAM,WAAW,GAAG,IAAA,aAAQ,EAAC,iBAAiB,CAAC,CAAC,WAAW,EAAE,CAAC;YAC9D,MAAM,KAAK,GAAG,WAAW;gBACvB,CAAC,CAAC,iBAAiB;gBACnB,CAAC,CAAC,IAAA,cAAO,EAAC,iBAAiB,CAAC,CAAC;YAC/B,MAAM,MAAM,GAAG,IAAA,eAAQ,EAAC,kBAAkB,EAAE,IAAA,cAAO,EAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;YAClE,MAAM,IAAI,GAAG,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAA,eAAQ,EAAC,iBAAiB,CAAC,CAAC;YAChE,OAAO;gBACL,KAAK;gBACL,MAAM;gBACN,IAAI;aACL,CAAC;SACH;aAAM;YACL,IAAI,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;gBACjC,MAAM,IAAI,KAAK,CACb,sEAAsE,CACvE,CAAC;aACH;YAED,MAAM,SAAS,GAAG,IAAA,oBAAa,EAAC,KAAK,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: {};
|
package/src/utils/styles.js
CHANGED
|
@@ -2,15 +2,16 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addStyleDependencies = exports.NEXT_SPECIFIC_STYLE_DEPENDENCIES = void 0;
|
|
4
4
|
const devkit_1 = require("@nrwl/devkit");
|
|
5
|
+
const versions_1 = require("@nrwl/react/src/utils/versions");
|
|
5
6
|
const styled_1 = require("@nrwl/react/src/utils/styled");
|
|
6
|
-
const
|
|
7
|
+
const versions_2 = require("./versions");
|
|
7
8
|
exports.NEXT_SPECIFIC_STYLE_DEPENDENCIES = {
|
|
8
9
|
'styled-components': {
|
|
9
10
|
dependencies: styled_1.CSS_IN_JS_DEPENDENCIES['styled-components'].dependencies,
|
|
10
|
-
devDependencies: Object.assign(Object.assign({}, styled_1.CSS_IN_JS_DEPENDENCIES['styled-components'].devDependencies), { 'babel-plugin-styled-components':
|
|
11
|
+
devDependencies: Object.assign(Object.assign({}, styled_1.CSS_IN_JS_DEPENDENCIES['styled-components'].devDependencies), { 'babel-plugin-styled-components': versions_2.babelPluginStyledComponentsVersion }),
|
|
11
12
|
},
|
|
12
13
|
'@emotion/styled': {
|
|
13
|
-
dependencies: Object.assign(Object.assign({}, styled_1.CSS_IN_JS_DEPENDENCIES['@emotion/styled'].dependencies), { '@emotion/server':
|
|
14
|
+
dependencies: Object.assign(Object.assign({}, styled_1.CSS_IN_JS_DEPENDENCIES['@emotion/styled'].dependencies), { '@emotion/server': versions_2.emotionServerVersion }),
|
|
14
15
|
devDependencies: styled_1.CSS_IN_JS_DEPENDENCIES['@emotion/styled'].devDependencies,
|
|
15
16
|
},
|
|
16
17
|
css: {
|
|
@@ -19,17 +20,19 @@ exports.NEXT_SPECIFIC_STYLE_DEPENDENCIES = {
|
|
|
19
20
|
},
|
|
20
21
|
scss: {
|
|
21
22
|
dependencies: {},
|
|
22
|
-
devDependencies: { sass:
|
|
23
|
+
devDependencies: { sass: versions_2.sassVersion },
|
|
23
24
|
},
|
|
24
25
|
less: {
|
|
25
26
|
dependencies: {},
|
|
26
27
|
devDependencies: {
|
|
27
|
-
|
|
28
|
+
less: versions_1.lessVersion,
|
|
29
|
+
'less-loader': versions_2.lessLoader,
|
|
28
30
|
},
|
|
29
31
|
},
|
|
30
32
|
styl: {
|
|
31
33
|
dependencies: {
|
|
32
|
-
|
|
34
|
+
stylus: versions_1.stylusVersion,
|
|
35
|
+
'stylus-loader': versions_2.stylusLoader,
|
|
33
36
|
},
|
|
34
37
|
devDependencies: {},
|
|
35
38
|
},
|
package/src/utils/styles.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../../packages/next/src/utils/styles.ts"],"names":[],"mappings":";;;AAAA,yCAKsB;AAEtB,yDAAsE;AACtE,yCAMoB;AAEP,QAAA,gCAAgC,GAAG;IAC9C,mBAAmB,EAAE;QACnB,YAAY,EAAE,+BAAsB,CAAC,mBAAmB,CAAC,CAAC,YAAY;QACtE,eAAe,kCACV,+BAAsB,CAAC,mBAAmB,CAAC,CAAC,eAAe,KAC9D,gCAAgC,EAAE,6CAAkC,GACrE;KACF;IACD,iBAAiB,EAAE;QACjB,YAAY,kCACP,+BAAsB,CAAC,iBAAiB,CAAC,CAAC,YAAY,KACzD,iBAAiB,EAAE,+BAAoB,GACxC;QACD,eAAe,EAAE,+BAAsB,CAAC,iBAAiB,CAAC,CAAC,eAAe;KAC3E;IACD,GAAG,EAAE;QACH,YAAY,EAAE,EAAE;QAChB,eAAe,EAAE,EAAE;KACpB;IACD,IAAI,EAAE;QACJ,YAAY,EAAE,EAAE;QAChB,eAAe,EAAE,EAAE,IAAI,EAAE,sBAAW,EAAE;KACvC;IACD,IAAI,EAAE;QACJ,YAAY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