@nx/js 0.0.0-pr-22179-271588f

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 (204) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +68 -0
  3. package/babel.d.ts +13 -0
  4. package/babel.js +91 -0
  5. package/executors.json +32 -0
  6. package/generators.json +46 -0
  7. package/migrations.json +159 -0
  8. package/package.json +76 -0
  9. package/plugins/jest/local-registry.d.ts +1 -0
  10. package/plugins/jest/local-registry.js +4 -0
  11. package/src/executors/node/lib/kill-tree.d.ts +2 -0
  12. package/src/executors/node/lib/kill-tree.js +114 -0
  13. package/src/executors/node/node-with-require-overrides.d.ts +7 -0
  14. package/src/executors/node/node-with-require-overrides.js +21 -0
  15. package/src/executors/node/node.impl.d.ts +7 -0
  16. package/src/executors/node/node.impl.js +288 -0
  17. package/src/executors/node/schema.d.ts +18 -0
  18. package/src/executors/node/schema.json +92 -0
  19. package/src/executors/release-publish/format-bytes.d.ts +1 -0
  20. package/src/executors/release-publish/format-bytes.js +28 -0
  21. package/src/executors/release-publish/log-tar.d.ts +1 -0
  22. package/src/executors/release-publish/log-tar.js +68 -0
  23. package/src/executors/release-publish/release-publish.impl.d.ts +5 -0
  24. package/src/executors/release-publish/release-publish.impl.js +198 -0
  25. package/src/executors/release-publish/schema.d.ts +8 -0
  26. package/src/executors/release-publish/schema.json +26 -0
  27. package/src/executors/swc/schema.json +154 -0
  28. package/src/executors/swc/swc.impl.d.ts +10 -0
  29. package/src/executors/swc/swc.impl.js +149 -0
  30. package/src/executors/tsc/lib/batch/build-task-info-per-tsconfig-map.d.ts +5 -0
  31. package/src/executors/tsc/lib/batch/build-task-info-per-tsconfig-map.js +62 -0
  32. package/src/executors/tsc/lib/batch/index.d.ts +4 -0
  33. package/src/executors/tsc/lib/batch/index.js +7 -0
  34. package/src/executors/tsc/lib/batch/normalize-tasks-options.d.ts +3 -0
  35. package/src/executors/tsc/lib/batch/normalize-tasks-options.js +14 -0
  36. package/src/executors/tsc/lib/batch/types.d.ts +17 -0
  37. package/src/executors/tsc/lib/batch/types.js +2 -0
  38. package/src/executors/tsc/lib/batch/watch.d.ts +3 -0
  39. package/src/executors/tsc/lib/batch/watch.js +56 -0
  40. package/src/executors/tsc/lib/get-custom-transformers-factory.d.ts +3 -0
  41. package/src/executors/tsc/lib/get-custom-transformers-factory.js +13 -0
  42. package/src/executors/tsc/lib/get-task-options.d.ts +3 -0
  43. package/src/executors/tsc/lib/get-task-options.js +34 -0
  44. package/src/executors/tsc/lib/get-tsconfig.d.ts +4 -0
  45. package/src/executors/tsc/lib/get-tsconfig.js +86 -0
  46. package/src/executors/tsc/lib/index.d.ts +4 -0
  47. package/src/executors/tsc/lib/index.js +7 -0
  48. package/src/executors/tsc/lib/normalize-options.d.ts +2 -0
  49. package/src/executors/tsc/lib/normalize-options.js +39 -0
  50. package/src/executors/tsc/lib/typescript-compilation.d.ts +29 -0
  51. package/src/executors/tsc/lib/typescript-compilation.js +203 -0
  52. package/src/executors/tsc/lib/typescript-diagnostic-reporters.d.ts +3 -0
  53. package/src/executors/tsc/lib/typescript-diagnostic-reporters.js +37 -0
  54. package/src/executors/tsc/schema.json +163 -0
  55. package/src/executors/tsc/tsc.batch-impl.d.ts +5 -0
  56. package/src/executors/tsc/tsc.batch-impl.js +180 -0
  57. package/src/executors/tsc/tsc.impl.d.ts +7 -0
  58. package/src/executors/tsc/tsc.impl.js +97 -0
  59. package/src/executors/verdaccio/schema.d.ts +7 -0
  60. package/src/executors/verdaccio/schema.json +35 -0
  61. package/src/executors/verdaccio/verdaccio.impl.d.ts +12 -0
  62. package/src/executors/verdaccio/verdaccio.impl.js +220 -0
  63. package/src/generators/convert-to-swc/convert-to-swc.d.ts +4 -0
  64. package/src/generators/convert-to-swc/convert-to-swc.js +59 -0
  65. package/src/generators/convert-to-swc/schema.d.ts +4 -0
  66. package/src/generators/convert-to-swc/schema.json +36 -0
  67. package/src/generators/init/files/__fileName__ +20 -0
  68. package/src/generators/init/init.d.ts +4 -0
  69. package/src/generators/init/init.js +114 -0
  70. package/src/generators/init/schema.d.ts +7 -0
  71. package/src/generators/init/schema.json +36 -0
  72. package/src/generators/library/files/jest-config/jest.config.__ext__ +30 -0
  73. package/src/generators/library/files/lib/src/index.ts__tmpl__ +1 -0
  74. package/src/generators/library/files/lib/src/lib/__fileName__.spec.ts__tmpl__ +7 -0
  75. package/src/generators/library/files/lib/src/lib/__fileName__.ts__tmpl__ +3 -0
  76. package/src/generators/library/files/lib/tsconfig.lib.json__tmpl__ +14 -0
  77. package/src/generators/library/files/readme/README.md +19 -0
  78. package/src/generators/library/library.d.ts +16 -0
  79. package/src/generators/library/library.js +751 -0
  80. package/src/generators/library/schema.json +151 -0
  81. package/src/generators/release-version/release-version.d.ts +5 -0
  82. package/src/generators/release-version/release-version.js +390 -0
  83. package/src/generators/release-version/schema.d.ts +1 -0
  84. package/src/generators/release-version/schema.json +67 -0
  85. package/src/generators/release-version/test-utils/create-workspace-with-package-dependencies.d.ts +16 -0
  86. package/src/generators/release-version/test-utils/create-workspace-with-package-dependencies.js +40 -0
  87. package/src/generators/release-version/utils/package.d.ts +12 -0
  88. package/src/generators/release-version/utils/package.js +34 -0
  89. package/src/generators/release-version/utils/resolve-local-package-dependencies.d.ts +12 -0
  90. package/src/generators/release-version/utils/resolve-local-package-dependencies.js +78 -0
  91. package/src/generators/release-version/utils/resolve-version-spec.d.ts +1 -0
  92. package/src/generators/release-version/utils/resolve-version-spec.js +29 -0
  93. package/src/generators/release-version/utils/update-lock-file.d.ts +5 -0
  94. package/src/generators/release-version/utils/update-lock-file.js +105 -0
  95. package/src/generators/setup-build/generator.d.ts +4 -0
  96. package/src/generators/setup-build/generator.js +142 -0
  97. package/src/generators/setup-build/schema.d.ts +7 -0
  98. package/src/generators/setup-build/schema.json +42 -0
  99. package/src/generators/setup-verdaccio/files/config.yml +28 -0
  100. package/src/generators/setup-verdaccio/generator.d.ts +4 -0
  101. package/src/generators/setup-verdaccio/generator.js +56 -0
  102. package/src/generators/setup-verdaccio/schema.d.ts +3 -0
  103. package/src/generators/setup-verdaccio/schema.json +16 -0
  104. package/src/index.d.ts +17 -0
  105. package/src/index.js +28 -0
  106. package/src/internal.d.ts +4 -0
  107. package/src/internal.js +15 -0
  108. package/src/migrations/update-15-8-0/rename-swcrc-config.d.ts +2 -0
  109. package/src/migrations/update-15-8-0/rename-swcrc-config.js +77 -0
  110. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.d.ts +2 -0
  111. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +9 -0
  112. package/src/migrations/update-16-6-0/explicitly-set-projects-to-update-buildable-deps.d.ts +2 -0
  113. package/src/migrations/update-16-6-0/explicitly-set-projects-to-update-buildable-deps.js +34 -0
  114. package/src/migrations/update-16-8-2/update-swcrc.d.ts +2 -0
  115. package/src/migrations/update-16-8-2/update-swcrc.js +23 -0
  116. package/src/migrations/update-17-0-0/remove-deprecated-build-options.d.ts +6 -0
  117. package/src/migrations/update-17-0-0/remove-deprecated-build-options.js +30 -0
  118. package/src/plugins/jest/start-local-registry.d.ts +12 -0
  119. package/src/plugins/jest/start-local-registry.js +63 -0
  120. package/src/plugins/rollup/type-definitions.d.ts +8 -0
  121. package/src/plugins/rollup/type-definitions.js +48 -0
  122. package/src/utils/add-babel-inputs.d.ts +3 -0
  123. package/src/utils/add-babel-inputs.js +23 -0
  124. package/src/utils/add-local-registry-scripts.d.ts +5 -0
  125. package/src/utils/add-local-registry-scripts.js +77 -0
  126. package/src/utils/assets/assets.d.ts +10 -0
  127. package/src/utils/assets/assets.js +36 -0
  128. package/src/utils/assets/copy-assets-handler.d.ts +32 -0
  129. package/src/utils/assets/copy-assets-handler.js +154 -0
  130. package/src/utils/assets/index.d.ts +16 -0
  131. package/src/utils/assets/index.js +27 -0
  132. package/src/utils/buildable-libs-utils.d.ts +43 -0
  133. package/src/utils/buildable-libs-utils.js +375 -0
  134. package/src/utils/check-dependencies.d.ts +8 -0
  135. package/src/utils/check-dependencies.js +23 -0
  136. package/src/utils/code-frames/highlight.d.ts +1 -0
  137. package/src/utils/code-frames/highlight.js +86 -0
  138. package/src/utils/code-frames/identifiers.d.ts +5 -0
  139. package/src/utils/code-frames/identifiers.js +52 -0
  140. package/src/utils/compiler-helper-dependency.d.ts +18 -0
  141. package/src/utils/compiler-helper-dependency.js +120 -0
  142. package/src/utils/find-npm-dependencies.d.ts +9 -0
  143. package/src/utils/find-npm-dependencies.js +140 -0
  144. package/src/utils/generate-globs.d.ts +6 -0
  145. package/src/utils/generate-globs.js +80 -0
  146. package/src/utils/get-import-path.d.ts +5 -0
  147. package/src/utils/get-import-path.js +14 -0
  148. package/src/utils/get-main-file-dir.d.ts +1 -0
  149. package/src/utils/get-main-file-dir.js +11 -0
  150. package/src/utils/inline.d.ts +19 -0
  151. package/src/utils/inline.js +210 -0
  152. package/src/utils/package-json/create-entry-points.d.ts +1 -0
  153. package/src/utils/package-json/create-entry-points.js +23 -0
  154. package/src/utils/package-json/get-npm-scope.d.ts +5 -0
  155. package/src/utils/package-json/get-npm-scope.js +16 -0
  156. package/src/utils/package-json/index.d.ts +13 -0
  157. package/src/utils/package-json/index.js +30 -0
  158. package/src/utils/package-json/update-package-json.d.ts +30 -0
  159. package/src/utils/package-json/update-package-json.js +179 -0
  160. package/src/utils/prettier.d.ts +6 -0
  161. package/src/utils/prettier.js +34 -0
  162. package/src/utils/schema.d.ts +87 -0
  163. package/src/utils/swc/add-swc-config.d.ts +3 -0
  164. package/src/utils/swc/add-swc-config.js +41 -0
  165. package/src/utils/swc/add-swc-dependencies.d.ts +3 -0
  166. package/src/utils/swc/add-swc-dependencies.js +18 -0
  167. package/src/utils/swc/compile-swc.d.ts +13 -0
  168. package/src/utils/swc/compile-swc.js +160 -0
  169. package/src/utils/swc/get-swcrc-path.d.ts +5 -0
  170. package/src/utils/swc/get-swcrc-path.js +15 -0
  171. package/src/utils/swc/inline.d.ts +2 -0
  172. package/src/utils/swc/inline.js +11 -0
  173. package/src/utils/typescript/__mocks__/plugin-a.d.ts +1 -0
  174. package/src/utils/typescript/__mocks__/plugin-a.js +5 -0
  175. package/src/utils/typescript/__mocks__/plugin-b.d.ts +1 -0
  176. package/src/utils/typescript/__mocks__/plugin-b.js +5 -0
  177. package/src/utils/typescript/add-tslib-dependencies.d.ts +2 -0
  178. package/src/utils/typescript/add-tslib-dependencies.js +11 -0
  179. package/src/utils/typescript/ast-utils.d.ts +32 -0
  180. package/src/utils/typescript/ast-utils.js +266 -0
  181. package/src/utils/typescript/compile-typescript-files.d.ts +10 -0
  182. package/src/utils/typescript/compile-typescript-files.js +43 -0
  183. package/src/utils/typescript/create-ts-config.d.ts +18 -0
  184. package/src/utils/typescript/create-ts-config.js +48 -0
  185. package/src/utils/typescript/ensure-typescript.d.ts +1 -0
  186. package/src/utils/typescript/ensure-typescript.js +9 -0
  187. package/src/utils/typescript/get-source-nodes.d.ts +2 -0
  188. package/src/utils/typescript/get-source-nodes.js +18 -0
  189. package/src/utils/typescript/load-ts-transformers.d.ts +5 -0
  190. package/src/utils/typescript/load-ts-transformers.js +62 -0
  191. package/src/utils/typescript/print-diagnostics.d.ts +1 -0
  192. package/src/utils/typescript/print-diagnostics.js +18 -0
  193. package/src/utils/typescript/run-type-check.d.ts +32 -0
  194. package/src/utils/typescript/run-type-check.js +128 -0
  195. package/src/utils/typescript/ts-config.d.ts +9 -0
  196. package/src/utils/typescript/ts-config.js +85 -0
  197. package/src/utils/typescript/tsnode-register.d.ts +1 -0
  198. package/src/utils/typescript/tsnode-register.js +24 -0
  199. package/src/utils/typescript/types.d.ts +18 -0
  200. package/src/utils/typescript/types.js +2 -0
  201. package/src/utils/versions.d.ts +17 -0
  202. package/src/utils/versions.js +21 -0
  203. package/src/utils/watch-for-single-file-changes.d.ts +1 -0
  204. package/src/utils/watch-for-single-file-changes.js +22 -0
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ (The MIT License)
2
+
3
+ Copyright (c) 2017-2023 Narwhal Technologies Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ 'Software'), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,68 @@
1
+ <p style="text-align: center;">
2
+ <picture>
3
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-dark.svg">
4
+ <img alt="Nx - Smart Monorepos · Fast CI" src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-light.svg" width="100%">
5
+ </picture>
6
+ </p>
7
+
8
+ <div style="text-align: center;">
9
+
10
+ [![CircleCI](https://circleci.com/gh/nrwl/nx.svg?style=svg)](https://circleci.com/gh/nrwl/nx)
11
+ [![License](https://img.shields.io/npm/l/@nx/workspace.svg?style=flat-square)]()
12
+ [![NPM Version](https://badge.fury.io/js/%40nrwl%2Fworkspace.svg)](https://www.npmjs.com/@nx/workspace)
13
+ [![Semantic Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square)]()
14
+ [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
15
+ [![Join the chat at https://gitter.im/nrwl-nx/community](https://badges.gitter.im/nrwl-nx/community.svg)](https://gitter.im/nrwl-nx/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
16
+ [![Join us on the Official Nx Discord Server](https://img.shields.io/discord/1143497901675401286?label=discord)](https://go.nx.dev/community)
17
+
18
+ </div>
19
+
20
+
21
+ <hr>
22
+
23
+ # Nx: Smart Monorepos · Fast CI
24
+
25
+ Nx is a build system with built-in tooling and advanced CI capabilities. It helps you maintain and scale monorepos, both locally and on CI.
26
+
27
+ This package is a [JavaScript/TypeScript plugin for Nx](https://nx.dev/js/overview).
28
+
29
+ ## Getting Started
30
+
31
+ ### Creating an Nx Workspace
32
+
33
+ **Using `npx`**
34
+
35
+ ```bash
36
+ npx create-nx-workspace
37
+ ```
38
+
39
+ **Using `npm init`**
40
+
41
+ ```bash
42
+ npm init nx-workspace
43
+ ```
44
+
45
+ **Using `yarn create`**
46
+
47
+ ```bash
48
+ yarn create nx-workspace
49
+ ```
50
+
51
+ ### Adding Nx to an Existing Repository
52
+
53
+ Run:
54
+
55
+ ```bash
56
+ npx nx@latest init
57
+ ```
58
+
59
+ ## Documentation & Resources
60
+
61
+ - [Nx.Dev: Documentation, Guides, Tutorials](https://nx.dev)
62
+ - [Intro to Nx](https://nx.dev/getting-started/intro)
63
+ - [Official Nx YouTube Channel](https://www.youtube.com/@NxDevtools)
64
+ - [Blog Posts About Nx](https://blog.nrwl.io/nx/home)
65
+
66
+ <p style="text-align: center;"><a href="https://nx.dev/#learning-materials" target="_blank" rel="noreferrer"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-courses-and-videos.svg"
67
+ width="100%" alt="Nx - Smart Monorepos · Fast CI"></a></p>
68
+
package/babel.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ export interface NxWebBabelPresetOptions {
2
+ useBuiltIns?: boolean | string;
3
+ decorators?: {
4
+ decoratorsBeforeExport?: boolean;
5
+ legacy?: boolean;
6
+ };
7
+ loose?: boolean;
8
+ /** @deprecated Use `loose` option instead of `classProperties.loose`
9
+ */
10
+ classProperties?: {
11
+ loose?: boolean;
12
+ };
13
+ }
package/babel.js ADDED
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const path_1 = require("path");
4
+ const devkit_1 = require("@nx/devkit");
5
+ module.exports = function (api, options = {}) {
6
+ api.assertVersion(7);
7
+ const isModern = api.caller((caller) => caller?.isModern);
8
+ // use by @nx/cypress react component testing to prevent core js build issues
9
+ const isTest = api.caller((caller) => caller?.isTest);
10
+ // This is set by `@nx/rollup:rollup` executor
11
+ const isNxPackage = api.caller((caller) => caller?.isNxPackage);
12
+ const emitDecoratorMetadata = api.caller((caller) => caller?.emitDecoratorMetadata ?? true);
13
+ // Determine settings for `@babel//babel-plugin-transform-class-properties`,
14
+ // so that we can sync the `loose` option with `@babel/preset-env`.
15
+ // TODO(v19): Remove classProperties since it's no longer needed, now that the class props transform is in preset-env.
16
+ const loose = options.classProperties?.loose ?? options.loose ?? true;
17
+ if (options.classProperties) {
18
+ devkit_1.logger.warn(`Use =\`loose\` option instead of \`classProperties.loose\`. The \`classProperties\` option will be removed in Nx 19`);
19
+ }
20
+ return {
21
+ presets: [
22
+ // Support module/nomodule pattern.
23
+ [
24
+ require.resolve('@babel/preset-env'),
25
+ // For Jest tests, NODE_ENV is set as 'test' and we only want to set target as Node.
26
+ // All other options will fail in Jest since Node does not support some ES features
27
+ // such as import syntax.
28
+ isTest || process.env.NODE_ENV === 'test' || process.env.JEST_WORKER_ID
29
+ ? { targets: { node: 'current' }, loose: true }
30
+ : {
31
+ // Allow importing core-js in entrypoint and use browserslist to select polyfills.
32
+ useBuiltIns: options.useBuiltIns ?? 'entry',
33
+ corejs: options.useBuiltIns !== false ? 3 : null,
34
+ // Do not transform modules to CJS
35
+ modules: false,
36
+ targets: isModern ? { esmodules: 'intersect' } : undefined,
37
+ bugfixes: true,
38
+ // Exclude transforms that make all code slower
39
+ exclude: ['transform-typeof-symbol'],
40
+ // This must match the setting for `@babel/plugin-proposal-class-properties`
41
+ loose,
42
+ },
43
+ ],
44
+ [
45
+ require.resolve('@babel/preset-typescript'),
46
+ {
47
+ allowDeclareFields: true,
48
+ },
49
+ ],
50
+ ],
51
+ plugins: [
52
+ !isNxPackage
53
+ ? [
54
+ require.resolve('@babel/plugin-transform-runtime'),
55
+ {
56
+ corejs: false,
57
+ helpers: true,
58
+ regenerator: true,
59
+ useESModules: isModern,
60
+ absoluteRuntime: (0, path_1.dirname)(require.resolve('@babel/runtime/package.json')),
61
+ },
62
+ ]
63
+ : null,
64
+ require.resolve('babel-plugin-macros'),
65
+ emitDecoratorMetadata
66
+ ? require.resolve('babel-plugin-transform-typescript-metadata')
67
+ : undefined,
68
+ // Must use legacy decorators to remain compatible with TypeScript.
69
+ [
70
+ require.resolve('@babel/plugin-proposal-decorators'),
71
+ options.decorators ?? { legacy: true },
72
+ ],
73
+ [require.resolve('@babel/plugin-transform-class-properties'), { loose }],
74
+ ].filter(Boolean),
75
+ overrides: [
76
+ // Convert `const enum` to `enum`. The former cannot be supported by babel
77
+ // but at least we can get it to not error out.
78
+ {
79
+ test: /\.tsx?$/,
80
+ plugins: [
81
+ [
82
+ require.resolve('babel-plugin-const-enum'),
83
+ {
84
+ transform: 'removeConst',
85
+ },
86
+ ],
87
+ ],
88
+ },
89
+ ],
90
+ };
91
+ };
package/executors.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "$schema": "https://json-schema.org/schema",
3
+ "executors": {
4
+ "tsc": {
5
+ "implementation": "./src/executors/tsc/tsc.impl",
6
+ "batchImplementation": "./src/executors/tsc/tsc.batch-impl",
7
+ "schema": "./src/executors/tsc/schema.json",
8
+ "description": "Build a project using TypeScript."
9
+ },
10
+ "swc": {
11
+ "implementation": "./src/executors/swc/swc.impl",
12
+ "schema": "./src/executors/swc/schema.json",
13
+ "description": "Build a project using SWC."
14
+ },
15
+ "node": {
16
+ "implementation": "./src/executors/node/node.impl",
17
+ "schema": "./src/executors/node/schema.json",
18
+ "description": "Execute a Node application."
19
+ },
20
+ "release-publish": {
21
+ "implementation": "./src/executors/release-publish/release-publish.impl",
22
+ "schema": "./src/executors/release-publish/schema.json",
23
+ "description": "DO NOT INVOKE DIRECTLY WITH `nx run`. Use `nx release publish` instead.",
24
+ "hidden": true
25
+ },
26
+ "verdaccio": {
27
+ "implementation": "./src/executors/verdaccio/verdaccio.impl",
28
+ "schema": "./src/executors/verdaccio/schema.json",
29
+ "description": "Start local registry with verdaccio"
30
+ }
31
+ }
32
+ }
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "nx/js",
3
+ "version": "0.1",
4
+ "generators": {
5
+ "library": {
6
+ "factory": "./src/generators/library/library#libraryGeneratorInternal",
7
+ "schema": "./src/generators/library/schema.json",
8
+ "aliases": ["lib"],
9
+ "x-type": "library",
10
+ "description": "Create a library"
11
+ },
12
+ "init": {
13
+ "factory": "./src/generators/init/init#initGenerator",
14
+ "schema": "./src/generators/init/schema.json",
15
+ "aliases": ["lib"],
16
+ "x-type": "init",
17
+ "description": "Initialize a TS/JS workspace.",
18
+ "hidden": true
19
+ },
20
+ "convert-to-swc": {
21
+ "factory": "./src/generators/convert-to-swc/convert-to-swc#convertToSwcGenerator",
22
+ "schema": "./src/generators/convert-to-swc/schema.json",
23
+ "aliases": ["swc"],
24
+ "x-type": "library",
25
+ "description": "Convert a TypeScript library to compile with SWC."
26
+ },
27
+ "release-version": {
28
+ "factory": "./src/generators/release-version/release-version#releaseVersionGenerator",
29
+ "schema": "./src/generators/release-version/schema.json",
30
+ "description": "DO NOT INVOKE DIRECTLY WITH `nx generate`. Use `nx release version` instead.",
31
+ "hidden": true
32
+ },
33
+ "setup-verdaccio": {
34
+ "factory": "./src/generators/setup-verdaccio/generator#setupVerdaccio",
35
+ "schema": "./src/generators/setup-verdaccio/schema.json",
36
+ "alias": ["verdaccio"],
37
+ "description": "Setup Verdaccio for local package management."
38
+ },
39
+ "setup-build": {
40
+ "factory": "./src/generators/setup-build/generator",
41
+ "schema": "./src/generators/setup-build/schema.json",
42
+ "alias": ["build"],
43
+ "description": "setup-build generator"
44
+ }
45
+ }
46
+ }
@@ -0,0 +1,159 @@
1
+ {
2
+ "generators": {
3
+ "rename-swcrc-config": {
4
+ "cli": "nx",
5
+ "version": "15.8.0-beta.0",
6
+ "description": "Rename .lib.swcrc to .swcrc for better SWC support throughout the workspace",
7
+ "factory": "./src/migrations/update-15-8-0/rename-swcrc-config"
8
+ },
9
+ "update-16-0-0-add-nx-packages": {
10
+ "cli": "nx",
11
+ "version": "16.0.0-beta.1",
12
+ "description": "Replace @nrwl/js with @nx/js",
13
+ "implementation": "./src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages"
14
+ },
15
+ "explicitly-set-projects-to-update-buildable-deps": {
16
+ "cli": "nx",
17
+ "version": "16.6.0-beta.0",
18
+ "description": "Explicitly set 'updateBuildableProjectDepsInPackageJson' to 'true' in targets that rely on that value as the default.",
19
+ "factory": "./src/migrations/update-16-6-0/explicitly-set-projects-to-update-buildable-deps"
20
+ },
21
+ "16-8-2-update-swcrc": {
22
+ "cli": "nx",
23
+ "version": "16.8.2-beta.0",
24
+ "description": "Remove invalid options (strict, noInterop) for ES6 type modules.",
25
+ "factory": "./src/migrations/update-16-8-2/update-swcrc"
26
+ },
27
+ "update-17-0-0-remove-deprecated-build-options": {
28
+ "cli": "nx",
29
+ "version": "17.0.2",
30
+ "description": "Remove deprecated build options",
31
+ "implementation": "./src/migrations/update-17-0-0/remove-deprecated-build-options"
32
+ }
33
+ },
34
+ "packageJsonUpdates": {
35
+ "15.8.0": {
36
+ "version": "15.8.0-beta.2",
37
+ "x-prompt": "Do you want to update to TypeScript v4.9?",
38
+ "requires": {
39
+ "typescript": ">=4.8.2 <4.9.0"
40
+ },
41
+ "packages": {
42
+ "typescript": {
43
+ "version": "~4.9.5"
44
+ }
45
+ }
46
+ },
47
+ "16.0.0": {
48
+ "version": "16.0.0-beta.3",
49
+ "packages": {
50
+ "@swc/cli": {
51
+ "version": "~0.1.62",
52
+ "alwaysAddToPackageJson": false
53
+ },
54
+ "@swc/helpers": {
55
+ "version": "~0.5.0",
56
+ "alwaysAddToPackageJson": false
57
+ }
58
+ }
59
+ },
60
+ "16.1.0": {
61
+ "version": "16.1.0-beta.0",
62
+ "x-prompt": "Do you want to update to TypeScript v5.0?",
63
+ "requires": {
64
+ "typescript": ">=4.9.5 <5.0.0"
65
+ },
66
+ "packages": {
67
+ "typescript": {
68
+ "version": "~5.0.2"
69
+ }
70
+ }
71
+ },
72
+ "16.4.0": {
73
+ "version": "16.4.0-beta.11",
74
+ "x-prompt": "Do you want to update to TypeScript v5.1?",
75
+ "requires": {
76
+ "typescript": ">=5.0.0 <5.1.0"
77
+ },
78
+ "packages": {
79
+ "typescript": {
80
+ "version": "~5.1.3"
81
+ }
82
+ }
83
+ },
84
+ "16.8.2": {
85
+ "version": "16.8.2-beta.0",
86
+ "packages": {
87
+ "@swc/core": {
88
+ "version": "~1.3.85",
89
+ "alwaysAddToPackageJson": false
90
+ },
91
+ "@swc/helpers": {
92
+ "version": "~0.5.2",
93
+ "alwaysAddToPackageJson": false
94
+ }
95
+ }
96
+ },
97
+ "16.9.2": {
98
+ "version": "16.9.2-beta.0",
99
+ "packages": {
100
+ "@swc-node/register": {
101
+ "version": "~1.6.7",
102
+ "alwaysAddToPackageJson": false
103
+ }
104
+ }
105
+ },
106
+ "17.0.0": {
107
+ "version": "17.0.0-rc.2",
108
+ "packages": {
109
+ "esbuild": {
110
+ "version": "^0.19.2",
111
+ "alwaysAddToPackageJson": false
112
+ }
113
+ }
114
+ },
115
+ "17.1.0": {
116
+ "version": "17.1.0-beta.4",
117
+ "x-prompt": "Do you want to update to TypeScript v5.2?",
118
+ "requires": {
119
+ "typescript": ">=5.1.0 <5.2.0"
120
+ },
121
+ "packages": {
122
+ "typescript": {
123
+ "version": "~5.2.2"
124
+ }
125
+ }
126
+ },
127
+ "17.3.0": {
128
+ "version": "17.3.0-beta.3",
129
+ "packages": {
130
+ "@types/node": {
131
+ "version": "^18.16.9",
132
+ "alwaysAddToPackageJson": false
133
+ }
134
+ }
135
+ },
136
+ "17.3.0-beta.10": {
137
+ "version": "17.3.0-beta.10",
138
+ "x-prompt": "Do you want to update to TypeScript v5.3?",
139
+ "requires": {
140
+ "typescript": ">=5.2.0 <5.3.0"
141
+ },
142
+ "packages": {
143
+ "typescript": {
144
+ "version": "~5.3.2",
145
+ "alwaysAddToPackageJson": false
146
+ }
147
+ }
148
+ },
149
+ "18.0.4": {
150
+ "version": "18.0.4-beta.0",
151
+ "packages": {
152
+ "@swc-node/register": {
153
+ "version": "~1.8.0",
154
+ "alwaysAddToPackageJson": false
155
+ }
156
+ }
157
+ }
158
+ }
159
+ }
package/package.json ADDED
@@ -0,0 +1,76 @@
1
+ {
2
+ "name": "@nx/js",
3
+ "version": "0.0.0-pr-22179-271588f",
4
+ "private": false,
5
+ "description": "The JS plugin for Nx contains executors and generators that provide the best experience for developing JavaScript and TypeScript projects. ",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/nrwl/nx.git",
9
+ "directory": "packages/js"
10
+ },
11
+ "keywords": [
12
+ "Monorepo",
13
+ "Web",
14
+ "Node",
15
+ "Swc",
16
+ "Tsc",
17
+ "CLI"
18
+ ],
19
+ "main": "./src/index.js",
20
+ "typings": "src/index.d.ts",
21
+ "license": "MIT",
22
+ "bugs": {
23
+ "url": "https://github.com/nrwl/nx/issues"
24
+ },
25
+ "homepage": "https://nx.dev",
26
+ "ng-update": {
27
+ "requirements": {},
28
+ "migrations": "./migrations.json"
29
+ },
30
+ "generators": "./generators.json",
31
+ "executors": "./executors.json",
32
+ "dependencies": {
33
+ "@babel/core": "^7.23.2",
34
+ "@babel/plugin-proposal-decorators": "^7.22.7",
35
+ "@babel/plugin-transform-runtime": "^7.23.2",
36
+ "@babel/plugin-transform-class-properties": "^7.22.5",
37
+ "@babel/preset-env": "^7.23.2",
38
+ "@babel/preset-typescript": "^7.22.5",
39
+ "@babel/runtime": "^7.22.6",
40
+ "@phenomnomnominal/tsquery": "~5.0.1",
41
+ "babel-plugin-const-enum": "^1.0.1",
42
+ "babel-plugin-macros": "^2.8.0",
43
+ "babel-plugin-transform-typescript-metadata": "^0.3.1",
44
+ "chalk": "^4.1.0",
45
+ "columnify": "^1.6.0",
46
+ "detect-port": "^1.5.1",
47
+ "fast-glob": "3.2.7",
48
+ "fs-extra": "^11.1.0",
49
+ "npm-package-arg": "11.0.1",
50
+ "npm-run-path": "^4.0.1",
51
+ "ts-node": "10.9.1",
52
+ "tsconfig-paths": "^4.1.2",
53
+ "ignore": "^5.0.4",
54
+ "js-tokens": "^4.0.0",
55
+ "minimatch": "9.0.3",
56
+ "ora": "5.3.0",
57
+ "semver": "^7.5.3",
58
+ "source-map-support": "0.5.19",
59
+ "tslib": "^2.3.0",
60
+ "@nx/devkit": "0.0.0-pr-22179-271588f",
61
+ "@nx/workspace": "0.0.0-pr-22179-271588f",
62
+ "@nrwl/js": "0.0.0-pr-22179-271588f"
63
+ },
64
+ "peerDependencies": {
65
+ "verdaccio": "^5.0.4"
66
+ },
67
+ "peerDependenciesMeta": {
68
+ "verdaccio": {
69
+ "optional": true
70
+ }
71
+ },
72
+ "publishConfig": {
73
+ "access": "public"
74
+ },
75
+ "type": "commonjs"
76
+ }
@@ -0,0 +1 @@
1
+ export * from '../../src/plugins/jest/start-local-registry';
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("../../src/plugins/jest/start-local-registry"), exports);
@@ -0,0 +1,2 @@
1
+ /// <reference types="node" />
2
+ export declare function killTree(pid: number, signal: NodeJS.Signals): Promise<void>;
@@ -0,0 +1,114 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.killTree = void 0;
4
+ // Adapted from https://raw.githubusercontent.com/pkrumins/node-tree-kill/deee138/index.js
5
+ const child_process_1 = require("child_process");
6
+ async function killTree(pid, signal) {
7
+ const tree = {};
8
+ const pidsToProcess = {};
9
+ tree[pid] = [];
10
+ pidsToProcess[pid] = 1;
11
+ return new Promise((resolve, reject) => {
12
+ const callback = (error) => {
13
+ if (error) {
14
+ reject(error);
15
+ }
16
+ else {
17
+ resolve();
18
+ }
19
+ };
20
+ switch (process.platform) {
21
+ case 'win32':
22
+ (0, child_process_1.exec)('taskkill /pid ' + pid + ' /T /F', (error) => {
23
+ // Ignore Fatal errors (128) because it might be due to the process already being killed.
24
+ // On Linux/Mac we can check ESRCH (no such process), but on Windows we can't.
25
+ callback(error?.code !== 128 ? error : null);
26
+ });
27
+ break;
28
+ case 'darwin':
29
+ buildProcessTree(pid, tree, pidsToProcess, function (parentPid) {
30
+ return (0, child_process_1.spawn)('pgrep', ['-P', parentPid]);
31
+ }, function () {
32
+ killAll(tree, signal, callback);
33
+ });
34
+ break;
35
+ default: // Linux
36
+ buildProcessTree(pid, tree, pidsToProcess, function (parentPid) {
37
+ return (0, child_process_1.spawn)('ps', [
38
+ '-o',
39
+ 'pid',
40
+ '--no-headers',
41
+ '--ppid',
42
+ parentPid,
43
+ ]);
44
+ }, function () {
45
+ killAll(tree, signal, callback);
46
+ });
47
+ break;
48
+ }
49
+ });
50
+ }
51
+ exports.killTree = killTree;
52
+ function killAll(tree, signal, callback) {
53
+ const killed = {};
54
+ try {
55
+ Object.keys(tree).forEach(function (pid) {
56
+ tree[pid].forEach(function (pidpid) {
57
+ if (!killed[pidpid]) {
58
+ killPid(pidpid, signal);
59
+ killed[pidpid] = 1;
60
+ }
61
+ });
62
+ if (!killed[pid]) {
63
+ killPid(pid, signal);
64
+ killed[pid] = 1;
65
+ }
66
+ });
67
+ }
68
+ catch (err) {
69
+ if (callback) {
70
+ return callback(err);
71
+ }
72
+ else {
73
+ throw err;
74
+ }
75
+ }
76
+ if (callback) {
77
+ return callback();
78
+ }
79
+ }
80
+ function killPid(pid, signal) {
81
+ try {
82
+ process.kill(parseInt(pid, 10), signal);
83
+ }
84
+ catch (err) {
85
+ if (err.code !== 'ESRCH')
86
+ throw err;
87
+ }
88
+ }
89
+ function buildProcessTree(parentPid, tree, pidsToProcess, spawnChildProcessesList, cb) {
90
+ const ps = spawnChildProcessesList(parentPid);
91
+ let allData = '';
92
+ ps.stdout.on('data', (data) => {
93
+ data = data.toString('ascii');
94
+ allData += data;
95
+ });
96
+ const onClose = function (code) {
97
+ delete pidsToProcess[parentPid];
98
+ if (code != 0) {
99
+ // no more parent processes
100
+ if (Object.keys(pidsToProcess).length == 0) {
101
+ cb();
102
+ }
103
+ return;
104
+ }
105
+ allData.match(/\d+/g).forEach((_pid) => {
106
+ const pid = parseInt(_pid, 10);
107
+ tree[parentPid].push(pid);
108
+ tree[pid] = [];
109
+ pidsToProcess[pid] = 1;
110
+ buildProcessTree(pid, tree, pidsToProcess, spawnChildProcessesList, cb);
111
+ });
112
+ };
113
+ ps.on('close', onClose);
114
+ }
@@ -0,0 +1,7 @@
1
+ declare const Module: any;
2
+ declare const url: any;
3
+ declare const originalLoader: any;
4
+ declare const dynamicImport: Function;
5
+ declare const mappings: any;
6
+ declare const keys: string[];
7
+ declare const fileToRun: any;
@@ -0,0 +1,21 @@
1
+ const Module = require('module');
2
+ const url = require('node:url');
3
+ const originalLoader = Module._load;
4
+ const dynamicImport = new Function('specifier', 'return import(specifier)');
5
+ const mappings = JSON.parse(process.env.NX_MAPPINGS);
6
+ const keys = Object.keys(mappings);
7
+ const fileToRun = url.pathToFileURL(process.env.NX_FILE_TO_RUN);
8
+ Module._load = function (request, parent) {
9
+ if (!parent)
10
+ return originalLoader.apply(this, arguments);
11
+ const match = keys.find((k) => request === k);
12
+ if (match) {
13
+ const newArguments = [...arguments];
14
+ newArguments[0] = mappings[match];
15
+ return originalLoader.apply(this, newArguments);
16
+ }
17
+ else {
18
+ return originalLoader.apply(this, arguments);
19
+ }
20
+ };
21
+ dynamicImport(fileToRun);