@nx/js 24.0.0-beta.2 → 24.0.0-beta.3

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 (30) hide show
  1. package/dist/internal.d.ts +2 -0
  2. package/dist/internal.js +8 -2
  3. package/dist/src/generators/init/init.js +3 -33
  4. package/dist/src/generators/init/schema.d.ts +0 -1
  5. package/dist/src/generators/library/library.d.ts +1 -1
  6. package/dist/src/generators/library/library.js +3 -11
  7. package/dist/src/generators/library/schema.d.ts +0 -1
  8. package/dist/src/generators/setup-build/generator.js +0 -5
  9. package/dist/src/plugins/scripts/create-script-nodes.d.ts +6 -2
  10. package/dist/src/plugins/scripts/create-script-nodes.js +18 -71
  11. package/dist/src/plugins/scripts/node-plugin.d.ts +2 -1
  12. package/dist/src/plugins/scripts/shebang.d.ts +7 -2
  13. package/dist/src/plugins/scripts/shebang.js +27 -10
  14. package/dist/src/plugins/scripts/target-name.d.ts +9 -0
  15. package/dist/src/plugins/scripts/target-name.js +19 -0
  16. package/dist/src/plugins/scripts/tsx-plugin.d.ts +3 -2
  17. package/dist/src/plugins/typescript/build-typechecks.d.ts +8 -0
  18. package/dist/src/plugins/typescript/build-typechecks.js +45 -0
  19. package/dist/src/plugins/typescript/plugin.js +107 -38
  20. package/dist/src/plugins/typescript/typecheck-target.d.ts +54 -0
  21. package/dist/src/plugins/typescript/typecheck-target.js +81 -0
  22. package/dist/src/utils/add-linting-to-project.d.ts +0 -2
  23. package/dist/src/utils/add-linting-to-project.js +0 -3
  24. package/dist/src/utils/typescript/add-typescript-plugin.d.ts +22 -0
  25. package/dist/src/utils/typescript/add-typescript-plugin.js +145 -0
  26. package/dist/src/utils/typescript/ts-solution-setup.d.ts +1 -1
  27. package/dist/src/utils/typescript/ts-solution-setup.js +1 -10
  28. package/package.json +11 -11
  29. package/dist/src/plugins/scripts/frontmatter.d.ts +0 -6
  30. package/dist/src/plugins/scripts/frontmatter.js +0 -52
@@ -1,6 +0,0 @@
1
- export type Frontmatter = Record<string, unknown>;
2
- /**
3
- * Reads the YAML in a `/** @nx ... *\/` block comment after the shebang. Any other
4
- * first comment yields `{}`. Throws on malformed YAML or an unterminated `@nx` block.
5
- */
6
- export declare function parseFrontmatter(source: string): Frontmatter;
@@ -1,52 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseFrontmatter = parseFrontmatter;
4
- const js_yaml_1 = require("@zkochan/js-yaml");
5
- const shebang_1 = require("./shebang");
6
- /**
7
- * Reads the YAML in a `/** @nx ... *\/` block comment after the shebang. Any other
8
- * first comment yields `{}`. Throws on malformed YAML or an unterminated `@nx` block.
9
- */
10
- function parseFrontmatter(source) {
11
- const lines = (0, shebang_1.stripBom)(source).split(/\r?\n/);
12
- // lines[0] is the shebang; blank lines may follow it.
13
- let start = 1;
14
- while (start < lines.length && !lines[start].trim()) {
15
- start++;
16
- }
17
- if (!lines[start]?.trim().startsWith('/*')) {
18
- return {};
19
- }
20
- const block = [];
21
- let terminated = false;
22
- for (let i = start; i < lines.length; i++) {
23
- let line = i === start ? lines[i].trim().replace(/^\/\*\*?/, '') : lines[i];
24
- const end = line.indexOf('*/');
25
- if (end !== -1) {
26
- line = line.slice(0, end);
27
- terminated = true;
28
- }
29
- // Tolerate JSDoc-style ` * ` line prefixes.
30
- block.push(line.replace(/^\s*\* ?/, ''));
31
- if (terminated) {
32
- break;
33
- }
34
- }
35
- const firstContent = block.findIndex((line) => line.trim());
36
- const marker = (block[firstContent] ?? '').match(/^\s*@nx(?=\s|$)(.*)$/);
37
- if (!marker) {
38
- return {};
39
- }
40
- if (!terminated) {
41
- throw new Error('Unterminated "@nx" frontmatter block.');
42
- }
43
- const body = [marker[1].trim(), ...block.slice(firstContent + 1)];
44
- const parsed = (0, js_yaml_1.load)(body.join('\n'));
45
- if (parsed == null) {
46
- return {};
47
- }
48
- if (typeof parsed !== 'object' || Array.isArray(parsed)) {
49
- throw new Error('The "@nx" frontmatter block must be a YAML mapping.');
50
- }
51
- return parsed;
52
- }