@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.
- package/LICENSE +22 -0
- package/README.md +68 -0
- package/babel.d.ts +13 -0
- package/babel.js +91 -0
- package/executors.json +32 -0
- package/generators.json +46 -0
- package/migrations.json +159 -0
- package/package.json +76 -0
- package/plugins/jest/local-registry.d.ts +1 -0
- package/plugins/jest/local-registry.js +4 -0
- package/src/executors/node/lib/kill-tree.d.ts +2 -0
- package/src/executors/node/lib/kill-tree.js +114 -0
- package/src/executors/node/node-with-require-overrides.d.ts +7 -0
- package/src/executors/node/node-with-require-overrides.js +21 -0
- package/src/executors/node/node.impl.d.ts +7 -0
- package/src/executors/node/node.impl.js +288 -0
- package/src/executors/node/schema.d.ts +18 -0
- package/src/executors/node/schema.json +92 -0
- package/src/executors/release-publish/format-bytes.d.ts +1 -0
- package/src/executors/release-publish/format-bytes.js +28 -0
- package/src/executors/release-publish/log-tar.d.ts +1 -0
- package/src/executors/release-publish/log-tar.js +68 -0
- package/src/executors/release-publish/release-publish.impl.d.ts +5 -0
- package/src/executors/release-publish/release-publish.impl.js +198 -0
- package/src/executors/release-publish/schema.d.ts +8 -0
- package/src/executors/release-publish/schema.json +26 -0
- package/src/executors/swc/schema.json +154 -0
- package/src/executors/swc/swc.impl.d.ts +10 -0
- package/src/executors/swc/swc.impl.js +149 -0
- package/src/executors/tsc/lib/batch/build-task-info-per-tsconfig-map.d.ts +5 -0
- package/src/executors/tsc/lib/batch/build-task-info-per-tsconfig-map.js +62 -0
- package/src/executors/tsc/lib/batch/index.d.ts +4 -0
- package/src/executors/tsc/lib/batch/index.js +7 -0
- package/src/executors/tsc/lib/batch/normalize-tasks-options.d.ts +3 -0
- package/src/executors/tsc/lib/batch/normalize-tasks-options.js +14 -0
- package/src/executors/tsc/lib/batch/types.d.ts +17 -0
- package/src/executors/tsc/lib/batch/types.js +2 -0
- package/src/executors/tsc/lib/batch/watch.d.ts +3 -0
- package/src/executors/tsc/lib/batch/watch.js +56 -0
- package/src/executors/tsc/lib/get-custom-transformers-factory.d.ts +3 -0
- package/src/executors/tsc/lib/get-custom-transformers-factory.js +13 -0
- package/src/executors/tsc/lib/get-task-options.d.ts +3 -0
- package/src/executors/tsc/lib/get-task-options.js +34 -0
- package/src/executors/tsc/lib/get-tsconfig.d.ts +4 -0
- package/src/executors/tsc/lib/get-tsconfig.js +86 -0
- package/src/executors/tsc/lib/index.d.ts +4 -0
- package/src/executors/tsc/lib/index.js +7 -0
- package/src/executors/tsc/lib/normalize-options.d.ts +2 -0
- package/src/executors/tsc/lib/normalize-options.js +39 -0
- package/src/executors/tsc/lib/typescript-compilation.d.ts +29 -0
- package/src/executors/tsc/lib/typescript-compilation.js +203 -0
- package/src/executors/tsc/lib/typescript-diagnostic-reporters.d.ts +3 -0
- package/src/executors/tsc/lib/typescript-diagnostic-reporters.js +37 -0
- package/src/executors/tsc/schema.json +163 -0
- package/src/executors/tsc/tsc.batch-impl.d.ts +5 -0
- package/src/executors/tsc/tsc.batch-impl.js +180 -0
- package/src/executors/tsc/tsc.impl.d.ts +7 -0
- package/src/executors/tsc/tsc.impl.js +97 -0
- package/src/executors/verdaccio/schema.d.ts +7 -0
- package/src/executors/verdaccio/schema.json +35 -0
- package/src/executors/verdaccio/verdaccio.impl.d.ts +12 -0
- package/src/executors/verdaccio/verdaccio.impl.js +220 -0
- package/src/generators/convert-to-swc/convert-to-swc.d.ts +4 -0
- package/src/generators/convert-to-swc/convert-to-swc.js +59 -0
- package/src/generators/convert-to-swc/schema.d.ts +4 -0
- package/src/generators/convert-to-swc/schema.json +36 -0
- package/src/generators/init/files/__fileName__ +20 -0
- package/src/generators/init/init.d.ts +4 -0
- package/src/generators/init/init.js +114 -0
- package/src/generators/init/schema.d.ts +7 -0
- package/src/generators/init/schema.json +36 -0
- package/src/generators/library/files/jest-config/jest.config.__ext__ +30 -0
- package/src/generators/library/files/lib/src/index.ts__tmpl__ +1 -0
- package/src/generators/library/files/lib/src/lib/__fileName__.spec.ts__tmpl__ +7 -0
- package/src/generators/library/files/lib/src/lib/__fileName__.ts__tmpl__ +3 -0
- package/src/generators/library/files/lib/tsconfig.lib.json__tmpl__ +14 -0
- package/src/generators/library/files/readme/README.md +19 -0
- package/src/generators/library/library.d.ts +16 -0
- package/src/generators/library/library.js +751 -0
- package/src/generators/library/schema.json +151 -0
- package/src/generators/release-version/release-version.d.ts +5 -0
- package/src/generators/release-version/release-version.js +390 -0
- package/src/generators/release-version/schema.d.ts +1 -0
- package/src/generators/release-version/schema.json +67 -0
- package/src/generators/release-version/test-utils/create-workspace-with-package-dependencies.d.ts +16 -0
- package/src/generators/release-version/test-utils/create-workspace-with-package-dependencies.js +40 -0
- package/src/generators/release-version/utils/package.d.ts +12 -0
- package/src/generators/release-version/utils/package.js +34 -0
- package/src/generators/release-version/utils/resolve-local-package-dependencies.d.ts +12 -0
- package/src/generators/release-version/utils/resolve-local-package-dependencies.js +78 -0
- package/src/generators/release-version/utils/resolve-version-spec.d.ts +1 -0
- package/src/generators/release-version/utils/resolve-version-spec.js +29 -0
- package/src/generators/release-version/utils/update-lock-file.d.ts +5 -0
- package/src/generators/release-version/utils/update-lock-file.js +105 -0
- package/src/generators/setup-build/generator.d.ts +4 -0
- package/src/generators/setup-build/generator.js +142 -0
- package/src/generators/setup-build/schema.d.ts +7 -0
- package/src/generators/setup-build/schema.json +42 -0
- package/src/generators/setup-verdaccio/files/config.yml +28 -0
- package/src/generators/setup-verdaccio/generator.d.ts +4 -0
- package/src/generators/setup-verdaccio/generator.js +56 -0
- package/src/generators/setup-verdaccio/schema.d.ts +3 -0
- package/src/generators/setup-verdaccio/schema.json +16 -0
- package/src/index.d.ts +17 -0
- package/src/index.js +28 -0
- package/src/internal.d.ts +4 -0
- package/src/internal.js +15 -0
- package/src/migrations/update-15-8-0/rename-swcrc-config.d.ts +2 -0
- package/src/migrations/update-15-8-0/rename-swcrc-config.js +77 -0
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.d.ts +2 -0
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +9 -0
- package/src/migrations/update-16-6-0/explicitly-set-projects-to-update-buildable-deps.d.ts +2 -0
- package/src/migrations/update-16-6-0/explicitly-set-projects-to-update-buildable-deps.js +34 -0
- package/src/migrations/update-16-8-2/update-swcrc.d.ts +2 -0
- package/src/migrations/update-16-8-2/update-swcrc.js +23 -0
- package/src/migrations/update-17-0-0/remove-deprecated-build-options.d.ts +6 -0
- package/src/migrations/update-17-0-0/remove-deprecated-build-options.js +30 -0
- package/src/plugins/jest/start-local-registry.d.ts +12 -0
- package/src/plugins/jest/start-local-registry.js +63 -0
- package/src/plugins/rollup/type-definitions.d.ts +8 -0
- package/src/plugins/rollup/type-definitions.js +48 -0
- package/src/utils/add-babel-inputs.d.ts +3 -0
- package/src/utils/add-babel-inputs.js +23 -0
- package/src/utils/add-local-registry-scripts.d.ts +5 -0
- package/src/utils/add-local-registry-scripts.js +77 -0
- package/src/utils/assets/assets.d.ts +10 -0
- package/src/utils/assets/assets.js +36 -0
- package/src/utils/assets/copy-assets-handler.d.ts +32 -0
- package/src/utils/assets/copy-assets-handler.js +154 -0
- package/src/utils/assets/index.d.ts +16 -0
- package/src/utils/assets/index.js +27 -0
- package/src/utils/buildable-libs-utils.d.ts +43 -0
- package/src/utils/buildable-libs-utils.js +375 -0
- package/src/utils/check-dependencies.d.ts +8 -0
- package/src/utils/check-dependencies.js +23 -0
- package/src/utils/code-frames/highlight.d.ts +1 -0
- package/src/utils/code-frames/highlight.js +86 -0
- package/src/utils/code-frames/identifiers.d.ts +5 -0
- package/src/utils/code-frames/identifiers.js +52 -0
- package/src/utils/compiler-helper-dependency.d.ts +18 -0
- package/src/utils/compiler-helper-dependency.js +120 -0
- package/src/utils/find-npm-dependencies.d.ts +9 -0
- package/src/utils/find-npm-dependencies.js +140 -0
- package/src/utils/generate-globs.d.ts +6 -0
- package/src/utils/generate-globs.js +80 -0
- package/src/utils/get-import-path.d.ts +5 -0
- package/src/utils/get-import-path.js +14 -0
- package/src/utils/get-main-file-dir.d.ts +1 -0
- package/src/utils/get-main-file-dir.js +11 -0
- package/src/utils/inline.d.ts +19 -0
- package/src/utils/inline.js +210 -0
- package/src/utils/package-json/create-entry-points.d.ts +1 -0
- package/src/utils/package-json/create-entry-points.js +23 -0
- package/src/utils/package-json/get-npm-scope.d.ts +5 -0
- package/src/utils/package-json/get-npm-scope.js +16 -0
- package/src/utils/package-json/index.d.ts +13 -0
- package/src/utils/package-json/index.js +30 -0
- package/src/utils/package-json/update-package-json.d.ts +30 -0
- package/src/utils/package-json/update-package-json.js +179 -0
- package/src/utils/prettier.d.ts +6 -0
- package/src/utils/prettier.js +34 -0
- package/src/utils/schema.d.ts +87 -0
- package/src/utils/swc/add-swc-config.d.ts +3 -0
- package/src/utils/swc/add-swc-config.js +41 -0
- package/src/utils/swc/add-swc-dependencies.d.ts +3 -0
- package/src/utils/swc/add-swc-dependencies.js +18 -0
- package/src/utils/swc/compile-swc.d.ts +13 -0
- package/src/utils/swc/compile-swc.js +160 -0
- package/src/utils/swc/get-swcrc-path.d.ts +5 -0
- package/src/utils/swc/get-swcrc-path.js +15 -0
- package/src/utils/swc/inline.d.ts +2 -0
- package/src/utils/swc/inline.js +11 -0
- package/src/utils/typescript/__mocks__/plugin-a.d.ts +1 -0
- package/src/utils/typescript/__mocks__/plugin-a.js +5 -0
- package/src/utils/typescript/__mocks__/plugin-b.d.ts +1 -0
- package/src/utils/typescript/__mocks__/plugin-b.js +5 -0
- package/src/utils/typescript/add-tslib-dependencies.d.ts +2 -0
- package/src/utils/typescript/add-tslib-dependencies.js +11 -0
- package/src/utils/typescript/ast-utils.d.ts +32 -0
- package/src/utils/typescript/ast-utils.js +266 -0
- package/src/utils/typescript/compile-typescript-files.d.ts +10 -0
- package/src/utils/typescript/compile-typescript-files.js +43 -0
- package/src/utils/typescript/create-ts-config.d.ts +18 -0
- package/src/utils/typescript/create-ts-config.js +48 -0
- package/src/utils/typescript/ensure-typescript.d.ts +1 -0
- package/src/utils/typescript/ensure-typescript.js +9 -0
- package/src/utils/typescript/get-source-nodes.d.ts +2 -0
- package/src/utils/typescript/get-source-nodes.js +18 -0
- package/src/utils/typescript/load-ts-transformers.d.ts +5 -0
- package/src/utils/typescript/load-ts-transformers.js +62 -0
- package/src/utils/typescript/print-diagnostics.d.ts +1 -0
- package/src/utils/typescript/print-diagnostics.js +18 -0
- package/src/utils/typescript/run-type-check.d.ts +32 -0
- package/src/utils/typescript/run-type-check.js +128 -0
- package/src/utils/typescript/ts-config.d.ts +9 -0
- package/src/utils/typescript/ts-config.js +85 -0
- package/src/utils/typescript/tsnode-register.d.ts +1 -0
- package/src/utils/typescript/tsnode-register.js +24 -0
- package/src/utils/typescript/types.d.ts +18 -0
- package/src/utils/typescript/types.js +2 -0
- package/src/utils/versions.d.ts +17 -0
- package/src/utils/versions.js +21 -0
- package/src/utils/watch-for-single-file-changes.d.ts +1 -0
- 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
|
+
[](https://circleci.com/gh/nrwl/nx)
|
|
11
|
+
[]()
|
|
12
|
+
[](https://www.npmjs.com/@nx/workspace)
|
|
13
|
+
[]()
|
|
14
|
+
[](http://commitizen.github.io/cz-cli/)
|
|
15
|
+
[](https://gitter.im/nrwl-nx/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
|
16
|
+
[](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
|
+
}
|
package/generators.json
ADDED
|
@@ -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
|
+
}
|
package/migrations.json
ADDED
|
@@ -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,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,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);
|