@cedarjs/structure 9.0.0-canary.1784 → 9.0.0-canary.3124

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 (118) hide show
  1. package/README.md +1 -1
  2. package/dist/errors.d.ts +2 -1
  3. package/dist/errors.d.ts.map +1 -1
  4. package/dist/errors.js +10 -15
  5. package/dist/errors.js.map +1 -0
  6. package/dist/index.d.ts +7 -7
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +40 -67
  9. package/dist/index.js.map +1 -0
  10. package/dist/model/RWCell.d.ts +4 -4
  11. package/dist/model/RWCell.d.ts.map +1 -1
  12. package/dist/model/RWCell.js +111 -103
  13. package/dist/model/RWCell.js.map +1 -0
  14. package/dist/model/RWComponent.d.ts +2 -2
  15. package/dist/model/RWComponent.d.ts.map +1 -1
  16. package/dist/model/RWComponent.js +46 -41
  17. package/dist/model/RWComponent.js.map +1 -0
  18. package/dist/model/RWEnvHelper.d.ts +4 -4
  19. package/dist/model/RWEnvHelper.d.ts.map +1 -1
  20. package/dist/model/RWEnvHelper.js +233 -205
  21. package/dist/model/RWEnvHelper.js.map +1 -0
  22. package/dist/model/RWFunction.d.ts +2 -2
  23. package/dist/model/RWFunction.d.ts.map +1 -1
  24. package/dist/model/RWFunction.js +10 -15
  25. package/dist/model/RWFunction.js.map +1 -0
  26. package/dist/model/RWLayout.d.ts +2 -2
  27. package/dist/model/RWLayout.d.ts.map +1 -1
  28. package/dist/model/RWLayout.js +10 -15
  29. package/dist/model/RWLayout.js.map +1 -0
  30. package/dist/model/RWPage.d.ts +3 -3
  31. package/dist/model/RWPage.d.ts.map +1 -1
  32. package/dist/model/RWPage.js +61 -57
  33. package/dist/model/RWPage.js.map +1 -0
  34. package/dist/model/RWProject.d.ts +22 -18
  35. package/dist/model/RWProject.d.ts.map +1 -1
  36. package/dist/model/RWProject.js +257 -164
  37. package/dist/model/RWProject.js.map +1 -0
  38. package/dist/model/RWRoute.d.ts +32 -6
  39. package/dist/model/RWRoute.d.ts.map +1 -1
  40. package/dist/model/RWRoute.js +424 -260
  41. package/dist/model/RWRoute.js.map +1 -0
  42. package/dist/model/RWRouter.d.ts +4 -4
  43. package/dist/model/RWRouter.d.ts.map +1 -1
  44. package/dist/model/RWRouter.js +130 -126
  45. package/dist/model/RWRouter.js.map +1 -0
  46. package/dist/model/RWSDL.d.ts +5 -5
  47. package/dist/model/RWSDL.d.ts.map +1 -1
  48. package/dist/model/RWSDL.js +96 -84
  49. package/dist/model/RWSDL.js.map +1 -0
  50. package/dist/model/RWSDLField.d.ts +6 -6
  51. package/dist/model/RWSDLField.d.ts.map +1 -1
  52. package/dist/model/RWSDLField.js +79 -81
  53. package/dist/model/RWSDLField.js.map +1 -0
  54. package/dist/model/RWService.d.ts +4 -4
  55. package/dist/model/RWService.d.ts.map +1 -1
  56. package/dist/model/RWService.js +76 -76
  57. package/dist/model/RWService.js.map +1 -0
  58. package/dist/model/RWServiceFunction.d.ts +4 -4
  59. package/dist/model/RWServiceFunction.d.ts.map +1 -1
  60. package/dist/model/RWServiceFunction.js +95 -97
  61. package/dist/model/RWServiceFunction.js.map +1 -0
  62. package/dist/model/RWTOML.d.ts +3 -3
  63. package/dist/model/RWTOML.d.ts.map +1 -1
  64. package/dist/model/RWTOML.js +53 -55
  65. package/dist/model/RWTOML.js.map +1 -0
  66. package/dist/model/index.d.ts +2 -2
  67. package/dist/model/index.d.ts.map +1 -1
  68. package/dist/model/index.js +3 -20
  69. package/dist/model/index.js.map +1 -0
  70. package/dist/model/util/pageMutationUsage.d.ts +18 -0
  71. package/dist/model/util/pageMutationUsage.d.ts.map +1 -0
  72. package/dist/model/util/pageMutationUsage.js +256 -0
  73. package/dist/model/util/pageMutationUsage.js.map +1 -0
  74. package/dist/model/util/process_env.js +44 -62
  75. package/dist/model/util/process_env.js.map +1 -0
  76. package/dist/nodes.d.ts +2 -2
  77. package/dist/nodes.d.ts.map +1 -1
  78. package/dist/nodes.js +171 -164
  79. package/dist/nodes.js.map +1 -0
  80. package/dist/util.js +23 -33
  81. package/dist/util.js.map +1 -0
  82. package/dist/x/Array.d.ts.map +1 -1
  83. package/dist/x/Array.js +15 -25
  84. package/dist/x/Array.js.map +1 -0
  85. package/dist/x/Location.d.ts +1 -1
  86. package/dist/x/Location.d.ts.map +1 -1
  87. package/dist/x/Location.js +11 -17
  88. package/dist/x/Location.js.map +1 -0
  89. package/dist/x/Position.js +18 -29
  90. package/dist/x/Position.js.map +1 -0
  91. package/dist/x/Range.d.ts +1 -1
  92. package/dist/x/Range.d.ts.map +1 -1
  93. package/dist/x/Range.js +17 -22
  94. package/dist/x/Range.js.map +1 -0
  95. package/dist/x/URL.js +59 -75
  96. package/dist/x/URL.js.map +1 -0
  97. package/dist/x/child_process.d.ts +1 -1
  98. package/dist/x/child_process.d.ts.map +1 -1
  99. package/dist/x/child_process.js +35 -49
  100. package/dist/x/child_process.js.map +1 -0
  101. package/dist/x/decorators.d.ts +2 -2
  102. package/dist/x/decorators.d.ts.map +1 -1
  103. package/dist/x/decorators.js +46 -26
  104. package/dist/x/decorators.js.map +1 -0
  105. package/dist/x/diagnostics.d.ts +3 -3
  106. package/dist/x/diagnostics.d.ts.map +1 -1
  107. package/dist/x/diagnostics.js +163 -259
  108. package/dist/x/diagnostics.js.map +1 -0
  109. package/dist/x/path.js +36 -55
  110. package/dist/x/path.js.map +1 -0
  111. package/dist/x/prisma.d.ts +2 -2
  112. package/dist/x/prisma.d.ts.map +1 -1
  113. package/dist/x/prisma.js +32 -55
  114. package/dist/x/prisma.js.map +1 -0
  115. package/dist/x/ts-morph.js +34 -45
  116. package/dist/x/ts-morph.js.map +1 -0
  117. package/package.json +46 -22
  118. package/LICENSE +0 -21
@@ -1,56 +1,54 @@
1
- "use strict";
2
-
3
- var _Object$defineProperty = require("@babel/runtime-corejs3/core-js/object/define-property");
4
- var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
5
- var _interopRequireWildcard = require("@babel/runtime-corejs3/helpers/interopRequireWildcard").default;
6
- _Object$defineProperty(exports, "__esModule", {
7
- value: true
8
- });
9
- exports.RWTOML = void 0;
10
- var _getOwnPropertyDescriptor = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/object/get-own-property-descriptor"));
11
- var _applyDecoratedDescriptor2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/applyDecoratedDescriptor"));
12
- var toml = _interopRequireWildcard(require("smol-toml"));
13
- var _nodes = require("../nodes");
14
- var _decorators = require("../x/decorators");
15
- var _diagnostics = require("../x/diagnostics");
16
- var _Range = require("../x/Range");
17
- var _dec, _dec2, _class;
18
- let RWTOML = exports.RWTOML = (_dec = (0, _decorators.lazy)(), _dec2 = (0, _decorators.lazy)(), _class = class RWTOML extends _nodes.FileNode {
19
- constructor(filePath, parent) {
20
- super();
21
- this.filePath = filePath;
22
- this.parent = parent;
23
- }
24
- // @lazy() get content(): TOML.JsonMap {
25
- // return TOML.parse(this.text)
26
- // }
27
- // TODO: diagnostics
28
- get parsedTOML() {
29
- return toml.parse(this.text);
30
- }
31
- get web_includeEnvironmentVariables() {
32
- return this.parsedTOML?.web?.['includeEnvironmentVariables'] ?? [];
33
- }
34
- *diagnostics() {
35
- try {
36
- // eslint-disable-next-line @typescript-eslint/no-unused-expressions
37
- this.parsedTOML;
38
- } catch (e) {
39
- const pos = {
40
- line: e.line - 1,
41
- character: e.column - 1
42
- };
43
- const range = (0, _Range.Range_create)(pos, pos);
44
- // Forward the TOML parse error with correct location information
45
- yield (0, _diagnostics.err)({
46
- uri: this.uri,
47
- range
48
- }, 'TOML Parser Error: ' + e.message);
49
- return;
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import * as toml from 'smol-toml';
8
+ import { FileNode } from '../nodes.js';
9
+ import { lazy } from '../x/decorators.js';
10
+ import { err } from '../x/diagnostics.js';
11
+ import { Range_create } from '../x/Range.js';
12
+ export class RWTOML extends FileNode {
13
+ filePath;
14
+ parent;
15
+ constructor(filePath, parent) {
16
+ super();
17
+ this.filePath = filePath;
18
+ this.parent = parent;
50
19
  }
51
- // at this point we know that the TOML was parsed successfully
52
- //this.parsedTOML //?
53
- //const allowedTopElements = ['web', 'api']
54
- // TODO: check that schema is correct
55
- }
56
- }, (0, _applyDecoratedDescriptor2.default)(_class.prototype, "parsedTOML", [_dec], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "parsedTOML"), _class.prototype), (0, _applyDecoratedDescriptor2.default)(_class.prototype, "web_includeEnvironmentVariables", [_dec2], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "web_includeEnvironmentVariables"), _class.prototype), _class);
20
+ // @lazy() get content(): TOML.JsonMap {
21
+ // return TOML.parse(this.text)
22
+ // }
23
+ // TODO: diagnostics
24
+ get parsedTOML() {
25
+ return toml.parse(this.text);
26
+ }
27
+ get web_includeEnvironmentVariables() {
28
+ return this.parsedTOML?.web?.['includeEnvironmentVariables'] ?? [];
29
+ }
30
+ *diagnostics() {
31
+ try {
32
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
33
+ this.parsedTOML;
34
+ }
35
+ catch (e) {
36
+ const pos = { line: e.line - 1, character: e.column - 1 };
37
+ const range = Range_create(pos, pos);
38
+ // Forward the TOML parse error with correct location information
39
+ yield err({ uri: this.uri, range }, 'TOML Parser Error: ' + e.message);
40
+ return;
41
+ }
42
+ // at this point we know that the TOML was parsed successfully
43
+ //this.parsedTOML //?
44
+ //const allowedTopElements = ['web', 'api']
45
+ // TODO: check that schema is correct
46
+ }
47
+ }
48
+ __decorate([
49
+ lazy()
50
+ ], RWTOML.prototype, "parsedTOML", null);
51
+ __decorate([
52
+ lazy()
53
+ ], RWTOML.prototype, "web_includeEnvironmentVariables", null);
54
+ //# sourceMappingURL=RWTOML.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RWTOML.js","sourceRoot":"","sources":["../../src/model/RWTOML.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AAEjC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAA;AACzC,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAA;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAI5C,MAAM,OAAO,MAAO,SAAQ,QAAQ;IAEzB;IACA;IAFT,YACS,QAAgB,EAChB,MAAiB;QAExB,KAAK,EAAE,CAAA;QAHA,aAAQ,GAAR,QAAQ,CAAQ;QAChB,WAAM,GAAN,MAAM,CAAW;IAG1B,CAAC;IACD,wCAAwC;IACxC,iCAAiC;IACjC,IAAI;IACJ,oBAAoB;IACZ,IAAI,UAAU;QACpB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC9B,CAAC;IACO,IAAI,+BAA+B;QACzC,OAAO,IAAI,CAAC,UAAU,EAAE,GAAG,EAAE,CAAC,6BAA6B,CAAC,IAAI,EAAE,CAAA;IACpE,CAAC;IACD,CAAC,WAAW;QACV,IAAI,CAAC;YACH,oEAAoE;YACpE,IAAI,CAAC,UAAU,CAAA;QACjB,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,MAAM,GAAG,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,GAAG,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAA;YACzD,MAAM,KAAK,GAAG,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;YACpC,iEAAiE;YACjE,MAAM,GAAG,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,qBAAqB,GAAG,CAAC,CAAC,OAAO,CAAC,CAAA;YACtE,OAAM;QACR,CAAC;QACD,8DAA8D;QAC9D,qBAAqB;QACrB,2CAA2C;QAC3C,qCAAqC;IACvC,CAAC;CACF;AAtBS;IAAP,IAAI,EAAE;wCAEN;AACO;IAAP,IAAI,EAAE;6DAEN"}
@@ -1,3 +1,3 @@
1
- export { RWProject } from './RWProject';
2
- export { RWRoute } from './RWRoute';
1
+ export { RWProject } from './RWProject.js';
2
+ export { RWRoute } from './RWRoute.js';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/model/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/model/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA"}
@@ -1,20 +1,3 @@
1
- "use strict";
2
-
3
- var _Object$defineProperty = require("@babel/runtime-corejs3/core-js/object/define-property");
4
- _Object$defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- _Object$defineProperty(exports, "RWProject", {
8
- enumerable: true,
9
- get: function () {
10
- return _RWProject.RWProject;
11
- }
12
- });
13
- _Object$defineProperty(exports, "RWRoute", {
14
- enumerable: true,
15
- get: function () {
16
- return _RWRoute.RWRoute;
17
- }
18
- });
19
- var _RWProject = require("./RWProject");
20
- var _RWRoute = require("./RWRoute");
1
+ export { RWProject } from './RWProject.js';
2
+ export { RWRoute } from './RWRoute.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/model/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA"}
@@ -0,0 +1,18 @@
1
+ import type { RWProject } from '../RWProject.js';
2
+ /**
3
+ * Transitively walks the static imports reachable from `entryFilePath`
4
+ * (typically a page's file path) and collects the names of GraphQL mutation
5
+ * root fields used anywhere in that import graph, via `gql`/`graphql`
6
+ * tagged template literals.
7
+ *
8
+ * This is a best-effort, syntactic analysis: it does not resolve TypeScript
9
+ * path aliases beyond the `src/` -> `web/src/` convention, does not follow
10
+ * re-exports (`export * from './x'`), and skips any GraphQL document it
11
+ * can't parse (e.g. ones mangled by interpolation).
12
+ *
13
+ * @returns a map of mutation root field name -> the first file path (inside
14
+ * `web/src`) in which a `gql`/`graphql` document using that mutation was
15
+ * found.
16
+ */
17
+ export declare function getMutationFieldsUsedTransitively(project: RWProject, entryFilePath: string): Map<string, string>;
18
+ //# sourceMappingURL=pageMutationUsage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pageMutationUsage.d.ts","sourceRoot":"","sources":["../../../src/model/util/pageMutationUsage.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAoBhD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iCAAiC,CAC/C,OAAO,EAAE,SAAS,EAClB,aAAa,EAAE,MAAM,GACpB,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAiCrB"}
@@ -0,0 +1,256 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ import { Kind, OperationTypeNode, parse as parseGraphQL } from 'graphql';
4
+ import * as tsm from 'ts-morph';
5
+ import { createTSMSourceFile_cached } from '../../x/ts-morph.js';
6
+ /**
7
+ * File extensions (in resolution order) tried when an import specifier
8
+ * doesn't include one, mirroring typical Metro/webpack/vite resolution.
9
+ */
10
+ const RESOLVE_EXTENSIONS = ['.tsx', '.ts', '.jsx', '.js'];
11
+ /**
12
+ * Per-project cache of "mutation root field names found directly in this
13
+ * file" (i.e. not counting fields found in imported files). Many pages
14
+ * share the same components (e.g. a shared `<Form>` or layout), so caching
15
+ * per file - rather than per page - avoids re-parsing the same file many
16
+ * times when checking many routes.
17
+ */
18
+ const fileMutationFieldsCache = new WeakMap();
19
+ /**
20
+ * Transitively walks the static imports reachable from `entryFilePath`
21
+ * (typically a page's file path) and collects the names of GraphQL mutation
22
+ * root fields used anywhere in that import graph, via `gql`/`graphql`
23
+ * tagged template literals.
24
+ *
25
+ * This is a best-effort, syntactic analysis: it does not resolve TypeScript
26
+ * path aliases beyond the `src/` -> `web/src/` convention, does not follow
27
+ * re-exports (`export * from './x'`), and skips any GraphQL document it
28
+ * can't parse (e.g. ones mangled by interpolation).
29
+ *
30
+ * @returns a map of mutation root field name -> the first file path (inside
31
+ * `web/src`) in which a `gql`/`graphql` document using that mutation was
32
+ * found.
33
+ */
34
+ export function getMutationFieldsUsedTransitively(project, entryFilePath) {
35
+ const usedIn = new Map();
36
+ const visited = new Set();
37
+ const queue = [path.normalize(entryFilePath)];
38
+ while (queue.length > 0) {
39
+ const filePath = queue.shift();
40
+ if (!filePath) {
41
+ break;
42
+ }
43
+ if (visited.has(filePath)) {
44
+ continue;
45
+ }
46
+ visited.add(filePath);
47
+ for (const fieldName of getMutationFieldNamesForFile(project, filePath)) {
48
+ if (!usedIn.has(fieldName)) {
49
+ usedIn.set(fieldName, filePath);
50
+ }
51
+ }
52
+ for (const importedFilePath of resolveImportedFilePaths(project, filePath)) {
53
+ if (!visited.has(importedFilePath)) {
54
+ queue.push(importedFilePath);
55
+ }
56
+ }
57
+ }
58
+ return usedIn;
59
+ }
60
+ /**
61
+ * Returns (and caches at the project level) the mutation root field names
62
+ * used directly within `filePath`, i.e. not counting any imported files.
63
+ */
64
+ function getMutationFieldNamesForFile(project, filePath) {
65
+ let cache = fileMutationFieldsCache.get(project);
66
+ if (!cache) {
67
+ cache = new Map();
68
+ fileMutationFieldsCache.set(project, cache);
69
+ }
70
+ const cached = cache.get(filePath);
71
+ if (cached) {
72
+ return cached;
73
+ }
74
+ const fieldNames = extractMutationFieldNames(filePath);
75
+ cache.set(filePath, fieldNames);
76
+ return fieldNames;
77
+ }
78
+ /**
79
+ * Parses `filePath` and extracts the top-level selection-set field names of
80
+ * every `mutation` operation defined in a `gql`/`graphql` tagged template
81
+ * literal within it.
82
+ */
83
+ function extractMutationFieldNames(filePath) {
84
+ const fieldNames = new Set();
85
+ const sf = readSourceFile(filePath);
86
+ if (!sf) {
87
+ return fieldNames;
88
+ }
89
+ for (const tagged of sf.getDescendantsOfKind(tsm.SyntaxKind.TaggedTemplateExpression)) {
90
+ const tag = tagged.getTag();
91
+ if (!tsm.Node.isIdentifier(tag)) {
92
+ continue;
93
+ }
94
+ if (tag.getText() !== 'gql' && tag.getText() !== 'graphql') {
95
+ continue;
96
+ }
97
+ const documentText = TemplateLiteral_toStaticText(tagged.getTemplate());
98
+ if (!documentText) {
99
+ continue;
100
+ }
101
+ try {
102
+ const document = parseGraphQL(documentText);
103
+ for (const definition of document.definitions) {
104
+ if (definition.kind !== Kind.OPERATION_DEFINITION ||
105
+ definition.operation !== OperationTypeNode.MUTATION) {
106
+ continue;
107
+ }
108
+ for (const selection of definition.selectionSet.selections) {
109
+ if (selection.kind === Kind.FIELD) {
110
+ fieldNames.add(selection.name.value);
111
+ }
112
+ }
113
+ }
114
+ }
115
+ catch {
116
+ // Best-effort: skip documents we can't parse (e.g. ones mangled by
117
+ // interpolation) rather than failing the whole analysis.
118
+ continue;
119
+ }
120
+ }
121
+ return fieldNames;
122
+ }
123
+ /**
124
+ * Extracts the static text of a template literal. For templates with
125
+ * substitutions (e.g. an interpolated fragment), the quasi (non-interpolated)
126
+ * parts are concatenated, which is good enough to preserve the operation's
127
+ * field structure even though the interpolated content itself is dropped.
128
+ */
129
+ function TemplateLiteral_toStaticText(template) {
130
+ if (tsm.Node.isNoSubstitutionTemplateLiteral(template)) {
131
+ return template.getLiteralText();
132
+ }
133
+ if (tsm.Node.isTemplateExpression(template)) {
134
+ let text = template.getHead().getLiteralText();
135
+ for (const span of template.getTemplateSpans()) {
136
+ text += span.getLiteral().getLiteralText();
137
+ }
138
+ return text;
139
+ }
140
+ return undefined;
141
+ }
142
+ /**
143
+ * Resolves the file paths of every `ImportDeclaration` module specifier in
144
+ * `filePath` that points inside `web/src`. Import specifiers pointing to npm
145
+ * packages, the api side, or anything else outside `web/src` are skipped.
146
+ */
147
+ function resolveImportedFilePaths(project, filePath) {
148
+ const sf = readSourceFile(filePath);
149
+ if (!sf) {
150
+ return [];
151
+ }
152
+ const resolved = [];
153
+ for (const importDecl of sf.getDescendantsOfKind(tsm.SyntaxKind.ImportDeclaration)) {
154
+ const specifier = importDecl.getModuleSpecifierValue();
155
+ const resolvedPath = resolveModuleSpecifier(project, filePath, specifier);
156
+ if (resolvedPath) {
157
+ resolved.push(resolvedPath);
158
+ }
159
+ }
160
+ return resolved;
161
+ }
162
+ /**
163
+ * Resolves a single import specifier to an absolute file path inside
164
+ * `web/src`, or `undefined` if it's not a relative import / `src/`-aliased
165
+ * import, or if it doesn't resolve to a file inside `web/src` (e.g. an npm
166
+ * package, or an api-side import).
167
+ */
168
+ function resolveModuleSpecifier(project, fromFilePath, specifier) {
169
+ const webSrc = project.pathHelper.web.src;
170
+ let basePath;
171
+ if (specifier.startsWith('.')) {
172
+ basePath = path.resolve(path.dirname(fromFilePath), specifier);
173
+ }
174
+ else if (specifier === 'src' || specifier.startsWith('src/')) {
175
+ basePath = path.join(webSrc, specifier.slice('src'.length));
176
+ }
177
+ else {
178
+ // Not a relative or `src/`-aliased import (e.g. an npm package, or an
179
+ // absolute import into the api side) - nothing to resolve.
180
+ return undefined;
181
+ }
182
+ const resolvedPath = resolveWithExtensions(basePath);
183
+ if (!resolvedPath) {
184
+ return undefined;
185
+ }
186
+ const relativeToWebSrc = path.relative(webSrc, resolvedPath);
187
+ if (relativeToWebSrc.startsWith('..') || path.isAbsolute(relativeToWebSrc)) {
188
+ // Resolves outside web/src (e.g. reaching into the api side)
189
+ return undefined;
190
+ }
191
+ return resolvedPath;
192
+ }
193
+ /**
194
+ * Tries `basePath` as-is, then with each of `RESOLVE_EXTENSIONS`, then as a
195
+ * directory index file with each of `RESOLVE_EXTENSIONS`.
196
+ */
197
+ function resolveWithExtensions(basePath) {
198
+ if (isFile(basePath)) {
199
+ return basePath;
200
+ }
201
+ // An ESM-style specifier (e.g. `./Foo.js`) refers to the TS source
202
+ // (`./Foo.tsx`), not a literal `.js` file.
203
+ const jsExtMatch = /\.(js|jsx)$/.exec(basePath);
204
+ if (jsExtMatch) {
205
+ const withoutExt = basePath.slice(0, -jsExtMatch[0].length);
206
+ for (const ext of RESOLVE_EXTENSIONS) {
207
+ const candidate = withoutExt + ext;
208
+ if (isFile(candidate)) {
209
+ return candidate;
210
+ }
211
+ }
212
+ }
213
+ for (const ext of RESOLVE_EXTENSIONS) {
214
+ const candidate = basePath + ext;
215
+ if (isFile(candidate)) {
216
+ return candidate;
217
+ }
218
+ }
219
+ for (const ext of RESOLVE_EXTENSIONS) {
220
+ const candidate = path.join(basePath, 'index' + ext);
221
+ if (isFile(candidate)) {
222
+ return candidate;
223
+ }
224
+ }
225
+ return undefined;
226
+ }
227
+ function isFile(filePath) {
228
+ try {
229
+ return fs.statSync(filePath).isFile();
230
+ }
231
+ catch {
232
+ return false;
233
+ }
234
+ }
235
+ /**
236
+ * Reads and parses `filePath` with ts-morph, going through the same cached
237
+ * in-memory source-file infrastructure the rest of the model uses (see
238
+ * `FileNode.sf`). Returns `undefined` (rather than throwing) for files that
239
+ * don't exist or fail to parse, since this analysis must degrade gracefully.
240
+ */
241
+ function readSourceFile(filePath) {
242
+ let text;
243
+ try {
244
+ text = fs.readFileSync(filePath, 'utf8');
245
+ }
246
+ catch {
247
+ return undefined;
248
+ }
249
+ try {
250
+ return createTSMSourceFile_cached(filePath, text);
251
+ }
252
+ catch {
253
+ return undefined;
254
+ }
255
+ }
256
+ //# sourceMappingURL=pageMutationUsage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pageMutationUsage.js","sourceRoot":"","sources":["../../../src/model/util/pageMutationUsage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,IAAI,MAAM,WAAW,CAAA;AAE5B,OAAO,EAAE,IAAI,EAAE,iBAAiB,EAAE,KAAK,IAAI,YAAY,EAAE,MAAM,SAAS,CAAA;AACxE,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAE/B,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAA;AAGhE;;;GAGG;AACH,MAAM,kBAAkB,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,CAAA;AAEzD;;;;;;GAMG;AACH,MAAM,uBAAuB,GAAG,IAAI,OAAO,EAGxC,CAAA;AAEH;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,iCAAiC,CAC/C,OAAkB,EAClB,aAAqB;IAErB,MAAM,MAAM,GAAG,IAAI,GAAG,EAAkB,CAAA;IACxC,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAA;IACjC,MAAM,KAAK,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAA;IAE7C,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxB,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,EAAE,CAAA;QAC9B,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAK;QACP,CAAC;QAED,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC1B,SAAQ;QACV,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,QAAQ,CAA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C;IAED,IAAI,CAAC;QACH,OAAO,0BAA0B,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;IACnD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAA;IAClB,CAAC;AACH,CAAC"}
@@ -1,67 +1,49 @@
1
- "use strict";
2
-
3
- var _Object$defineProperty = require("@babel/runtime-corejs3/core-js/object/define-property");
4
- var _interopRequireWildcard = require("@babel/runtime-corejs3/helpers/interopRequireWildcard").default;
5
- var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
6
- _Object$defineProperty(exports, "__esModule", {
7
- value: true
8
- });
9
- exports.process_env_findAll = process_env_findAll;
10
- exports.process_env_findInFile = process_env_findInFile;
11
- exports.process_env_findInFile2 = process_env_findInFile2;
12
- require("core-js/modules/es.array.push.js");
13
- var _flatMap = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/flat-map"));
14
- var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/includes"));
15
- var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/filter"));
16
- var _nodeFs = _interopRequireDefault(require("node:fs"));
17
- var _nodePath = _interopRequireDefault(require("node:path"));
18
- var tsm = _interopRequireWildcard(require("ts-morph"));
19
- var _path = require("../../x/path");
20
- var _tsMorph2 = require("../../x/ts-morph");
21
- function process_env_findAll(dir) {
22
- var _context;
23
- const globPath = _nodePath.default.join(dir, 'src/**/*.{js,ts,jsx,tsx}');
24
- return (0, _flatMap.default)(_context = (0, _path.globSync)(globPath)).call(_context, file => process_env_findInFile(file, _nodeFs.default.readFileSync(file).toString()));
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ import * as tsm from 'ts-morph';
4
+ import { globSync } from '../../x/path.js';
5
+ import { createTSMSourceFile_cached } from '../../x/ts-morph.js';
6
+ export function process_env_findAll(dir) {
7
+ const globPath = path.join(dir, 'src/**/*.{js,ts,jsx,tsx}');
8
+ return globSync(globPath).flatMap((file) => process_env_findInFile(file, fs.readFileSync(file).toString()));
25
9
  }
26
- function process_env_findInFile(filePath, text) {
27
- if (!(0, _includes.default)(text).call(text, 'process.env')) {
28
- return [];
29
- }
30
- try {
31
- return process_env_findInFile2((0, _tsMorph2.createTSMSourceFile_cached)(filePath, text));
32
- } catch {
33
- return [];
34
- }
35
- }
36
- function process_env_findInFile2(sf) {
37
- var _context2;
38
- const penvs = (0, _filter.default)(_context2 = sf.getDescendantsOfKind(tsm.SyntaxKind.PropertyAccessExpression)).call(_context2, is_process_env);
39
- const results = [];
40
- for (const penv of penvs) {
41
- const node = penv.getParent();
42
- if (!node) {
43
- continue;
10
+ export function process_env_findInFile(filePath, text) {
11
+ if (!text.includes('process.env')) {
12
+ return [];
13
+ }
14
+ try {
15
+ return process_env_findInFile2(createTSMSourceFile_cached(filePath, text));
16
+ }
17
+ catch {
18
+ return [];
44
19
  }
45
- if (tsm.Node.isPropertyAccessExpression(node)) {
46
- results.push({
47
- key: node.getName(),
48
- node
49
- });
50
- } else if (tsm.Node.isElementAccessExpression(node)) {
51
- const arg = node.getArgumentExpression();
52
- if (arg && tsm.Node.isStringLiteral(arg)) {
53
- results.push({
54
- key: arg.getLiteralText(),
55
- node
56
- });
57
- }
20
+ }
21
+ export function process_env_findInFile2(sf) {
22
+ const penvs = sf
23
+ .getDescendantsOfKind(tsm.SyntaxKind.PropertyAccessExpression)
24
+ .filter(is_process_env);
25
+ const results = [];
26
+ for (const penv of penvs) {
27
+ const node = penv.getParent();
28
+ if (!node) {
29
+ continue;
30
+ }
31
+ if (tsm.Node.isPropertyAccessExpression(node)) {
32
+ results.push({ key: node.getName(), node });
33
+ }
34
+ else if (tsm.Node.isElementAccessExpression(node)) {
35
+ const arg = node.getArgumentExpression();
36
+ if (arg && tsm.Node.isStringLiteral(arg)) {
37
+ results.push({ key: arg.getLiteralText(), node });
38
+ }
39
+ }
58
40
  }
59
- }
60
- return results;
41
+ return results;
61
42
  }
62
43
  function is_process_env(n) {
63
- if (!tsm.Node.isPropertyAccessExpression(n)) {
64
- return false;
65
- }
66
- return n.getExpression().getText() === 'process' && n.getName() === 'env';
67
- }
44
+ if (!tsm.Node.isPropertyAccessExpression(n)) {
45
+ return false;
46
+ }
47
+ return n.getExpression().getText() === 'process' && n.getName() === 'env';
48
+ }
49
+ //# sourceMappingURL=process_env.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process_env.js","sourceRoot":"","sources":["../../../src/model/util/process_env.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,IAAI,MAAM,WAAW,CAAA;AAE5B,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAE/B,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC1C,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAA;AAEhE,MAAM,UAAU,mBAAmB,CAAC,GAAW;IAC7C,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,0BAA0B,CAAC,CAAA;IAC3D,OAAO,QAAQ,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CACzC,sBAAsB,CAAC,IAAI,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,CAC/D,CAAA;AACH,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,QAAgB,EAChB,IAAY;IAEZ,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC;QAClC,OAAO,EAAE,CAAA;IACX,CAAC;IACD,IAAI,CAAC;QACH,OAAO,uBAAuB,CAAC,0BAA0B,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAA;IAC5E,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAA;IACX,CAAC;AACH,CAAC;AAED,MAAM,UAAU,uBAAuB,CACrC,EAAkB;IAElB,MAAM,KAAK,GAAG,EAA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ike } from './x/Array';
3
- import type { ExtendedDiagnostic } from './x/diagnostics';
2
+ import type { ArrayLike } from './x/Array.js';
3
+ import type { ExtendedDiagnostic } from './x/diagnostics.js';
4
4
  export type NodeID = string;
5
5
  export declare abstract class BaseNode {
6
6
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"nodes.d.ts","sourceRoot":"","sources":["../src/nodes.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,GAAG,MAAM,UAAU,CAAA;AAGpC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAE1C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAMzD,MAAM,MAAM,MAAM,GAAG,MAAM,CAAA;AAE3B,8BAAsB,QAAQ;IAC5B;;;;;;;;OAQG;IACH,QAAQ,KAAK,EAAE,IAAI,MAAM,CAAA;IACzB,QAAQ,KAAK,MAAM,IAAI,QAAQ,GAAG,SAAS,CAAA;IAE3C,MAAM,UAAO;IACb;;;OAGG;IACH,QAAQ,IAAI,SAAS,CAAC,QAAQ,CAAC;IAGvB,OAAO,CAAC,SAAS;IAIzB;;;OAGG;IACH,WAAW,IAAI,SAAS,CAAC,kBAAkB,CAAC;IAGpC,OAAO,CAAC,YAAY;IAI5B;;;OAGG;IAEG,kBAAkB,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAgCrE,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAUzC,IAAY,oBAAoB,IAAI,MAAM,GAAG,SAAS,CASrD;IAED;;;;;;OAMG;IAEG,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC;CAgB1D;AAED,8BAAsB,QAAS,SAAQ,QAAQ;IAC7C,QAAQ,KAAK,QAAQ,IAAI,MAAM,CAAA;IAC/B,IAAY,GAAG,IAAI,MAAM,CAExB;IACD;;OAEG;IACH,IAAY,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