@nrwl/next 15.9.2 → 16.0.0-beta.1

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.
Files changed (203) hide show
  1. package/babel.js +1 -12
  2. package/babel.js.map +1 -1
  3. package/executors.json +12 -12
  4. package/generators.json +2 -70
  5. package/index.d.ts +1 -6
  6. package/index.js +1 -12
  7. package/index.js.map +1 -1
  8. package/package.json +7 -30
  9. package/plugins/with-less.d.ts +1 -2
  10. package/plugins/with-less.js +1 -75
  11. package/plugins/with-less.js.map +1 -1
  12. package/plugins/with-nx.d.ts +1 -15
  13. package/plugins/with-nx.js +1 -274
  14. package/plugins/with-nx.js.map +1 -1
  15. package/plugins/with-stylus.d.ts +1 -2
  16. package/plugins/with-stylus.js +1 -75
  17. package/plugins/with-stylus.js.map +1 -1
  18. package/tailwind.d.ts +1 -2
  19. package/tailwind.js +2 -4
  20. package/tailwind.js.map +1 -1
  21. package/README.md +0 -63
  22. package/migrations.json +0 -306
  23. package/src/executors/build/build.impl.d.ts +0 -6
  24. package/src/executors/build/build.impl.js +0 -62
  25. package/src/executors/build/build.impl.js.map +0 -1
  26. package/src/executors/build/compat.d.ts +0 -2
  27. package/src/executors/build/compat.js +0 -6
  28. package/src/executors/build/compat.js.map +0 -1
  29. package/src/executors/build/lib/check-project.d.ts +0 -1
  30. package/src/executors/build/lib/check-project.js +0 -13
  31. package/src/executors/build/lib/check-project.js.map +0 -1
  32. package/src/executors/build/lib/create-next-config-file.d.ts +0 -3
  33. package/src/executors/build/lib/create-next-config-file.js +0 -15
  34. package/src/executors/build/lib/create-next-config-file.js.map +0 -1
  35. package/src/executors/build/lib/update-package-json.d.ts +0 -3
  36. package/src/executors/build/lib/update-package-json.js +0 -24
  37. package/src/executors/build/lib/update-package-json.js.map +0 -1
  38. package/src/executors/build/schema.json +0 -68
  39. package/src/executors/export/compat.d.ts +0 -2
  40. package/src/executors/export/compat.js +0 -6
  41. package/src/executors/export/compat.js.map +0 -1
  42. package/src/executors/export/export.impl.d.ts +0 -6
  43. package/src/executors/export/export.impl.js +0 -53
  44. package/src/executors/export/export.impl.js.map +0 -1
  45. package/src/executors/export/schema.json +0 -30
  46. package/src/executors/server/compat.d.ts +0 -2
  47. package/src/executors/server/compat.js +0 -6
  48. package/src/executors/server/compat.js.map +0 -1
  49. package/src/executors/server/lib/custom-server.d.ts +0 -2
  50. package/src/executors/server/lib/custom-server.js +0 -15
  51. package/src/executors/server/lib/custom-server.js.map +0 -1
  52. package/src/executors/server/lib/default-server.d.ts +0 -6
  53. package/src/executors/server/lib/default-server.js +0 -34
  54. package/src/executors/server/lib/default-server.js.map +0 -1
  55. package/src/executors/server/lib/tsnode-register.d.ts +0 -1
  56. package/src/executors/server/lib/tsnode-register.js +0 -23
  57. package/src/executors/server/lib/tsnode-register.js.map +0 -1
  58. package/src/executors/server/schema.json +0 -61
  59. package/src/executors/server/server.impl.d.ts +0 -7
  60. package/src/executors/server/server.impl.js +0 -120
  61. package/src/executors/server/server.impl.js.map +0 -1
  62. package/src/generators/application/application.d.ts +0 -4
  63. package/src/generators/application/application.js +0 -45
  64. package/src/generators/application/application.js.map +0 -1
  65. package/src/generators/application/files/.babelrc__tmpl__ +0 -21
  66. package/src/generators/application/files/index.d.ts__tmpl__ +0 -18
  67. package/src/generators/application/files/next-env.d.ts__tmpl__ +0 -5
  68. package/src/generators/application/files/next.config.js__tmpl__ +0 -70
  69. package/src/generators/application/files/pages/__fileName__.module.__style__ +0 -1
  70. package/src/generators/application/files/pages/__fileName__.tsx__tmpl__ +0 -28
  71. package/src/generators/application/files/pages/_app.tsx__tmpl__ +0 -18
  72. package/src/generators/application/files/pages/_document.tsx__tmpl__ +0 -33
  73. package/src/generators/application/files/pages/styles.__stylesExt____tmpl__ +0 -1
  74. package/src/generators/application/files/public/.gitkeep +0 -0
  75. package/src/generators/application/files/specs/__fileName__.spec.tsx__tmpl__ +0 -11
  76. package/src/generators/application/files/tsconfig.json__tmpl__ +0 -18
  77. package/src/generators/application/lib/add-cypress.d.ts +0 -3
  78. package/src/generators/application/lib/add-cypress.js +0 -18
  79. package/src/generators/application/lib/add-cypress.js.map +0 -1
  80. package/src/generators/application/lib/add-jest.d.ts +0 -3
  81. package/src/generators/application/lib/add-jest.js +0 -36
  82. package/src/generators/application/lib/add-jest.js.map +0 -1
  83. package/src/generators/application/lib/add-linting.d.ts +0 -3
  84. package/src/generators/application/lib/add-linting.js +0 -66
  85. package/src/generators/application/lib/add-linting.js.map +0 -1
  86. package/src/generators/application/lib/add-project.d.ts +0 -3
  87. package/src/generators/application/lib/add-project.js +0 -59
  88. package/src/generators/application/lib/add-project.js.map +0 -1
  89. package/src/generators/application/lib/create-application-files.d.ts +0 -3
  90. package/src/generators/application/lib/create-application-files.helpers.d.ts +0 -2
  91. package/src/generators/application/lib/create-application-files.helpers.js +0 -785
  92. package/src/generators/application/lib/create-application-files.helpers.js.map +0 -1
  93. package/src/generators/application/lib/create-application-files.js +0 -34
  94. package/src/generators/application/lib/create-application-files.js.map +0 -1
  95. package/src/generators/application/lib/create-next-server-files.d.ts +0 -3
  96. package/src/generators/application/lib/create-next-server-files.js +0 -57
  97. package/src/generators/application/lib/create-next-server-files.js.map +0 -1
  98. package/src/generators/application/lib/normalize-options.d.ts +0 -13
  99. package/src/generators/application/lib/normalize-options.js +0 -33
  100. package/src/generators/application/lib/normalize-options.js.map +0 -1
  101. package/src/generators/application/lib/set-defaults.d.ts +0 -3
  102. package/src/generators/application/lib/set-defaults.js +0 -14
  103. package/src/generators/application/lib/set-defaults.js.map +0 -1
  104. package/src/generators/application/lib/update-jest-config.d.ts +0 -3
  105. package/src/generators/application/lib/update-jest-config.js +0 -16
  106. package/src/generators/application/lib/update-jest-config.js.map +0 -1
  107. package/src/generators/application/schema.d.ts +0 -20
  108. package/src/generators/application/schema.json +0 -131
  109. package/src/generators/component/component.d.ts +0 -15
  110. package/src/generators/component/component.js +0 -34
  111. package/src/generators/component/component.js.map +0 -1
  112. package/src/generators/component/schema.json +0 -119
  113. package/src/generators/custom-server/custom-server.d.ts +0 -4
  114. package/src/generators/custom-server/custom-server.js +0 -79
  115. package/src/generators/custom-server/custom-server.js.map +0 -1
  116. package/src/generators/custom-server/files/server/main.ts__tmpl__ +0 -46
  117. package/src/generators/custom-server/files/tsconfig.server.json__tmpl__ +0 -15
  118. package/src/generators/custom-server/schema.d.ts +0 -4
  119. package/src/generators/custom-server/schema.json +0 -30
  120. package/src/generators/init/init.d.ts +0 -5
  121. package/src/generators/init/init.js +0 -49
  122. package/src/generators/init/init.js.map +0 -1
  123. package/src/generators/init/schema.d.ts +0 -7
  124. package/src/generators/init/schema.json +0 -39
  125. package/src/generators/library/library.d.ts +0 -5
  126. package/src/generators/library/library.js +0 -73
  127. package/src/generators/library/library.js.map +0 -1
  128. package/src/generators/library/schema.d.ts +0 -26
  129. package/src/generators/library/schema.json +0 -162
  130. package/src/generators/page/page.d.ts +0 -5
  131. package/src/generators/page/page.js +0 -27
  132. package/src/generators/page/page.js.map +0 -1
  133. package/src/generators/page/schema.d.ts +0 -13
  134. package/src/generators/page/schema.json +0 -107
  135. package/src/migrations/update-12-10-0/fix-page-dir-for-eslint.d.ts +0 -3
  136. package/src/migrations/update-12-10-0/fix-page-dir-for-eslint.js +0 -34
  137. package/src/migrations/update-12-10-0/fix-page-dir-for-eslint.js.map +0 -1
  138. package/src/migrations/update-12-8-0/remove-styled-jsx-babel-plugin.d.ts +0 -3
  139. package/src/migrations/update-12-8-0/remove-styled-jsx-babel-plugin.js +0 -26
  140. package/src/migrations/update-12-8-0/remove-styled-jsx-babel-plugin.js.map +0 -1
  141. package/src/migrations/update-13-0-0/update-emotion-setup.d.ts +0 -3
  142. package/src/migrations/update-13-0-0/update-emotion-setup.js +0 -39
  143. package/src/migrations/update-13-0-0/update-emotion-setup.js.map +0 -1
  144. package/src/migrations/update-13-0-0/update-to-webpack-5.d.ts +0 -3
  145. package/src/migrations/update-13-0-0/update-to-webpack-5.js +0 -32
  146. package/src/migrations/update-13-0-0/update-to-webpack-5.js.map +0 -1
  147. package/src/migrations/update-13-0-3/fix-less.d.ts +0 -3
  148. package/src/migrations/update-13-0-3/fix-less.js +0 -27
  149. package/src/migrations/update-13-0-3/fix-less.js.map +0 -1
  150. package/src/migrations/update-13-1-1/enable-swc.d.ts +0 -3
  151. package/src/migrations/update-13-1-1/enable-swc.js +0 -46
  152. package/src/migrations/update-13-1-1/enable-swc.js.map +0 -1
  153. package/src/migrations/update-14-0-0/add-default-development-configurations.d.ts +0 -3
  154. package/src/migrations/update-14-0-0/add-default-development-configurations.js +0 -36
  155. package/src/migrations/update-14-0-0/add-default-development-configurations.js.map +0 -1
  156. package/src/migrations/update-14-4-3/add-dev-output-path.d.ts +0 -3
  157. package/src/migrations/update-14-4-3/add-dev-output-path.js +0 -24
  158. package/src/migrations/update-14-4-3/add-dev-output-path.js.map +0 -1
  159. package/src/migrations/update-14-5-3/add-gitignore-entry.d.ts +0 -3
  160. package/src/migrations/update-14-5-3/add-gitignore-entry.js +0 -15
  161. package/src/migrations/update-14-5-3/add-gitignore-entry.js.map +0 -1
  162. package/src/migrations/update-14-5-3/update-dev-output-path.d.ts +0 -3
  163. package/src/migrations/update-14-5-3/update-dev-output-path.js +0 -29
  164. package/src/migrations/update-14-5-3/update-dev-output-path.js.map +0 -1
  165. package/src/migrations/update-14-5-7/update-next-eslint.d.ts +0 -3
  166. package/src/migrations/update-14-5-7/update-next-eslint.js +0 -32
  167. package/src/migrations/update-14-5-7/update-next-eslint.js.map +0 -1
  168. package/src/migrations/update-15-8-8/add-style-packages.d.ts +0 -3
  169. package/src/migrations/update-15-8-8/add-style-packages.js +0 -28
  170. package/src/migrations/update-15-8-8/add-style-packages.js.map +0 -1
  171. package/src/utils/add-gitignore-entry.d.ts +0 -2
  172. package/src/utils/add-gitignore-entry.js +0 -18
  173. package/src/utils/add-gitignore-entry.js.map +0 -1
  174. package/src/utils/config-invalid-function.fixture.d.ts +0 -0
  175. package/src/utils/config-invalid-function.fixture.js +0 -2
  176. package/src/utils/config-invalid-function.fixture.js.map +0 -1
  177. package/src/utils/config-not-a-function.fixture.d.ts +0 -0
  178. package/src/utils/config-not-a-function.fixture.js +0 -2
  179. package/src/utils/config-not-a-function.fixture.js.map +0 -1
  180. package/src/utils/config.d.ts +0 -4
  181. package/src/utils/config.fixture.d.ts +0 -0
  182. package/src/utils/config.fixture.js +0 -4
  183. package/src/utils/config.fixture.js.map +0 -1
  184. package/src/utils/config.js +0 -65
  185. package/src/utils/config.js.map +0 -1
  186. package/src/utils/constants.d.ts +0 -1
  187. package/src/utils/constants.js +0 -5
  188. package/src/utils/constants.js.map +0 -1
  189. package/src/utils/create-copy-plugin.d.ts +0 -2
  190. package/src/utils/create-copy-plugin.js +0 -63
  191. package/src/utils/create-copy-plugin.js.map +0 -1
  192. package/src/utils/generate-globs.d.ts +0 -5
  193. package/src/utils/generate-globs.js +0 -30
  194. package/src/utils/generate-globs.js.map +0 -1
  195. package/src/utils/styles.d.ts +0 -40
  196. package/src/utils/styles.js +0 -56
  197. package/src/utils/styles.js.map +0 -1
  198. package/src/utils/types.d.ts +0 -57
  199. package/src/utils/types.js +0 -3
  200. package/src/utils/types.js.map +0 -1
  201. package/src/utils/versions.d.ts +0 -9
  202. package/src/utils/versions.js +0 -13
  203. package/src/utils/versions.js.map +0 -1
package/babel.js CHANGED
@@ -1,13 +1,2 @@
1
- /*
2
- * Babel preset to provide Next.js support for Nx.
3
- */
4
- module.exports = function (api, options) {
5
- api.assertVersion(7);
6
- return {
7
- presets: [['next/babel', options]],
8
- plugins: [
9
- [require.resolve('@babel/plugin-proposal-decorators'), { legacy: true }],
10
- ],
11
- };
12
- };
1
+ module.exports = require('@nx/next/babel');
13
2
  //# sourceMappingURL=babel.js.map
package/babel.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"babel.js","sourceRoot":"","sources":["../../../packages/next/babel.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,OAAO,GAAG,UAAU,GAAG,EAAE,OAAO;IACrC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;IACrB,OAAO;QACL,OAAO,EAAE,CAAC,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QAClC,OAAO,EAAE;YACP,CAAC,OAAO,CAAC,OAAO,CAAC,mCAAmC,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;SACzE;KACF,CAAC;AACJ,CAAC,CAAC"}
1
+ {"version":3,"file":"babel.js","sourceRoot":"","sources":["../../../packages-legacy/next/babel.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC"}
package/executors.json CHANGED
@@ -1,35 +1,35 @@
1
1
  {
2
2
  "executors": {
3
3
  "build": {
4
- "implementation": "./src/executors/build/build.impl",
5
- "schema": "./src/executors/build/schema.json",
4
+ "implementation": "@nx/next/src/executors/build/build.impl",
5
+ "schema": "@nx/next/src/executors/build/schema.json",
6
6
  "description": "Build a Next.js application."
7
7
  },
8
8
  "server": {
9
- "implementation": "./src/executors/server/server.impl",
10
- "schema": "./src/executors/server/schema.json",
9
+ "implementation": "@nx/next/src/executors/server/server.impl",
10
+ "schema": "@nx/next/src/executors/server/schema.json",
11
11
  "description": "Serve a Next.js application."
12
12
  },
13
13
  "export": {
14
- "implementation": "./src/executors/export/export.impl",
15
- "schema": "./src/executors/export/schema.json",
14
+ "implementation": "@nx/next/src/executors/export/export.impl",
15
+ "schema": "@nx/next/src/executors/export/schema.json",
16
16
  "description": "Export a Next.js application. The exported application is located at `dist/$outputPath/exported`."
17
17
  }
18
18
  },
19
19
  "builders": {
20
20
  "build": {
21
- "implementation": "./src/executors/build/compat",
22
- "schema": "./src/executors/build/schema.json",
21
+ "implementation": "@nx/next/src/executors/build/compat",
22
+ "schema": "@nx/next/src/executors/build/schema.json",
23
23
  "description": "Build a Next.js application."
24
24
  },
25
25
  "server": {
26
- "implementation": "./src/executors/server/compat",
27
- "schema": "./src/executors/server/schema.json",
26
+ "implementation": "@nx/next/src/executors/server/compat",
27
+ "schema": "@nx/next/src/executors/server/schema.json",
28
28
  "description": "Serve a Next.js application."
29
29
  },
30
30
  "export": {
31
- "implementation": "./src/executors/export/compat",
32
- "schema": "./src/executors/export/schema.json",
31
+ "implementation": "@nx/next/src/executors/export/compat",
32
+ "schema": "@nx/next/src/executors/export/schema.json",
33
33
  "description": "Export a Next.js application. The exported application is located at `dist/$outputPath/exported`."
34
34
  }
35
35
  }
package/generators.json CHANGED
@@ -1,72 +1,4 @@
1
1
  {
2
- "name": "nx/next",
3
- "version": "0.1",
4
- "extends": ["@nrwl/react"],
5
- "schematics": {
6
- "init": {
7
- "factory": "./src/generators/init/init#nextInitSchematic",
8
- "schema": "./src/generators/init/schema.json",
9
- "description": "Initialize the `@nrwl/next` plugin.",
10
- "hidden": true
11
- },
12
- "application": {
13
- "factory": "./src/generators/application/application#applicationSchematic",
14
- "schema": "./src/generators/application/schema.json",
15
- "aliases": ["app"],
16
- "x-type": "application",
17
- "description": "Create a Next.js application."
18
- },
19
- "page": {
20
- "factory": "./src/generators/page/page#pageSchematic",
21
- "schema": "./src/generators/page/schema.json",
22
- "description": "Create a Next.js page component."
23
- },
24
- "component": {
25
- "factory": "./src/generators/component/component#componentSchematic",
26
- "schema": "./src/generators/component/schema.json",
27
- "description": "Create a React component."
28
- },
29
- "custom-server": {
30
- "factory": "./src/generators/custom-server/custom-server#customServerSchematic",
31
- "schema": "./src/generators/custom-server/schema.json",
32
- "description": "Set up a custom server."
33
- }
34
- },
35
- "generators": {
36
- "init": {
37
- "factory": "./src/generators/init/init#nextInitGenerator",
38
- "schema": "./src/generators/init/schema.json",
39
- "description": "Initialize the `@nrwl/next` plugin.",
40
- "hidden": true
41
- },
42
- "application": {
43
- "factory": "./src/generators/application/application#applicationGenerator",
44
- "schema": "./src/generators/application/schema.json",
45
- "aliases": ["app"],
46
- "x-type": "application",
47
- "description": "Create an application."
48
- },
49
- "page": {
50
- "factory": "./src/generators/page/page#pageGenerator",
51
- "schema": "./src/generators/page/schema.json",
52
- "description": "Create a page."
53
- },
54
- "component": {
55
- "factory": "./src/generators/component/component#componentGenerator",
56
- "schema": "./src/generators/component/schema.json",
57
- "description": "Create a component."
58
- },
59
- "library": {
60
- "factory": "./src/generators/library/library#libraryGenerator",
61
- "schema": "./src/generators/library/schema.json",
62
- "aliases": ["lib"],
63
- "x-type": "library",
64
- "description": "Create a library."
65
- },
66
- "custom-server": {
67
- "factory": "./src/generators/custom-server/custom-server#customServerGenerator",
68
- "schema": "./src/generators/custom-server/schema.json",
69
- "description": "Set up a custom server."
70
- }
71
- }
2
+ "extends": ["@nx/next"],
3
+ "schematics": {}
72
4
  }
package/index.d.ts CHANGED
@@ -1,6 +1 @@
1
- export * from './src/utils/types';
2
- export { createGlobPatternsOfDependentProjects } from './src/utils/generate-globs';
3
- export { applicationGenerator } from './src/generators/application/application';
4
- export { componentGenerator } from './src/generators/component/component';
5
- export { libraryGenerator } from './src/generators/library/library';
6
- export { pageGenerator } from './src/generators/page/page';
1
+ export * from '@nx/next';
package/index.js CHANGED
@@ -1,16 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.pageGenerator = exports.libraryGenerator = exports.componentGenerator = exports.applicationGenerator = exports.createGlobPatternsOfDependentProjects = void 0;
4
3
  const tslib_1 = require("tslib");
5
- tslib_1.__exportStar(require("./src/utils/types"), exports);
6
- var generate_globs_1 = require("./src/utils/generate-globs");
7
- Object.defineProperty(exports, "createGlobPatternsOfDependentProjects", { enumerable: true, get: function () { return generate_globs_1.createGlobPatternsOfDependentProjects; } });
8
- var application_1 = require("./src/generators/application/application");
9
- Object.defineProperty(exports, "applicationGenerator", { enumerable: true, get: function () { return application_1.applicationGenerator; } });
10
- var component_1 = require("./src/generators/component/component");
11
- Object.defineProperty(exports, "componentGenerator", { enumerable: true, get: function () { return component_1.componentGenerator; } });
12
- var library_1 = require("./src/generators/library/library");
13
- Object.defineProperty(exports, "libraryGenerator", { enumerable: true, get: function () { return library_1.libraryGenerator; } });
14
- var page_1 = require("./src/generators/page/page");
15
- Object.defineProperty(exports, "pageGenerator", { enumerable: true, get: function () { return page_1.pageGenerator; } });
4
+ tslib_1.__exportStar(require("@nx/next"), exports);
16
5
  //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages/next/index.ts"],"names":[],"mappings":";;;;AAAA,4DAAkC;AAClC,6DAAmF;AAA1E,uIAAA,qCAAqC,OAAA;AAE9C,wEAAgF;AAAvE,mHAAA,oBAAoB,OAAA;AAC7B,kEAA0E;AAAjE,+GAAA,kBAAkB,OAAA;AAC3B,4DAAoE;AAA3D,2GAAA,gBAAgB,OAAA;AACzB,mDAA2D;AAAlD,qGAAA,aAAa,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages-legacy/next/index.ts"],"names":[],"mappings":";;;AAAA,mDAAyB"}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@nrwl/next",
3
- "version": "15.9.2",
3
+ "version": "16.0.0-beta.1",
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": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/nrwl/nx.git",
9
- "directory": "packages/next"
9
+ "directory": "packages-legacy/next"
10
10
  },
11
11
  "keywords": [
12
12
  "Monorepo",
@@ -26,38 +26,15 @@
26
26
  "homepage": "https://nx.dev",
27
27
  "schematics": "./generators.json",
28
28
  "builders": "./executors.json",
29
- "ng-update": {
30
- "requirements": {},
31
- "migrations": "./migrations.json"
32
- },
33
- "peerDependencies": {
34
- "next": "^13.0.0"
35
- },
36
29
  "dependencies": {
37
- "@babel/plugin-proposal-decorators": "^7.14.5",
38
- "@nrwl/devkit": "15.9.2",
39
- "@nrwl/js": "15.9.2",
40
- "@nrwl/linter": "15.9.2",
41
- "@nrwl/react": "15.9.2",
42
- "@nrwl/workspace": "15.9.2",
43
- "@svgr/webpack": "^6.1.2",
44
- "chalk": "^4.1.0",
45
- "copy-webpack-plugin": "^10.2.4",
46
- "dotenv": "~10.0.0",
47
- "express": "^4.18.1",
48
- "fs-extra": "^11.1.0",
49
- "http-proxy-middleware": "^2.0.6",
50
- "ignore": "^5.0.4",
51
- "semver": "7.3.4",
52
- "ts-node": "10.9.1",
53
- "tsconfig-paths": "^4.1.2",
54
- "tsconfig-paths-webpack-plugin": "4.0.0",
55
- "url-loader": "^4.1.1",
56
- "webpack-merge": "^5.8.0"
30
+ "@nx/next": "16.0.0-beta.1"
57
31
  },
58
32
  "publishConfig": {
59
33
  "access": "public"
60
34
  },
35
+ "nx-migrations": {
36
+ "migrations": "@nx/next/migrations.json"
37
+ },
61
38
  "types": "./index.d.ts",
62
- "gitHead": "c60dd8b2f03545ba7d9bbf58c10ac7b49f7f3e92"
39
+ "gitHead": "abf534c265f5aa3aac146e55bb31de598ea281d7"
63
40
  }
@@ -1,2 +1 @@
1
- import { NextConfigFn } from './with-nx';
2
- export declare function withLess(configFn: NextConfigFn): NextConfigFn;
1
+ export * from '@nx/next/plugins/with-less';
@@ -1,79 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.withLess = void 0;
4
3
  const tslib_1 = require("tslib");
5
- // Adapted from https://raw.githubusercontent.com/elado/next-with-less/main/src/index.js
6
- const webpack_merge_1 = require("webpack-merge");
7
- const addLessToRegExp = (rx) => new RegExp(rx.source.replace('|sass', '|sass|less'), rx.flags);
8
- function patchNextCSSWithLess(nextCSSModule = require('next/dist/build/webpack/config/blocks/css')) {
9
- nextCSSModule.regexLikeCss = addLessToRegExp(nextCSSModule.regexLikeCss);
10
- }
11
- patchNextCSSWithLess();
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);
66
- }
67
- if (typeof nextConfig.webpack === 'function') {
68
- return nextConfig.webpack(config, opts);
69
- }
70
- return config;
71
- },
72
- });
73
- });
74
- }
75
- exports.withLess = withLess;
76
- module.exports = withLess;
77
- module.exports.withLess = withLess;
78
- module.exports.patchNext = patchNextCSSWithLess;
4
+ tslib_1.__exportStar(require("@nx/next/plugins/with-less"), exports);
79
5
  //# sourceMappingURL=with-less.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"with-less.js","sourceRoot":"","sources":["../../../../packages/next/plugins/with-less.ts"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"with-less.js","sourceRoot":"","sources":["../../../../packages-legacy/next/plugins/with-less.ts"],"names":[],"mappings":";;;AAAA,qEAA2C"}
@@ -1,15 +1 @@
1
- import type { NextConfig } from 'next';
2
- export interface WithNxOptions extends NextConfig {
3
- nx?: {
4
- svgr?: boolean;
5
- };
6
- }
7
- export interface NextConfigFn {
8
- (phase: string): Promise<NextConfig>;
9
- }
10
- export interface WithNxContext {
11
- workspaceRoot: string;
12
- libsDir: string;
13
- }
14
- export declare function withNx(_nextConfig?: WithNxOptions, context?: WithNxContext): NextConfigFn;
15
- export declare function getNextConfig(nextConfig?: WithNxOptions, context?: WithNxContext): NextConfig;
1
+ export * from '@nx/next/plugins/with-nx';
@@ -1,278 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getNextConfig = exports.withNx = void 0;
4
3
  const tslib_1 = require("tslib");
5
- const devkit_1 = require("@nrwl/devkit");
6
- const buildable_libs_utils_1 = require("@nrwl/js/src/utils/buildable-libs-utils");
7
- const constants_1 = require("next/constants");
8
- const path = require("path");
9
- const config_1 = require("../src/utils/config");
10
- function regexEqual(x, y) {
11
- return (x instanceof RegExp &&
12
- y instanceof RegExp &&
13
- x.source === y.source &&
14
- x.global === y.global &&
15
- x.ignoreCase === y.ignoreCase &&
16
- x.multiline === y.multiline);
17
- }
18
- /**
19
- * Do not remove or rename this function. Production builds inline `with-nx.js` file with a replacement
20
- * To this function that hard-codes the libsDir.
21
- */
22
- function getWithNxContext() {
23
- const { workspaceRoot, workspaceLayout } = require('@nrwl/devkit');
24
- return {
25
- workspaceRoot,
26
- libsDir: workspaceLayout().libsDir,
27
- };
28
- }
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()) {
125
- var _a;
126
- // If `next-compose-plugins` is used, the context argument is invalid.
127
- if (!context.libsDir || !context.workspaceRoot) {
128
- context = getWithNxContext();
129
- }
130
- const userWebpack = nextConfig.webpack || ((x) => x);
131
- const { nx } = nextConfig, validNextConfig = tslib_1.__rest(nextConfig, ["nx"]);
132
- return Object.assign(Object.assign({ eslint: Object.assign({ ignoreDuringBuilds: true }, ((_a = validNextConfig.eslint) !== null && _a !== void 0 ? _a : {})) }, validNextConfig), { webpack: (config, options) => {
133
- /*
134
- * Update babel to support our monorepo setup.
135
- * The 'upward' mode allows the root babel.config.json and per-project .babelrc files to be picked up.
136
- */
137
- options.defaultLoaders.babel.options.babelrc = true;
138
- options.defaultLoaders.babel.options.rootMode = 'upward';
139
- /*
140
- * Modify the Next.js webpack config to allow workspace libs to use css modules.
141
- * Note: This would be easier if Next.js exposes css-loader and sass-loader on `defaultLoaders`.
142
- */
143
- // Include workspace libs in css/sass loaders
144
- const includes = [
145
- require('path').join(context.workspaceRoot, context.libsDir),
146
- ];
147
- const nextCssLoaders = config.module.rules.find((rule) => typeof rule.oneOf === 'object');
148
- // webpack config is not as expected
149
- if (!nextCssLoaders)
150
- return config;
151
- /*
152
- * 1. Modify css loader to enable module support for workspace libs
153
- */
154
- const nextCssLoader = nextCssLoaders.oneOf.find((rule) => rule.sideEffects === false && regexEqual(rule.test, /\.module\.css$/));
155
- // Might not be found if Next.js webpack config changes in the future
156
- if (nextCssLoader && nextCssLoader.issuer) {
157
- nextCssLoader.issuer.or = nextCssLoader.issuer.and
158
- ? nextCssLoader.issuer.and.concat(includes)
159
- : includes;
160
- delete nextCssLoader.issuer.and;
161
- }
162
- /*
163
- * 2. Modify sass loader to enable module support for workspace libs
164
- */
165
- const nextSassLoader = nextCssLoaders.oneOf.find((rule) => rule.sideEffects === false &&
166
- regexEqual(rule.test, /\.module\.(scss|sass)$/));
167
- // Might not be found if Next.js webpack config changes in the future
168
- if (nextSassLoader && nextSassLoader.issuer) {
169
- nextSassLoader.issuer.or = nextSassLoader.issuer.and
170
- ? nextSassLoader.issuer.and.concat(includes)
171
- : includes;
172
- delete nextSassLoader.issuer.and;
173
- }
174
- /*
175
- * 3. Modify error loader to ignore css modules used by workspace libs
176
- */
177
- const nextErrorCssModuleLoader = nextCssLoaders.oneOf.find((rule) => rule.use &&
178
- rule.use.loader === 'error-loader' &&
179
- rule.use.options &&
180
- (rule.use.options.reason ===
181
- 'CSS Modules \u001b[1mcannot\u001b[22m be imported from within \u001b[1mnode_modules\u001b[22m.\n' +
182
- 'Read more: https://err.sh/next.js/css-modules-npm' ||
183
- rule.use.options.reason ===
184
- 'CSS Modules cannot be imported from within node_modules.\nRead more: https://err.sh/next.js/css-modules-npm'));
185
- // Might not be found if Next.js webpack config changes in the future
186
- if (nextErrorCssModuleLoader) {
187
- nextErrorCssModuleLoader.exclude = includes;
188
- }
189
- /**
190
- * 4. Modify css loader to allow global css from node_modules to be imported from workspace libs
191
- */
192
- const nextGlobalCssLoader = nextCssLoaders.oneOf.find((rule) => {
193
- var _a, _b;
194
- return (_b = (_a = rule.include) === null || _a === void 0 ? void 0 : _a.and) === null || _b === void 0 ? void 0 : _b.find((include) => regexEqual(include, /node_modules/));
195
- });
196
- // Might not be found if Next.js webpack config changes in the future
197
- if (nextGlobalCssLoader && nextGlobalCssLoader.issuer) {
198
- nextGlobalCssLoader.issuer.or = nextGlobalCssLoader.issuer.and
199
- ? nextGlobalCssLoader.issuer.and.concat(includes)
200
- : includes;
201
- delete nextGlobalCssLoader.issuer.and;
202
- }
203
- /**
204
- * 5. Add env variables prefixed with NX_
205
- */
206
- addNxEnvVariables(config);
207
- /**
208
- * 6. Add SVGR support if option is on.
209
- */
210
- // Default SVGR support to be on for projects.
211
- if ((nx === null || nx === void 0 ? void 0 : nx.svgr) !== false) {
212
- config.module.rules.push({
213
- test: /\.svg$/,
214
- oneOf: [
215
- // If coming from JS/TS file, then transform into React component using SVGR.
216
- {
217
- issuer: /\.[jt]sx?$/,
218
- use: [
219
- {
220
- loader: require.resolve('@svgr/webpack'),
221
- options: {
222
- svgo: false,
223
- titleProp: true,
224
- ref: true,
225
- },
226
- },
227
- {
228
- loader: require.resolve('url-loader'),
229
- options: {
230
- limit: 10000,
231
- name: '[name].[hash:7].[ext]',
232
- },
233
- },
234
- ],
235
- },
236
- // Fallback to plain URL loader if someone just imports the SVG and references it on the <img src> tag
237
- {
238
- loader: require.resolve('url-loader'),
239
- options: {
240
- limit: 10000,
241
- name: '[name].[hash:7].[ext]',
242
- },
243
- },
244
- ],
245
- });
246
- }
247
- return userWebpack(config, options);
248
- } });
249
- }
250
- exports.getNextConfig = getNextConfig;
251
- function getNxEnvironmentVariables() {
252
- return Object.keys(process.env)
253
- .filter((env) => /^NX_/i.test(env))
254
- .reduce((env, key) => {
255
- env[key] = process.env[key];
256
- return env;
257
- }, {});
258
- }
259
- function addNxEnvVariables(config) {
260
- var _a;
261
- const maybeDefinePlugin = (_a = config.plugins) === null || _a === void 0 ? void 0 : _a.find((plugin) => {
262
- var _a;
263
- return (_a = plugin.definitions) === null || _a === void 0 ? void 0 : _a['process.env.NODE_ENV'];
264
- });
265
- if (maybeDefinePlugin) {
266
- const env = getNxEnvironmentVariables();
267
- Object.entries(env)
268
- .map(([name, value]) => [`process.env.${name}`, `"${value}"`])
269
- .filter(([name]) => !maybeDefinePlugin.definitions[name])
270
- .forEach(([name, value]) => (maybeDefinePlugin.definitions[name] = value));
271
- }
272
- }
273
- // Support for older generated code: `const withNx = require('@nrwl/next/plugins/with-nx');`
274
- module.exports = withNx;
275
- // Support for newer generated code: `const { withNx } = require(...);`
276
- module.exports.withNx = withNx;
277
- module.exports.getNextConfig = getNextConfig;
4
+ tslib_1.__exportStar(require("@nx/next/plugins/with-nx"), exports);
278
5
  //# sourceMappingURL=with-nx.js.map