@nx/js 19.7.0-beta.1 → 19.7.0-beta.2

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/babel.js CHANGED
@@ -18,6 +18,30 @@ module.exports = function (api, options = {}) {
18
18
  if (options.classProperties) {
19
19
  devkit_1.logger.warn(`Use =\`loose\` option instead of \`classProperties.loose\`. The \`classProperties\` option will be removed in Nx 20`);
20
20
  }
21
+ const plugins = [
22
+ !isNxPackage
23
+ ? [
24
+ require.resolve('@babel/plugin-transform-runtime'),
25
+ {
26
+ corejs: false,
27
+ helpers: true,
28
+ regenerator: true,
29
+ useESModules: isModern,
30
+ absoluteRuntime: (0, path_1.dirname)(require.resolve('@babel/runtime/package.json')),
31
+ },
32
+ ]
33
+ : null,
34
+ require.resolve('babel-plugin-macros'),
35
+ emitDecoratorMetadata
36
+ ? require.resolve('babel-plugin-transform-typescript-metadata')
37
+ : undefined,
38
+ // Must use legacy decorators to remain compatible with TypeScript.
39
+ [
40
+ require.resolve('@babel/plugin-proposal-decorators'),
41
+ options.decorators ?? { legacy: true },
42
+ ],
43
+ [require.resolve('@babel/plugin-transform-class-properties'), { loose }],
44
+ ].filter(Boolean);
21
45
  return {
22
46
  presets: [
23
47
  // Support module/nomodule pattern.
@@ -37,30 +61,7 @@ module.exports = function (api, options = {}) {
37
61
  },
38
62
  ],
39
63
  ],
40
- plugins: [
41
- !isNxPackage
42
- ? [
43
- require.resolve('@babel/plugin-transform-runtime'),
44
- {
45
- corejs: false,
46
- helpers: true,
47
- regenerator: true,
48
- useESModules: isModern,
49
- absoluteRuntime: (0, path_1.dirname)(require.resolve('@babel/runtime/package.json')),
50
- },
51
- ]
52
- : null,
53
- require.resolve('babel-plugin-macros'),
54
- emitDecoratorMetadata
55
- ? require.resolve('babel-plugin-transform-typescript-metadata')
56
- : undefined,
57
- // Must use legacy decorators to remain compatible with TypeScript.
58
- [
59
- require.resolve('@babel/plugin-proposal-decorators'),
60
- options.decorators ?? { legacy: true },
61
- ],
62
- [require.resolve('@babel/plugin-transform-class-properties'), { loose }],
63
- ].filter(Boolean),
64
+ plugins,
64
65
  overrides: [
65
66
  // Convert `const enum` to `enum`. The former cannot be supported by babel
66
67
  // but at least we can get it to not error out.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/js",
3
- "version": "19.7.0-beta.1",
3
+ "version": "19.7.0-beta.2",
4
4
  "private": false,
5
5
  "description": "The JS plugin for Nx contains executors and generators that provide the best experience for developing JavaScript and TypeScript projects. ",
6
6
  "repository": {
@@ -39,8 +39,8 @@
39
39
  "@babel/preset-env": "^7.23.2",
40
40
  "@babel/preset-typescript": "^7.22.5",
41
41
  "@babel/runtime": "^7.22.6",
42
- "@nx/devkit": "19.7.0-beta.1",
43
- "@nx/workspace": "19.7.0-beta.1",
42
+ "@nx/devkit": "19.7.0-beta.2",
43
+ "@nx/workspace": "19.7.0-beta.2",
44
44
  "babel-plugin-const-enum": "^1.0.1",
45
45
  "babel-plugin-macros": "^2.8.0",
46
46
  "babel-plugin-transform-typescript-metadata": "^0.3.1",
@@ -61,7 +61,7 @@
61
61
  "ts-node": "10.9.1",
62
62
  "tsconfig-paths": "^4.1.2",
63
63
  "tslib": "^2.3.0",
64
- "@nrwl/js": "19.7.0-beta.1"
64
+ "@nrwl/js": "19.7.0-beta.2"
65
65
  },
66
66
  "peerDependencies": {
67
67
  "verdaccio": "^5.0.4"
@@ -122,19 +122,19 @@ function setupNpm(options) {
122
122
  const scopes = ['', ...(options.scopes || [])];
123
123
  try {
124
124
  scopes.forEach((scope) => {
125
- const scopeName = scope ? `${scope}:` : '';
125
+ const registryName = scope ? `${scope}:registry` : 'registry';
126
126
  try {
127
- npmRegistryPaths.push((0, child_process_1.execSync)(`npm config get '${scopeName}registry' --location ${options.location}`, { env })
127
+ npmRegistryPaths.push((0, child_process_1.execSync)(`npm config get ${registryName} --location ${options.location}`, { env })
128
128
  ?.toString()
129
129
  ?.trim()
130
130
  ?.replace('\u001b[2K\u001b[1G', '') // strip out ansi codes
131
131
  );
132
- (0, child_process_1.execSync)(`npm config set '${scopeName}registry' http://localhost:${options.port}/ --location ${options.location}`, { env });
132
+ (0, child_process_1.execSync)(`npm config set ${registryName} http://localhost:${options.port}/ --location ${options.location}`, { env });
133
133
  (0, child_process_1.execSync)(`npm config set //localhost:${options.port}/:_authToken="secretVerdaccioToken" --location ${options.location}`, { env });
134
- devkit_1.logger.info(`Set npm ${scopeName}registry to http://localhost:${options.port}/`);
134
+ devkit_1.logger.info(`Set npm ${registryName} to http://localhost:${options.port}/`);
135
135
  }
136
136
  catch (e) {
137
- throw new Error(`Failed to set npm ${scopeName}registry to http://localhost:${options.port}/: ${e.message}`);
137
+ throw new Error(`Failed to set npm ${registryName} to http://localhost:${options.port}/: ${e.message}`);
138
138
  }
139
139
  });
140
140
  return () => {
@@ -143,20 +143,20 @@ function setupNpm(options) {
143
143
  ?.toString()
144
144
  ?.trim()
145
145
  ?.replace('\u001b[2K\u001b[1G', ''); // strip out ansi codes
146
- if (npmRegistryPaths.length > 0 &&
147
- currentNpmRegistryPath.includes('localhost')) {
148
- scopes.forEach((scope, index) => {
149
- const scopeName = scope ? `${scope}:` : '';
150
- (0, child_process_1.execSync)(`npm config set '${scopeName}registry' ${npmRegistryPaths[index]} --location ${options.location}`, { env });
151
- devkit_1.logger.info(`Reset npm ${scopeName}registry to ${npmRegistryPaths[index]}`);
152
- });
153
- }
154
- else {
155
- (0, child_process_1.execSync)(`npm config delete registry --location ${options.location}`, {
156
- env,
157
- });
158
- devkit_1.logger.info('Cleared custom npm registry');
159
- }
146
+ scopes.forEach((scope, index) => {
147
+ const registryName = scope ? `${scope}:registry` : 'registry';
148
+ if (npmRegistryPaths[index] &&
149
+ currentNpmRegistryPath.includes('localhost')) {
150
+ (0, child_process_1.execSync)(`npm config set ${registryName} ${npmRegistryPaths[index]} --location ${options.location}`, { env });
151
+ devkit_1.logger.info(`Reset npm ${registryName} to ${npmRegistryPaths[index]}`);
152
+ }
153
+ else {
154
+ (0, child_process_1.execSync)(`npm config delete ${registryName} --location ${options.location}`, {
155
+ env,
156
+ });
157
+ devkit_1.logger.info('Cleared custom npm registry');
158
+ }
159
+ });
160
160
  (0, child_process_1.execSync)(`npm config delete //localhost:${options.port}/:_authToken --location ${options.location}`, { env });
161
161
  }
162
162
  catch (e) {
@@ -225,20 +225,22 @@ function setupYarn(options) {
225
225
  ?.toString()
226
226
  ?.trim()
227
227
  ?.replace('\u001b[2K\u001b[1G', ''); // strip out ansi codes
228
- if (yarnRegistryPaths.length > 0 &&
229
- currentYarnRegistryPath.includes('localhost')) {
230
- scopes.forEach((scope, index) => {
231
- const scopeName = scope ? `${scope}:` : '';
232
- (0, child_process_1.execSync)(`yarn config set ${scopeName}${registryConfigName} ${yarnRegistryPaths[index]}` +
228
+ scopes.forEach((scope, index) => {
229
+ const registryName = scope
230
+ ? `${scope}:${registryConfigName}`
231
+ : registryConfigName;
232
+ if (yarnRegistryPaths[index] &&
233
+ currentYarnRegistryPath.includes('localhost')) {
234
+ (0, child_process_1.execSync)(`yarn config set ${registryName} ${yarnRegistryPaths[index]}` +
233
235
  (options.location === 'user' ? ' --home' : ''), { env });
234
- devkit_1.logger.info(`Reset yarn ${scopeName}${registryConfigName} to ${yarnRegistryPaths[index]}`);
235
- });
236
- }
237
- else {
238
- (0, child_process_1.execSync)(`yarn config ${isYarnV1 ? 'delete' : 'unset'} ${registryConfigName}` +
239
- (options.location === 'user' ? ' --home' : ''), { env });
240
- devkit_1.logger.info(`Cleared custom yarn ${registryConfigName}`);
241
- }
236
+ devkit_1.logger.info(`Reset yarn ${registryName} to ${yarnRegistryPaths[index]}`);
237
+ }
238
+ else {
239
+ (0, child_process_1.execSync)(`yarn config ${isYarnV1 ? 'delete' : 'unset'} ${registryName}` +
240
+ (options.location === 'user' ? ' --home' : ''), { env });
241
+ devkit_1.logger.info(`Cleared custom yarn ${registryConfigName}`);
242
+ }
243
+ });
242
244
  if (whitelistedLocalhost) {
243
245
  const currentWhitelist = getYarnUnsafeHttpWhitelist(isYarnV1);
244
246
  if (currentWhitelist.has('localhost')) {