@angular-devkit/schematics 19.2.0-next.2 → 19.2.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular-devkit/schematics",
3
- "version": "19.2.0-next.2",
3
+ "version": "19.2.0",
4
4
  "description": "Angular Schematics - Library",
5
5
  "main": "src/index.js",
6
6
  "typings": "src/index.d.ts",
@@ -18,7 +18,7 @@
18
18
  "tooling"
19
19
  ],
20
20
  "dependencies": {
21
- "@angular-devkit/core": "19.2.0-next.2",
21
+ "@angular-devkit/core": "19.2.0",
22
22
  "jsonc-parser": "3.3.1",
23
23
  "magic-string": "0.30.17",
24
24
  "ora": "5.4.1",
@@ -6,8 +6,8 @@
6
6
  * found in the LICENSE file at https://angular.dev/license
7
7
  */
8
8
  import { BaseException } from '@angular-devkit/core';
9
+ import { Url } from 'node:url';
9
10
  import { Observable } from 'rxjs';
10
- import { Url } from 'url';
11
11
  import { MergeStrategy } from '../tree/interface';
12
12
  import { Workflow } from '../workflow/interface';
13
13
  import { Collection, CollectionDescription, Engine, EngineHost, ExecutionOptions, Schematic, SchematicContext, SchematicDescription, Source, TaskConfiguration, TaskId, TaskInfo, TypedSchematicContext } from './interface';
@@ -6,8 +6,8 @@
6
6
  * found in the LICENSE file at https://angular.dev/license
7
7
  */
8
8
  import { logging } from '@angular-devkit/core';
9
+ import { Url } from 'node:url';
9
10
  import { Observable } from 'rxjs';
10
- import { Url } from 'url';
11
11
  import { FileEntry, MergeStrategy, Tree } from '../tree/interface';
12
12
  import { Workflow } from '../workflow/interface';
13
13
  export interface TaskConfiguration<T = {}> {
package/src/rules/url.js CHANGED
@@ -8,8 +8,8 @@
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.url = url;
11
- const url_1 = require("url");
11
+ const node_url_1 = require("node:url");
12
12
  function url(urlString) {
13
- const url = (0, url_1.parse)(urlString);
13
+ const url = (0, node_url_1.parse)(urlString);
14
14
  return (context) => context.engine.createSourceFromUrl(url, context)(context);
15
15
  }
@@ -7,9 +7,9 @@
7
7
  */
8
8
  import { JsonValue } from '@angular-devkit/core';
9
9
  import { Action } from './action';
10
- import { DirEntry, FileEntry, FileVisitor, MergeStrategy, Tree, UpdateRecorder } from './interface';
10
+ import { DirEntry, FileEntry, FileVisitor, MergeStrategy, Tree, TreeSymbol, UpdateRecorder } from './interface';
11
11
  export declare class DelegateTree implements Tree {
12
- [x: symbol]: () => this;
12
+ [TreeSymbol]: () => this;
13
13
  protected _other: Tree;
14
14
  constructor(_other: Tree);
15
15
  branch(): Tree;
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import { JsonValue, Path, PathFragment, virtualFs } from '@angular-devkit/core';
9
9
  import { Action } from './action';
10
- import { DirEntry, FileEntry, FilePredicate, FileVisitor, MergeStrategy, Tree, UpdateRecorder } from './interface';
10
+ import { DirEntry, FileEntry, FilePredicate, FileVisitor, MergeStrategy, Tree, TreeSymbol, UpdateRecorder } from './interface';
11
11
  export declare class HostDirEntry implements DirEntry {
12
12
  readonly parent: DirEntry | null;
13
13
  readonly path: Path;
@@ -22,7 +22,7 @@ export declare class HostDirEntry implements DirEntry {
22
22
  private getSubfilesRecursively;
23
23
  }
24
24
  export declare class HostTree implements Tree {
25
- [x: symbol]: () => this;
25
+ [TreeSymbol]: () => this;
26
26
  protected _backend: virtualFs.ReadonlyHost<{}>;
27
27
  private readonly _id;
28
28
  private _record;
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import { BaseException, JsonValue, Path, PathFragment } from '@angular-devkit/core';
9
9
  import { Action } from './action';
10
- import { DirEntry, MergeStrategy, Tree, UpdateRecorder } from './interface';
10
+ import { DirEntry, MergeStrategy, Tree, TreeSymbol, UpdateRecorder } from './interface';
11
11
  export declare class CannotCreateFileException extends BaseException {
12
12
  constructor(path: string);
13
13
  }
@@ -22,7 +22,7 @@ export declare class NullTreeDirEntry implements DirEntry {
22
22
  visit(): void;
23
23
  }
24
24
  export declare class NullTree implements Tree {
25
- [x: symbol]: () => this;
25
+ [TreeSymbol]: () => this;
26
26
  branch(): Tree;
27
27
  merge(_other: Tree, _strategy?: MergeStrategy): void;
28
28
  readonly root: DirEntry;
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import { JsonValue, Path, PathFragment } from '@angular-devkit/core';
9
9
  import { Action } from './action';
10
- import { DirEntry, FileEntry, FileVisitor, MergeStrategy, Tree, UpdateRecorder } from './interface';
10
+ import { DirEntry, FileEntry, FileVisitor, MergeStrategy, Tree, TreeSymbol, UpdateRecorder } from './interface';
11
11
  declare class ScopedDirEntry implements DirEntry {
12
12
  private _base;
13
13
  readonly scope: Path;
@@ -21,7 +21,7 @@ declare class ScopedDirEntry implements DirEntry {
21
21
  visit(visitor: FileVisitor): void;
22
22
  }
23
23
  export declare class ScopedTree implements Tree {
24
- [x: symbol]: () => this;
24
+ [TreeSymbol]: () => this;
25
25
  private _base;
26
26
  readonly _root: ScopedDirEntry;
27
27
  constructor(_base: Tree, scope: string);
@@ -46,9 +46,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
46
46
  exports.UnknownPackageManagerException = void 0;
47
47
  exports.default = default_1;
48
48
  const core_1 = require("@angular-devkit/core");
49
- const child_process_1 = require("child_process");
49
+ const node_child_process_1 = require("node:child_process");
50
+ const path = __importStar(require("node:path"));
50
51
  const ora_1 = __importDefault(require("ora"));
51
- const path = __importStar(require("path"));
52
52
  const rxjs_1 = require("rxjs");
53
53
  const src_1 = require("../../src");
54
54
  const packageManagers = {
@@ -154,7 +154,7 @@ function default_1(factoryOptions = {}) {
154
154
  // Workaround for https://github.com/sindresorhus/ora/issues/136.
155
155
  discardStdin: process.platform != 'win32',
156
156
  }).start();
157
- const childProcess = (0, child_process_1.spawn)(taskPackageManagerName, args, spawnOptions).on('close', (code) => {
157
+ const childProcess = (0, node_child_process_1.spawn)(taskPackageManagerName, args, spawnOptions).on('close', (code) => {
158
158
  if (code === 0) {
159
159
  spinner.succeed('Packages installed successfully.');
160
160
  spinner.stop();
@@ -42,8 +42,8 @@ var __importStar = (this && this.__importStar) || (function () {
42
42
  Object.defineProperty(exports, "__esModule", { value: true });
43
43
  exports.default = default_1;
44
44
  const core_1 = require("@angular-devkit/core");
45
- const child_process_1 = require("child_process");
46
- const path = __importStar(require("path"));
45
+ const node_child_process_1 = require("node:child_process");
46
+ const path = __importStar(require("node:path"));
47
47
  function default_1(factoryOptions = {}) {
48
48
  const rootDirectory = factoryOptions.rootDirectory || process.cwd();
49
49
  return async (options = {}, context) => {
@@ -65,7 +65,7 @@ function default_1(factoryOptions = {}) {
65
65
  },
66
66
  };
67
67
  return new Promise((resolve, reject) => {
68
- (0, child_process_1.spawn)('git', args, spawnOptions).on('close', (code) => {
68
+ (0, node_child_process_1.spawn)('git', args, spawnOptions).on('close', (code) => {
69
69
  if (code === 0) {
70
70
  resolve();
71
71
  }
@@ -8,16 +8,16 @@
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.ExportStringRef = void 0;
11
- const path_1 = require("path");
11
+ const node_path_1 = require("node:path");
12
12
  class ExportStringRef {
13
13
  _ref;
14
14
  _module;
15
15
  _path;
16
16
  constructor(ref, parentPath = process.cwd(), inner = true) {
17
17
  const [path, name] = ref.split('#', 2);
18
- this._module = path[0] == '.' ? (0, path_1.resolve)(parentPath, path) : path;
18
+ this._module = path[0] == '.' ? (0, node_path_1.resolve)(parentPath, path) : path;
19
19
  this._module = require.resolve(this._module);
20
- this._path = (0, path_1.dirname)(this._module);
20
+ this._path = (0, node_path_1.dirname)(this._module);
21
21
  if (inner) {
22
22
  this._ref = require(this._module)[name || 'default'];
23
23
  }
@@ -5,8 +5,8 @@
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://angular.dev/license
7
7
  */
8
+ import { Url } from 'node:url';
8
9
  import { Observable } from 'rxjs';
9
- import { Url } from 'url';
10
10
  import { CollectionDescription, EngineHost, RuleFactory, SchematicDescription, Source, TaskExecutor, TypedSchematicContext } from '../src';
11
11
  export type FallbackCollectionDescription = {
12
12
  host: EngineHost<{}, {}>;
@@ -6,8 +6,8 @@
6
6
  * found in the LICENSE file at https://angular.dev/license
7
7
  */
8
8
  import { BaseException } from '@angular-devkit/core';
9
+ import { Url } from 'node:url';
9
10
  import { Observable } from 'rxjs';
10
- import { Url } from 'url';
11
11
  import { RuleFactory, Source, TaskExecutor, TaskExecutorFactory } from '../src';
12
12
  import { FileSystemCollectionDesc, FileSystemEngineHost, FileSystemSchematicContext, FileSystemSchematicDesc, FileSystemSchematicDescription } from './description';
13
13
  export declare type OptionTransform<T extends object | null, R extends object> = (schematic: FileSystemSchematicDescription, options: T, context?: FileSystemSchematicContext) => Observable<R> | PromiseLike<R> | R;
@@ -10,8 +10,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.FileSystemEngineHostBase = exports.SchematicNameCollisionException = exports.SchematicMissingDescriptionException = exports.SchematicMissingFieldsException = exports.CollectionMissingFieldsException = exports.CollectionMissingSchematicsMapException = exports.FactoryCannotBeResolvedException = exports.SchematicMissingFactoryException = exports.InvalidCollectionJsonException = exports.CollectionCannotBeResolvedException = void 0;
11
11
  const core_1 = require("@angular-devkit/core");
12
12
  const node_1 = require("@angular-devkit/core/node");
13
- const fs_1 = require("fs");
14
- const path_1 = require("path");
13
+ const node_fs_1 = require("node:fs");
14
+ const node_path_1 = require("node:path");
15
15
  const rxjs_1 = require("rxjs");
16
16
  const src_1 = require("../src");
17
17
  const file_system_utility_1 = require("./file-system-utility");
@@ -154,7 +154,7 @@ class FileSystemEngineHostBase {
154
154
  if (!(name in collection.schematics)) {
155
155
  return null;
156
156
  }
157
- const collectionPath = (0, path_1.dirname)(collection.path);
157
+ const collectionPath = (0, node_path_1.dirname)(collection.path);
158
158
  const partialDesc = collection.schematics[name];
159
159
  if (!partialDesc) {
160
160
  return null;
@@ -183,8 +183,8 @@ class FileSystemEngineHostBase {
183
183
  let schema = partialDesc.schema;
184
184
  let schemaJson = undefined;
185
185
  if (schema) {
186
- if (!(0, path_1.isAbsolute)(schema)) {
187
- schema = (0, path_1.join)(collectionPath, schema);
186
+ if (!(0, node_path_1.isAbsolute)(schema)) {
187
+ schema = (0, node_path_1.join)(collectionPath, schema);
188
188
  }
189
189
  schemaJson = (0, file_system_utility_1.readJsonFile)(schema);
190
190
  }
@@ -193,8 +193,8 @@ class FileSystemEngineHostBase {
193
193
  // Bazel under Windows this directory needs to be resolved from the collection instead.
194
194
  // This is needed because on Bazel under Windows the data files (such as the collection or
195
195
  // url files) are not in the same place as the compiled JS.
196
- const maybePath = (0, path_1.join)(collectionPath, partialDesc.factory);
197
- const path = (0, fs_1.existsSync)(maybePath) && (0, fs_1.statSync)(maybePath).isDirectory() ? maybePath : (0, path_1.dirname)(maybePath);
196
+ const maybePath = (0, node_path_1.join)(collectionPath, partialDesc.factory);
197
+ const path = (0, node_fs_1.existsSync)(maybePath) && (0, node_fs_1.statSync)(maybePath).isDirectory() ? maybePath : (0, node_path_1.dirname)(maybePath);
198
198
  return this._transformSchematicDescription(name, collection, {
199
199
  ...partialDesc,
200
200
  schema,
@@ -217,7 +217,7 @@ class FileSystemEngineHostBase {
217
217
  }
218
218
  // Resolve all file:///a/b/c/d from the schematic's own path, and not the current
219
219
  // path.
220
- const root = (0, core_1.normalize)((0, path_1.resolve)(fileDescription.path, url.path || ''));
220
+ const root = (0, core_1.normalize)((0, node_path_1.resolve)(fileDescription.path, url.path || ''));
221
221
  return new src_1.HostCreateTree(new core_1.virtualFs.ScopedHost(new node_1.NodeJsSyncHost(), root));
222
222
  };
223
223
  }
@@ -41,8 +41,8 @@ var __importStar = (this && this.__importStar) || (function () {
41
41
  })();
42
42
  Object.defineProperty(exports, "__esModule", { value: true });
43
43
  exports.FileSystemEngineHost = void 0;
44
- const fs_1 = require("fs");
45
- const path_1 = require("path");
44
+ const node_fs_1 = require("node:fs");
45
+ const node_path_1 = require("node:path");
46
46
  const rxjs_1 = require("rxjs");
47
47
  const src_1 = require("../src");
48
48
  const export_ref_1 = require("./export-ref");
@@ -60,16 +60,16 @@ class FileSystemEngineHost extends file_system_engine_host_base_1.FileSystemEngi
60
60
  _resolveCollectionPath(name) {
61
61
  try {
62
62
  // Allow `${_root}/${name}.json` as a collection.
63
- const maybePath = require.resolve((0, path_1.join)(this._root, name + '.json'));
64
- if ((0, fs_1.existsSync)(maybePath)) {
63
+ const maybePath = require.resolve((0, node_path_1.join)(this._root, name + '.json'));
64
+ if ((0, node_fs_1.existsSync)(maybePath)) {
65
65
  return maybePath;
66
66
  }
67
67
  }
68
68
  catch (error) { }
69
69
  try {
70
70
  // Allow `${_root}/${name}/collection.json.
71
- const maybePath = require.resolve((0, path_1.join)(this._root, name, 'collection.json'));
72
- if ((0, fs_1.existsSync)(maybePath)) {
71
+ const maybePath = require.resolve((0, node_path_1.join)(this._root, name, 'collection.json'));
72
+ if ((0, node_fs_1.existsSync)(maybePath)) {
73
73
  return maybePath;
74
74
  }
75
75
  }
@@ -104,8 +104,8 @@ class FileSystemEngineHost extends file_system_engine_host_base_1.FileSystemEngi
104
104
  return true;
105
105
  }
106
106
  try {
107
- const maybePath = require.resolve((0, path_1.join)(this._root, name));
108
- if ((0, fs_1.existsSync)(maybePath)) {
107
+ const maybePath = require.resolve((0, node_path_1.join)(this._root, name));
108
+ if ((0, node_fs_1.existsSync)(maybePath)) {
109
109
  return true;
110
110
  }
111
111
  }
@@ -115,7 +115,7 @@ class FileSystemEngineHost extends file_system_engine_host_base_1.FileSystemEngi
115
115
  createTaskExecutor(name) {
116
116
  if (!super.hasTaskExecutor(name)) {
117
117
  try {
118
- const path = require.resolve((0, path_1.join)(this._root, name));
118
+ const path = require.resolve((0, node_path_1.join)(this._root, name));
119
119
  // Default handling code is for old tasks that incorrectly export `default` with non-ESM module
120
120
  return (0, rxjs_1.from)(Promise.resolve(`${path}`).then(s => __importStar(require(s))).then((mod) => (mod.default?.default || mod.default)())).pipe((0, rxjs_1.catchError)(() => (0, rxjs_1.throwError)(() => new src_1.UnregisteredTaskException(name))));
121
121
  }
@@ -8,13 +8,13 @@
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.readJsonFile = readJsonFile;
11
- const fs_1 = require("fs");
12
11
  const jsonc_parser_1 = require("jsonc-parser");
12
+ const node_fs_1 = require("node:fs");
13
13
  const exception_1 = require("../src/exception/exception");
14
14
  function readJsonFile(path) {
15
15
  let data;
16
16
  try {
17
- data = (0, fs_1.readFileSync)(path, 'utf-8');
17
+ data = (0, node_fs_1.readFileSync)(path, 'utf-8');
18
18
  }
19
19
  catch (e) {
20
20
  if (e && typeof e === 'object' && 'code' in e && e.code === 'ENOENT') {
@@ -9,7 +9,7 @@
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.NodeModulesEngineHost = exports.NodePackageDoesNotSupportSchematics = void 0;
11
11
  const core_1 = require("@angular-devkit/core");
12
- const path_1 = require("path");
12
+ const node_path_1 = require("node:path");
13
13
  const export_ref_1 = require("./export-ref");
14
14
  const file_system_engine_host_base_1 = require("./file-system-engine-host-base");
15
15
  const file_system_utility_1 = require("./file-system-utility");
@@ -39,17 +39,17 @@ class NodeModulesEngineHost extends file_system_engine_host_base_1.FileSystemEng
39
39
  references.add(requester);
40
40
  }
41
41
  }
42
- const relativeBase = requester ? (0, path_1.dirname)(requester) : process.cwd();
42
+ const relativeBase = requester ? (0, node_path_1.dirname)(requester) : process.cwd();
43
43
  let collectionPath = undefined;
44
44
  if (name.startsWith('.')) {
45
- name = (0, path_1.resolve)(relativeBase, name);
45
+ name = (0, node_path_1.resolve)(relativeBase, name);
46
46
  }
47
47
  const resolveOptions = {
48
- paths: requester ? [(0, path_1.dirname)(requester), ...(this.paths || [])] : this.paths,
48
+ paths: requester ? [(0, node_path_1.dirname)(requester), ...(this.paths || [])] : this.paths,
49
49
  };
50
50
  // Try to resolve as a package
51
51
  try {
52
- const packageJsonPath = require.resolve((0, path_1.join)(name, 'package.json'), resolveOptions);
52
+ const packageJsonPath = require.resolve((0, node_path_1.join)(name, 'package.json'), resolveOptions);
53
53
  const { schematics } = require(packageJsonPath);
54
54
  if (!schematics || typeof schematics !== 'string') {
55
55
  throw new NodePackageDoesNotSupportSchematics(name);
@@ -57,8 +57,8 @@ class NodeModulesEngineHost extends file_system_engine_host_base_1.FileSystemEng
57
57
  // If this is a relative path to the collection, then create the collection
58
58
  // path in relation to the package path
59
59
  if (schematics.startsWith('.')) {
60
- const packageDirectory = (0, path_1.dirname)(packageJsonPath);
61
- collectionPath = (0, path_1.resolve)(packageDirectory, schematics);
60
+ const packageDirectory = (0, node_path_1.dirname)(packageJsonPath);
61
+ collectionPath = (0, node_path_1.resolve)(packageDirectory, schematics);
62
62
  }
63
63
  // Otherwise treat this as a package, and recurse to find the collection path
64
64
  else {