@schematics/angular 20.2.2 → 21.0.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/app-shell/index.d.ts +2 -1
  2. package/app-shell/index.js +16 -24
  3. package/application/index.js +9 -0
  4. package/application/schema.d.ts +2 -1
  5. package/application/schema.js +1 -0
  6. package/application/schema.json +6 -2
  7. package/collection.json +7 -0
  8. package/component/index.d.ts +2 -1
  9. package/component/index.js +45 -53
  10. package/config/.browserslistrc +5 -5
  11. package/config/index.d.ts +2 -1
  12. package/config/index.js +12 -19
  13. package/directive/index.d.ts +2 -1
  14. package/directive/index.js +20 -27
  15. package/migrations/migration-collection.json +2 -22
  16. package/module/index.d.ts +2 -1
  17. package/module/index.js +48 -50
  18. package/ng-new/schema.d.ts +2 -2
  19. package/ng-new/schema.js +1 -1
  20. package/ng-new/schema.json +2 -2
  21. package/package.json +4 -4
  22. package/pipe/index.d.ts +2 -2
  23. package/pipe/index.js +16 -18
  24. package/server/index.d.ts +2 -1
  25. package/server/index.js +67 -71
  26. package/service-worker/index.d.ts +2 -1
  27. package/service-worker/index.js +44 -81
  28. package/ssr/index.d.ts +2 -1
  29. package/ssr/index.js +32 -40
  30. package/tailwind/files/.postcssrc.json.template +5 -0
  31. package/{migrations/previous-style-guide/migration.d.ts → tailwind/index.d.ts} +5 -2
  32. package/tailwind/index.js +51 -0
  33. package/tailwind/schema.d.ts +7 -0
  34. package/tailwind/schema.js +4 -0
  35. package/tailwind/schema.json +15 -0
  36. package/utility/ast-utils.js +10 -7
  37. package/utility/latest-versions/package.json +2 -0
  38. package/utility/latest-versions.js +5 -5
  39. package/utility/project.d.ts +25 -0
  40. package/utility/project.js +30 -0
  41. package/utility/standalone/rules.js +2 -3
  42. package/web-worker/index.d.ts +2 -1
  43. package/web-worker/index.js +60 -70
  44. package/workspace/schema.d.ts +0 -1
  45. package/workspace/schema.js +0 -1
  46. package/workspace/schema.json +1 -1
  47. package/migrations/previous-style-guide/migration.js +0 -42
  48. package/migrations/replace-provide-server-rendering-import/migration.d.ts +0 -9
  49. package/migrations/replace-provide-server-rendering-import/migration.js +0 -98
  50. package/migrations/replace-provide-server-routing/migration.d.ts +0 -9
  51. package/migrations/replace-provide-server-routing/migration.js +0 -125
  52. package/migrations/update-module-resolution/migration.d.ts +0 -9
  53. package/migrations/update-module-resolution/migration.js +0 -52
@@ -7,4 +7,5 @@
7
7
  */
8
8
  import { Rule } from '@angular-devkit/schematics';
9
9
  import { Schema as AppShellOptions } from './schema';
10
- export default function (options: AppShellOptions): Rule;
10
+ declare const _default: (options: AppShellOptions) => Rule;
11
+ export default _default;
@@ -10,14 +10,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
10
10
  return (mod && mod.__esModule) ? mod : { "default": mod };
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.default = default_1;
14
13
  const schematics_1 = require("@angular-devkit/schematics");
15
14
  const posix_1 = require("node:path/posix");
16
15
  const typescript_1 = __importDefault(require("../third_party/github.com/Microsoft/TypeScript/lib/typescript"));
17
16
  const ast_utils_1 = require("../utility/ast-utils");
18
17
  const change_1 = require("../utility/change");
19
18
  const ng_ast_utils_1 = require("../utility/ng-ast-utils");
20
- const project_targets_1 = require("../utility/project-targets");
19
+ const project_1 = require("../utility/project");
21
20
  const util_1 = require("../utility/standalone/util");
22
21
  const workspace_1 = require("../utility/workspace");
23
22
  function getSourceFile(host, path) {
@@ -149,25 +148,18 @@ function addServerRoutingConfig(options, isStandalone) {
149
148
  host.commitUpdate(recorder);
150
149
  };
151
150
  }
152
- function default_1(options) {
153
- return async (tree) => {
154
- const browserEntryPoint = await (0, util_1.getMainFilePath)(tree, options.project);
155
- const isStandalone = (0, ng_ast_utils_1.isStandaloneApp)(tree, browserEntryPoint);
156
- const workspace = await (0, workspace_1.getWorkspace)(tree);
157
- const project = workspace.projects.get(options.project);
158
- if (!project) {
159
- throw (0, project_targets_1.targetBuildNotFoundError)();
160
- }
161
- return (0, schematics_1.chain)([
162
- validateProject(browserEntryPoint),
163
- (0, schematics_1.schematic)('server', options),
164
- addServerRoutingConfig(options, isStandalone),
165
- (0, schematics_1.schematic)('component', {
166
- name: 'app-shell',
167
- module: 'app.module.server.ts',
168
- project: options.project,
169
- standalone: isStandalone,
170
- }),
171
- ]);
172
- };
173
- }
151
+ exports.default = (0, project_1.createProjectSchematic)(async (options, { tree }) => {
152
+ const browserEntryPoint = await (0, util_1.getMainFilePath)(tree, options.project);
153
+ const isStandalone = (0, ng_ast_utils_1.isStandaloneApp)(tree, browserEntryPoint);
154
+ return (0, schematics_1.chain)([
155
+ validateProject(browserEntryPoint),
156
+ (0, schematics_1.schematic)('server', options),
157
+ addServerRoutingConfig(options, isStandalone),
158
+ (0, schematics_1.schematic)('component', {
159
+ name: 'app-shell',
160
+ module: 'app.module.server.ts',
161
+ project: options.project,
162
+ standalone: isStandalone,
163
+ }),
164
+ ]);
165
+ });
@@ -36,6 +36,10 @@ function addTsProjectReference(...paths) {
36
36
  }
37
37
  function default_1(options) {
38
38
  return async (host) => {
39
+ const isTailwind = options.style === schema_1.Style.Tailwind;
40
+ if (isTailwind) {
41
+ options.style = schema_1.Style.Css;
42
+ }
39
43
  const { appDir, appRootSelector, componentOptions, folderName, sourceDir } = await getAppOptions(host, options);
40
44
  return (0, schematics_1.chain)([
41
45
  addAppToWorkspaceFile(options, appDir),
@@ -104,6 +108,11 @@ function default_1(options) {
104
108
  })
105
109
  : (0, schematics_1.noop)(),
106
110
  options.skipPackageJson ? (0, schematics_1.noop)() : addDependenciesToPackageJson(options),
111
+ isTailwind
112
+ ? (0, schematics_1.schematic)('tailwind', {
113
+ project: options.name,
114
+ })
115
+ : (0, schematics_1.noop)(),
107
116
  ]);
108
117
  };
109
118
  }
@@ -93,7 +93,8 @@ export declare enum Style {
93
93
  Css = "css",
94
94
  Less = "less",
95
95
  Sass = "sass",
96
- Scss = "scss"
96
+ Scss = "scss",
97
+ Tailwind = "tailwind"
97
98
  }
98
99
  /**
99
100
  * Sets the view encapsulation mode for the application's components. This determines how
@@ -12,6 +12,7 @@ var Style;
12
12
  Style["Less"] = "less";
13
13
  Style["Sass"] = "sass";
14
14
  Style["Scss"] = "scss";
15
+ Style["Tailwind"] = "tailwind";
15
16
  })(Style || (exports.Style = Style = {}));
16
17
  /**
17
18
  * Sets the view encapsulation mode for the application's components. This determines how
@@ -54,15 +54,19 @@
54
54
  "description": "The type of stylesheet files to be created for components in the application.",
55
55
  "type": "string",
56
56
  "default": "css",
57
- "enum": ["css", "scss", "sass", "less"],
57
+ "enum": ["css", "scss", "sass", "less", "tailwind"],
58
58
  "x-prompt": {
59
- "message": "Which stylesheet format would you like to use?",
59
+ "message": "Which stylesheet system would you like to use?",
60
60
  "type": "list",
61
61
  "items": [
62
62
  {
63
63
  "value": "css",
64
64
  "label": "CSS [ https://developer.mozilla.org/docs/Web/CSS ]"
65
65
  },
66
+ {
67
+ "value": "tailwind",
68
+ "label": "Tailwind CSS [ https://tailwindcss.com ]"
69
+ },
66
70
  {
67
71
  "value": "scss",
68
72
  "label": "Sass (SCSS) [ https://sass-lang.com/documentation/syntax#scss ]"
package/collection.json CHANGED
@@ -136,6 +136,13 @@
136
136
  "factory": "./ai-config",
137
137
  "schema": "./ai-config/schema.json",
138
138
  "description": "Generates an AI tool configuration file."
139
+ },
140
+ "tailwind": {
141
+ "factory": "./tailwind",
142
+ "schema": "./tailwind/schema.json",
143
+ "hidden": true,
144
+ "private": true,
145
+ "description": "[INTERNAL] Adds tailwind to a project. Intended for use for ng new/add."
139
146
  }
140
147
  }
141
148
  }
@@ -7,4 +7,5 @@
7
7
  */
8
8
  import { Rule } from '@angular-devkit/schematics';
9
9
  import { Schema as ComponentOptions } from './schema';
10
- export default function (options: ComponentOptions): Rule;
10
+ declare const _default: (options: ComponentOptions) => Rule;
11
+ export default _default;
@@ -7,11 +7,11 @@
7
7
  * found in the LICENSE file at https://angular.dev/license
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.default = default_1;
11
10
  const schematics_1 = require("@angular-devkit/schematics");
12
11
  const add_declaration_to_ng_module_1 = require("../utility/add-declaration-to-ng-module");
13
12
  const find_module_1 = require("../utility/find-module");
14
13
  const parse_name_1 = require("../utility/parse-name");
14
+ const project_1 = require("../utility/project");
15
15
  const validation_1 = require("../utility/validation");
16
16
  const workspace_1 = require("../utility/workspace");
17
17
  const schema_1 = require("./schema");
@@ -25,55 +25,47 @@ function buildSelector(options, projectPrefix) {
25
25
  }
26
26
  return selector;
27
27
  }
28
- function default_1(options) {
29
- return async (host) => {
30
- const workspace = await (0, workspace_1.getWorkspace)(host);
31
- const project = workspace.projects.get(options.project);
32
- if (!project) {
33
- throw new schematics_1.SchematicsException(`Project "${options.project}" does not exist.`);
34
- }
35
- if (options.path === undefined) {
36
- options.path = (0, workspace_1.buildDefaultPath)(project);
37
- }
38
- options.module = (0, find_module_1.findModuleFromOptions)(host, options);
39
- // Schematic templates require a defined type value
40
- options.type ??= '';
41
- const parsedPath = (0, parse_name_1.parseName)(options.path, options.name);
42
- options.name = parsedPath.name;
43
- options.path = parsedPath.path;
44
- options.selector =
45
- options.selector || buildSelector(options, (project && project.prefix) || '');
46
- (0, validation_1.validateHtmlSelector)(options.selector);
47
- (0, validation_1.validateClassName)(schematics_1.strings.classify(options.name));
48
- const skipStyleFile = options.inlineStyle || options.style === schema_1.Style.None;
49
- const templateSource = (0, schematics_1.apply)((0, schematics_1.url)('./files'), [
50
- options.skipTests ? (0, schematics_1.filter)((path) => !path.endsWith('.spec.ts.template')) : (0, schematics_1.noop)(),
51
- skipStyleFile ? (0, schematics_1.filter)((path) => !path.endsWith('.__style__.template')) : (0, schematics_1.noop)(),
52
- options.inlineTemplate ? (0, schematics_1.filter)((path) => !path.endsWith('.html.template')) : (0, schematics_1.noop)(),
53
- (0, schematics_1.applyTemplates)({
54
- ...schematics_1.strings,
55
- 'if-flat': (s) => (options.flat ? '' : s),
56
- 'ngext': options.ngHtml ? '.ng' : '',
57
- ...options,
58
- }),
59
- !options.type
60
- ? (0, schematics_1.forEach)(((file) => {
61
- return file.path.includes('..')
62
- ? {
63
- content: file.content,
64
- path: file.path.replace('..', '.'),
65
- }
66
- : file;
67
- }))
68
- : (0, schematics_1.noop)(),
69
- (0, schematics_1.move)(parsedPath.path),
70
- ]);
71
- return (0, schematics_1.chain)([
72
- (0, add_declaration_to_ng_module_1.addDeclarationToNgModule)({
73
- type: 'component',
74
- ...options,
75
- }),
76
- (0, schematics_1.mergeWith)(templateSource),
77
- ]);
78
- };
79
- }
28
+ exports.default = (0, project_1.createProjectSchematic)((options, { project, tree }) => {
29
+ if (options.path === undefined) {
30
+ options.path = (0, workspace_1.buildDefaultPath)(project);
31
+ }
32
+ options.module = (0, find_module_1.findModuleFromOptions)(tree, options);
33
+ // Schematic templates require a defined type value
34
+ options.type ??= '';
35
+ const parsedPath = (0, parse_name_1.parseName)(options.path, options.name);
36
+ options.name = parsedPath.name;
37
+ options.path = parsedPath.path;
38
+ options.selector = options.selector || buildSelector(options, (project && project.prefix) || '');
39
+ (0, validation_1.validateHtmlSelector)(options.selector);
40
+ (0, validation_1.validateClassName)(schematics_1.strings.classify(options.name));
41
+ const skipStyleFile = options.inlineStyle || options.style === schema_1.Style.None;
42
+ const templateSource = (0, schematics_1.apply)((0, schematics_1.url)('./files'), [
43
+ options.skipTests ? (0, schematics_1.filter)((path) => !path.endsWith('.spec.ts.template')) : (0, schematics_1.noop)(),
44
+ skipStyleFile ? (0, schematics_1.filter)((path) => !path.endsWith('.__style__.template')) : (0, schematics_1.noop)(),
45
+ options.inlineTemplate ? (0, schematics_1.filter)((path) => !path.endsWith('.html.template')) : (0, schematics_1.noop)(),
46
+ (0, schematics_1.applyTemplates)({
47
+ ...schematics_1.strings,
48
+ 'if-flat': (s) => (options.flat ? '' : s),
49
+ 'ngext': options.ngHtml ? '.ng' : '',
50
+ ...options,
51
+ }),
52
+ !options.type
53
+ ? (0, schematics_1.forEach)(((file) => {
54
+ return file.path.includes('..')
55
+ ? {
56
+ content: file.content,
57
+ path: file.path.replace('..', '.'),
58
+ }
59
+ : file;
60
+ }))
61
+ : (0, schematics_1.noop)(),
62
+ (0, schematics_1.move)(parsedPath.path),
63
+ ]);
64
+ return (0, schematics_1.chain)([
65
+ (0, add_declaration_to_ng_module_1.addDeclarationToNgModule)({
66
+ type: 'component',
67
+ ...options,
68
+ }),
69
+ (0, schematics_1.mergeWith)(templateSource),
70
+ ]);
71
+ });
@@ -1,7 +1,7 @@
1
- Chrome >= 107
2
- ChromeAndroid >= 107
3
- Edge >= 107
4
- Firefox >= 104
5
- FirefoxAndroid >= 104
1
+ Chrome >= 110
2
+ ChromeAndroid >= 110
3
+ Edge >= 110
4
+ Firefox >= 110
5
+ FirefoxAndroid >= 110
6
6
  Safari >= 16
7
7
  iOS >= 16
package/config/index.d.ts CHANGED
@@ -7,4 +7,5 @@
7
7
  */
8
8
  import { Rule } from '@angular-devkit/schematics';
9
9
  import { Schema as ConfigOptions } from './schema';
10
- export default function (options: ConfigOptions): Rule;
10
+ declare const _default: (options: ConfigOptions) => Rule;
11
+ export default _default;
package/config/index.js CHANGED
@@ -7,39 +7,32 @@
7
7
  * found in the LICENSE file at https://angular.dev/license
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.default = default_1;
11
10
  const schematics_1 = require("@angular-devkit/schematics");
12
11
  const promises_1 = require("node:fs/promises");
13
12
  const node_path_1 = require("node:path");
14
13
  const paths_1 = require("../utility/paths");
14
+ const project_1 = require("../utility/project");
15
15
  const workspace_1 = require("../utility/workspace");
16
16
  const workspace_models_1 = require("../utility/workspace-models");
17
17
  const schema_1 = require("./schema");
18
- function default_1(options) {
18
+ exports.default = (0, project_1.createProjectSchematic)((options, { project }) => {
19
19
  switch (options.type) {
20
20
  case schema_1.Type.Karma:
21
21
  return addKarmaConfig(options);
22
22
  case schema_1.Type.Browserslist:
23
- return addBrowserslistConfig(options);
23
+ return addBrowserslistConfig(project.root);
24
24
  default:
25
25
  throw new schematics_1.SchematicsException(`"${options.type}" is an unknown configuration file type.`);
26
26
  }
27
- }
28
- function addBrowserslistConfig(options) {
29
- return async (host) => {
30
- const workspace = await (0, workspace_1.getWorkspace)(host);
31
- const project = workspace.projects.get(options.project);
32
- if (!project) {
33
- throw new schematics_1.SchematicsException(`Project name "${options.project}" doesn't not exist.`);
34
- }
35
- // Read Angular's default vendored `.browserslistrc` file.
36
- const config = await (0, promises_1.readFile)(node_path_1.posix.join(__dirname, '.browserslistrc'), 'utf8');
37
- return (0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)('./files'), [
38
- (0, schematics_1.filter)((p) => p.endsWith('.browserslistrc.template')),
39
- (0, schematics_1.applyTemplates)({ config }),
40
- (0, schematics_1.move)(project.root),
41
- ]));
42
- };
27
+ });
28
+ async function addBrowserslistConfig(projectRoot) {
29
+ // Read Angular's default vendored `.browserslistrc` file.
30
+ const config = await (0, promises_1.readFile)(node_path_1.posix.join(__dirname, '.browserslistrc'), 'utf8');
31
+ return (0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)('./files'), [
32
+ (0, schematics_1.filter)((p) => p.endsWith('.browserslistrc.template')),
33
+ (0, schematics_1.applyTemplates)({ config }),
34
+ (0, schematics_1.move)(projectRoot),
35
+ ]));
43
36
  }
44
37
  function addKarmaConfig(options) {
45
38
  return (0, workspace_1.updateWorkspace)((workspace) => {
@@ -7,4 +7,5 @@
7
7
  */
8
8
  import { Rule } from '@angular-devkit/schematics';
9
9
  import { Schema as DirectiveOptions } from './schema';
10
- export default function (options: DirectiveOptions): Rule;
10
+ declare const _default: (options: DirectiveOptions) => Rule;
11
+ export default _default;
@@ -7,12 +7,12 @@
7
7
  * found in the LICENSE file at https://angular.dev/license
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.default = default_1;
11
10
  const schematics_1 = require("@angular-devkit/schematics");
12
11
  const add_declaration_to_ng_module_1 = require("../utility/add-declaration-to-ng-module");
13
12
  const find_module_1 = require("../utility/find-module");
14
13
  const generate_from_files_1 = require("../utility/generate-from-files");
15
14
  const parse_name_1 = require("../utility/parse-name");
15
+ const project_1 = require("../utility/project");
16
16
  const validation_1 = require("../utility/validation");
17
17
  const workspace_1 = require("../utility/workspace");
18
18
  function buildSelector(options, projectPrefix) {
@@ -25,29 +25,22 @@ function buildSelector(options, projectPrefix) {
25
25
  }
26
26
  return schematics_1.strings.camelize(selector);
27
27
  }
28
- function default_1(options) {
29
- return async (host) => {
30
- const workspace = await (0, workspace_1.getWorkspace)(host);
31
- const project = workspace.projects.get(options.project);
32
- if (!project) {
33
- throw new schematics_1.SchematicsException(`Project "${options.project}" does not exist.`);
34
- }
35
- if (options.path === undefined) {
36
- options.path = (0, workspace_1.buildDefaultPath)(project);
37
- }
38
- options.module = (0, find_module_1.findModuleFromOptions)(host, options);
39
- const parsedPath = (0, parse_name_1.parseName)(options.path, options.name);
40
- options.name = parsedPath.name;
41
- options.path = parsedPath.path;
42
- options.selector = options.selector || buildSelector(options, project.prefix || '');
43
- (0, validation_1.validateHtmlSelector)(options.selector);
44
- (0, validation_1.validateClassName)(schematics_1.strings.classify(options.name));
45
- return (0, schematics_1.chain)([
46
- (0, add_declaration_to_ng_module_1.addDeclarationToNgModule)({
47
- type: 'directive',
48
- ...options,
49
- }),
50
- (0, generate_from_files_1.generateFromFiles)(options),
51
- ]);
52
- };
53
- }
28
+ exports.default = (0, project_1.createProjectSchematic)((options, { project, tree }) => {
29
+ if (options.path === undefined) {
30
+ options.path = (0, workspace_1.buildDefaultPath)(project);
31
+ }
32
+ options.module = (0, find_module_1.findModuleFromOptions)(tree, options);
33
+ const parsedPath = (0, parse_name_1.parseName)(options.path, options.name);
34
+ options.name = parsedPath.name;
35
+ options.path = parsedPath.path;
36
+ options.selector = options.selector || buildSelector(options, project.prefix || '');
37
+ (0, validation_1.validateHtmlSelector)(options.selector);
38
+ (0, validation_1.validateClassName)(schematics_1.strings.classify(options.name));
39
+ return (0, schematics_1.chain)([
40
+ (0, add_declaration_to_ng_module_1.addDeclarationToNgModule)({
41
+ type: 'directive',
42
+ ...options,
43
+ }),
44
+ (0, generate_from_files_1.generateFromFiles)(options),
45
+ ]);
46
+ });
@@ -1,28 +1,8 @@
1
1
  {
2
2
  "encapsulation": false,
3
3
  "schematics": {
4
- "replace-provide-server-rendering-import": {
5
- "version": "20.0.0",
6
- "factory": "./replace-provide-server-rendering-import/migration",
7
- "description": "Migrate imports of 'provideServerRendering' from '@angular/platform-server' to '@angular/ssr'."
8
- },
9
- "replace-provide-server-routing": {
10
- "version": "20.0.0",
11
- "factory": "./replace-provide-server-routing/migration",
12
- "description": "Migrate 'provideServerRendering' to use 'withRoutes', and remove 'provideServerRouting' and 'provideServerRoutesConfig' from '@angular/ssr'."
13
- },
14
- "update-module-resolution": {
15
- "version": "20.0.0",
16
- "factory": "./update-module-resolution/migration",
17
- "description": "Update 'moduleResolution' to 'bundler' in TypeScript configurations. You can read more about this, here: https://www.typescriptlang.org/tsconfig/#moduleResolution"
18
- },
19
- "previous-style-guide": {
20
- "version": "20.0.0",
21
- "factory": "./previous-style-guide/migration",
22
- "description": "Update workspace generation defaults to maintain previous style guide behavior."
23
- },
24
4
  "use-application-builder": {
25
- "version": "20.0.0",
5
+ "version": "21.0.0",
26
6
  "factory": "./use-application-builder/migration",
27
7
  "description": "Migrate application projects to the new build system. Application projects that are using the '@angular-devkit/build-angular' package's 'browser' and/or 'browser-esbuild' builders will be migrated to use the new 'application' builder. You can read more about this, including known issues and limitations, here: https://angular.dev/tools/cli/build-system-migration",
28
8
  "optional": true,
@@ -30,7 +10,7 @@
30
10
  "documentation": "tools/cli/build-system-migration"
31
11
  },
32
12
  "remove-default-karma-config": {
33
- "version": "20.2.0",
13
+ "version": "21.0.0",
34
14
  "factory": "./karma/migration",
35
15
  "description": "Remove any karma configuration files that only contain the default content. The default configuration is automatically available without a specific project file."
36
16
  }
package/module/index.d.ts CHANGED
@@ -7,4 +7,5 @@
7
7
  */
8
8
  import { Rule } from '@angular-devkit/schematics';
9
9
  import { Schema as ModuleOptions } from './schema';
10
- export default function (options: ModuleOptions): Rule;
10
+ declare const _default: (options: ModuleOptions) => Rule;
11
+ export default _default;
package/module/index.js CHANGED
@@ -40,7 +40,6 @@ var __importStar = (this && this.__importStar) || (function () {
40
40
  };
41
41
  })();
42
42
  Object.defineProperty(exports, "__esModule", { value: true });
43
- exports.default = default_1;
44
43
  const schematics_1 = require("@angular-devkit/schematics");
45
44
  const posix_1 = require("node:path/posix");
46
45
  const ts = __importStar(require("../third_party/github.com/Microsoft/TypeScript/lib/typescript"));
@@ -48,6 +47,7 @@ const ast_utils_1 = require("../utility/ast-utils");
48
47
  const change_1 = require("../utility/change");
49
48
  const find_module_1 = require("../utility/find-module");
50
49
  const parse_name_1 = require("../utility/parse-name");
50
+ const project_1 = require("../utility/project");
51
51
  const validation_1 = require("../utility/validation");
52
52
  const workspace_1 = require("../utility/workspace");
53
53
  const schema_1 = require("./schema");
@@ -112,53 +112,51 @@ function buildRoute(options, modulePath) {
112
112
  const loadChildren = `() => import('${relativeModulePath}').then(m => m.${moduleName})`;
113
113
  return `{ path: '${options.route}', loadChildren: ${loadChildren} }`;
114
114
  }
115
- function default_1(options) {
116
- return async (host) => {
117
- if (options.path === undefined) {
118
- options.path = await (0, workspace_1.createDefaultPath)(host, options.project);
119
- }
120
- if (options.module) {
121
- options.module = (0, find_module_1.findModuleFromOptions)(host, options);
122
- }
123
- let routingModulePath;
124
- const isLazyLoadedModuleGen = !!(options.route && options.module);
125
- if (isLazyLoadedModuleGen) {
126
- options.routingScope = schema_1.RoutingScope.Child;
127
- routingModulePath = getRoutingModulePath(host, options.module);
128
- }
129
- const parsedPath = (0, parse_name_1.parseName)(options.path, options.name);
130
- options.name = parsedPath.name;
131
- options.path = parsedPath.path;
132
- (0, validation_1.validateClassName)(schematics_1.strings.classify(options.name));
133
- const templateSource = (0, schematics_1.apply)((0, schematics_1.url)('./files'), [
134
- options.routing || (isLazyLoadedModuleGen && routingModulePath)
135
- ? (0, schematics_1.noop)()
136
- : (0, schematics_1.filter)((path) => !path.includes('-routing')),
137
- (0, schematics_1.applyTemplates)({
138
- ...schematics_1.strings,
139
- 'if-flat': (s) => (options.flat ? '' : s),
140
- lazyRoute: isLazyLoadedModuleGen,
141
- lazyRouteWithoutRouteModule: isLazyLoadedModuleGen && !routingModulePath,
142
- lazyRouteWithRouteModule: isLazyLoadedModuleGen && !!routingModulePath,
143
- ...options,
144
- }),
145
- (0, schematics_1.move)(parsedPath.path),
146
- ]);
147
- const moduleDasherized = schematics_1.strings.dasherize(options.name);
148
- const modulePath = `${!options.flat ? moduleDasherized + '/' : ''}${moduleDasherized}${options.typeSeparator}module.ts`;
149
- const componentOptions = {
150
- module: modulePath,
151
- flat: options.flat,
152
- name: options.name,
153
- path: options.path,
154
- project: options.project,
155
- standalone: false,
156
- };
157
- return (0, schematics_1.chain)([
158
- !isLazyLoadedModuleGen ? addImportToNgModule(options) : (0, schematics_1.noop)(),
159
- addRouteDeclarationToNgModule(options, routingModulePath),
160
- (0, schematics_1.mergeWith)(templateSource),
161
- isLazyLoadedModuleGen ? (0, schematics_1.schematic)('component', componentOptions) : (0, schematics_1.noop)(),
162
- ]);
115
+ exports.default = (0, project_1.createProjectSchematic)(async (options, { tree }) => {
116
+ if (options.path === undefined) {
117
+ options.path = await (0, workspace_1.createDefaultPath)(tree, options.project);
118
+ }
119
+ if (options.module) {
120
+ options.module = (0, find_module_1.findModuleFromOptions)(tree, options);
121
+ }
122
+ let routingModulePath;
123
+ const isLazyLoadedModuleGen = !!(options.route && options.module);
124
+ if (isLazyLoadedModuleGen) {
125
+ options.routingScope = schema_1.RoutingScope.Child;
126
+ routingModulePath = getRoutingModulePath(tree, options.module);
127
+ }
128
+ const parsedPath = (0, parse_name_1.parseName)(options.path, options.name);
129
+ options.name = parsedPath.name;
130
+ options.path = parsedPath.path;
131
+ (0, validation_1.validateClassName)(schematics_1.strings.classify(options.name));
132
+ const templateSource = (0, schematics_1.apply)((0, schematics_1.url)('./files'), [
133
+ options.routing || (isLazyLoadedModuleGen && routingModulePath)
134
+ ? (0, schematics_1.noop)()
135
+ : (0, schematics_1.filter)((path) => !path.includes('-routing')),
136
+ (0, schematics_1.applyTemplates)({
137
+ ...schematics_1.strings,
138
+ 'if-flat': (s) => (options.flat ? '' : s),
139
+ lazyRoute: isLazyLoadedModuleGen,
140
+ lazyRouteWithoutRouteModule: isLazyLoadedModuleGen && !routingModulePath,
141
+ lazyRouteWithRouteModule: isLazyLoadedModuleGen && !!routingModulePath,
142
+ ...options,
143
+ }),
144
+ (0, schematics_1.move)(parsedPath.path),
145
+ ]);
146
+ const moduleDasherized = schematics_1.strings.dasherize(options.name);
147
+ const modulePath = `${!options.flat ? moduleDasherized + '/' : ''}${moduleDasherized}${options.typeSeparator}module.ts`;
148
+ const componentOptions = {
149
+ module: modulePath,
150
+ flat: options.flat,
151
+ name: options.name,
152
+ path: options.path,
153
+ project: options.project,
154
+ standalone: false,
163
155
  };
164
- }
156
+ return (0, schematics_1.chain)([
157
+ !isLazyLoadedModuleGen ? addImportToNgModule(options) : (0, schematics_1.noop)(),
158
+ addRouteDeclarationToNgModule(options, routingModulePath),
159
+ (0, schematics_1.mergeWith)(templateSource),
160
+ isLazyLoadedModuleGen ? (0, schematics_1.schematic)('component', componentOptions) : (0, schematics_1.noop)(),
161
+ ]);
162
+ });
@@ -140,7 +140,6 @@ export type CommitObject = {
140
140
  */
141
141
  export declare enum PackageManager {
142
142
  Bun = "bun",
143
- Cnpm = "cnpm",
144
143
  Npm = "npm",
145
144
  Pnpm = "pnpm",
146
145
  Yarn = "yarn"
@@ -152,7 +151,8 @@ export declare enum Style {
152
151
  Css = "css",
153
152
  Less = "less",
154
153
  Sass = "sass",
155
- Scss = "scss"
154
+ Scss = "scss",
155
+ Tailwind = "tailwind"
156
156
  }
157
157
  /**
158
158
  * Sets the view encapsulation mode for components in the initial project. This determines
package/ng-new/schema.js CHANGED
@@ -19,7 +19,6 @@ var AiConfig;
19
19
  var PackageManager;
20
20
  (function (PackageManager) {
21
21
  PackageManager["Bun"] = "bun";
22
- PackageManager["Cnpm"] = "cnpm";
23
22
  PackageManager["Npm"] = "npm";
24
23
  PackageManager["Pnpm"] = "pnpm";
25
24
  PackageManager["Yarn"] = "yarn";
@@ -33,6 +32,7 @@ var Style;
33
32
  Style["Less"] = "less";
34
33
  Style["Sass"] = "sass";
35
34
  Style["Scss"] = "scss";
35
+ Style["Tailwind"] = "tailwind";
36
36
  })(Style || (exports.Style = Style = {}));
37
37
  /**
38
38
  * Sets the view encapsulation mode for components in the initial project. This determines