@cedarjs/structure 2.2.2-next.0 → 2.2.2-next.31

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 (126) hide show
  1. package/README.md +8 -24
  2. package/dist/index.d.ts +3 -5
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +8 -23
  5. package/dist/model/RWCell.d.ts +4 -3
  6. package/dist/model/RWCell.d.ts.map +1 -1
  7. package/dist/model/RWCell.js +7 -8
  8. package/dist/model/RWComponent.d.ts +1 -1
  9. package/dist/model/RWComponent.d.ts.map +1 -1
  10. package/dist/model/RWComponent.js +2 -2
  11. package/dist/model/RWEnvHelper.d.ts +3 -7
  12. package/dist/model/RWEnvHelper.d.ts.map +1 -1
  13. package/dist/model/RWEnvHelper.js +33 -114
  14. package/dist/model/RWFunction.d.ts +1 -1
  15. package/dist/model/RWFunction.d.ts.map +1 -1
  16. package/dist/model/RWFunction.js +2 -2
  17. package/dist/model/RWLayout.d.ts +1 -1
  18. package/dist/model/RWLayout.d.ts.map +1 -1
  19. package/dist/model/RWLayout.js +2 -2
  20. package/dist/model/RWPage.d.ts +1 -1
  21. package/dist/model/RWPage.d.ts.map +1 -1
  22. package/dist/model/RWPage.js +2 -2
  23. package/dist/model/RWProject.d.ts +1 -4
  24. package/dist/model/RWProject.d.ts.map +1 -1
  25. package/dist/model/RWProject.js +17 -19
  26. package/dist/model/RWRoute.d.ts +3 -16
  27. package/dist/model/RWRoute.d.ts.map +1 -1
  28. package/dist/model/RWRoute.js +11 -137
  29. package/dist/model/RWRouter.d.ts +2 -6
  30. package/dist/model/RWRouter.d.ts.map +1 -1
  31. package/dist/model/RWRouter.js +10 -62
  32. package/dist/model/RWSDL.d.ts +2 -2
  33. package/dist/model/RWSDL.d.ts.map +1 -1
  34. package/dist/model/RWSDL.js +4 -4
  35. package/dist/model/RWSDLField.d.ts +3 -7
  36. package/dist/model/RWSDLField.d.ts.map +1 -1
  37. package/dist/model/RWSDLField.js +10 -59
  38. package/dist/model/RWService.d.ts +1 -1
  39. package/dist/model/RWService.d.ts.map +1 -1
  40. package/dist/model/RWService.js +2 -2
  41. package/dist/model/RWServiceFunction.d.ts +2 -2
  42. package/dist/model/RWServiceFunction.d.ts.map +1 -1
  43. package/dist/model/RWServiceFunction.js +5 -6
  44. package/dist/model/RWTOML.d.ts +2 -2
  45. package/dist/model/RWTOML.d.ts.map +1 -1
  46. package/dist/model/RWTOML.js +6 -6
  47. package/dist/model/util/process_env.d.ts +9 -18
  48. package/dist/model/util/process_env.d.ts.map +1 -1
  49. package/dist/model/util/process_env.js +25 -34
  50. package/dist/nodes.d.ts +62 -0
  51. package/dist/nodes.d.ts.map +1 -0
  52. package/dist/nodes.js +175 -0
  53. package/dist/x/Location.d.ts +9 -0
  54. package/dist/x/Location.d.ts.map +1 -0
  55. package/dist/x/Location.js +18 -0
  56. package/dist/x/Position.d.ts +12 -0
  57. package/dist/x/Position.d.ts.map +1 -0
  58. package/dist/x/Position.js +35 -0
  59. package/dist/x/Range.d.ts +8 -0
  60. package/dist/x/Range.d.ts.map +1 -0
  61. package/dist/x/Range.js +22 -0
  62. package/dist/x/{vscode-languageserver-types.d.ts → diagnostics.d.ts} +27 -36
  63. package/dist/x/diagnostics.d.ts.map +1 -0
  64. package/dist/x/{vscode-languageserver-types.js → diagnostics.js} +30 -135
  65. package/dist/x/path.d.ts +1 -0
  66. package/dist/x/path.d.ts.map +1 -1
  67. package/dist/x/path.js +25 -17
  68. package/dist/x/prisma.d.ts +2 -3
  69. package/dist/x/prisma.d.ts.map +1 -1
  70. package/dist/x/prisma.js +5 -5
  71. package/package.json +3 -8
  72. package/dist/hosts.d.ts +0 -23
  73. package/dist/hosts.d.ts.map +0 -1
  74. package/dist/hosts.js +0 -44
  75. package/dist/ide.d.ts +0 -122
  76. package/dist/ide.d.ts.map +0 -1
  77. package/dist/ide.js +0 -240
  78. package/dist/interactive_cli/RedwoodCommandString.d.ts +0 -20
  79. package/dist/interactive_cli/RedwoodCommandString.d.ts.map +0 -1
  80. package/dist/interactive_cli/RedwoodCommandString.js +0 -72
  81. package/dist/interactive_cli/command_builder.d.ts +0 -10
  82. package/dist/interactive_cli/command_builder.d.ts.map +0 -1
  83. package/dist/interactive_cli/command_builder.js +0 -196
  84. package/dist/interactive_cli/dry_run.d.ts +0 -28
  85. package/dist/interactive_cli/dry_run.d.ts.map +0 -1
  86. package/dist/interactive_cli/dry_run.js +0 -104
  87. package/dist/interactive_cli/ui.d.ts +0 -32
  88. package/dist/interactive_cli/ui.d.ts.map +0 -1
  89. package/dist/interactive_cli/ui.js +0 -84
  90. package/dist/language_server/RWLanguageServer.d.ts +0 -30
  91. package/dist/language_server/RWLanguageServer.d.ts.map +0 -1
  92. package/dist/language_server/RWLanguageServer.js +0 -201
  93. package/dist/language_server/commands.d.ts +0 -14
  94. package/dist/language_server/commands.d.ts.map +0 -1
  95. package/dist/language_server/commands.js +0 -122
  96. package/dist/language_server/diagnostics.d.ts +0 -10
  97. package/dist/language_server/diagnostics.d.ts.map +0 -1
  98. package/dist/language_server/diagnostics.js +0 -61
  99. package/dist/language_server/outline.d.ts +0 -7
  100. package/dist/language_server/outline.d.ts.map +0 -1
  101. package/dist/language_server/outline.js +0 -37
  102. package/dist/language_server/start.d.ts +0 -2
  103. package/dist/language_server/start.d.ts.map +0 -1
  104. package/dist/language_server/start.js +0 -4
  105. package/dist/language_server/xmethods.d.ts +0 -11
  106. package/dist/language_server/xmethods.d.ts.map +0 -1
  107. package/dist/language_server/xmethods.js +0 -42
  108. package/dist/model/util/advanced_path_parser.d.ts +0 -12
  109. package/dist/model/util/advanced_path_parser.d.ts.map +0 -1
  110. package/dist/model/util/advanced_path_parser.js +0 -38
  111. package/dist/outline/index.d.ts +0 -3
  112. package/dist/outline/index.d.ts.map +0 -1
  113. package/dist/outline/index.js +0 -31
  114. package/dist/outline/outline.d.ts +0 -4
  115. package/dist/outline/outline.d.ts.map +0 -1
  116. package/dist/outline/outline.js +0 -262
  117. package/dist/outline/types.d.ts +0 -87
  118. package/dist/outline/types.d.ts.map +0 -1
  119. package/dist/outline/types.js +0 -72
  120. package/dist/x/vscode-languageserver-types.d.ts.map +0 -1
  121. package/dist/x/vscode-languageserver.d.ts +0 -12
  122. package/dist/x/vscode-languageserver.d.ts.map +0 -1
  123. package/dist/x/vscode-languageserver.js +0 -61
  124. package/dist/x/vscode.d.ts +0 -126
  125. package/dist/x/vscode.d.ts.map +0 -1
  126. package/dist/x/vscode.js +0 -294
@@ -10,14 +10,12 @@ var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instan
10
10
  var _find = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/find"));
11
11
  var _getOwnPropertyDescriptor = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/object/get-own-property-descriptor"));
12
12
  var _applyDecoratedDescriptor2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/applyDecoratedDescriptor"));
13
- var _vscodeLanguageserverTypes = require("vscode-languageserver-types");
14
13
  var _errors = require("../errors");
15
- var _ide = require("../ide");
14
+ var _nodes = require("../nodes");
16
15
  var _decorators = require("../x/decorators");
17
- var _URL = require("../x/URL");
18
- var _vscodeLanguageserverTypes2 = require("../x/vscode-languageserver-types");
19
- var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _class;
20
- let RWSDLField = exports.RWSDLField = (_dec = (0, _decorators.lazy)(), _dec2 = (0, _decorators.lazy)(), _dec3 = (0, _decorators.lazy)(), _dec4 = (0, _decorators.lazy)(), _dec5 = (0, _decorators.lazy)(), _dec6 = (0, _decorators.lazy)(), _dec7 = (0, _decorators.lazy)(), _class = class RWSDLField extends _ide.BaseNode {
16
+ var _diagnostics = require("../x/diagnostics");
17
+ var _dec, _dec2, _dec3, _dec4, _dec5, _class;
18
+ let RWSDLField = exports.RWSDLField = (_dec = (0, _decorators.lazy)(), _dec2 = (0, _decorators.lazy)(), _dec3 = (0, _decorators.lazy)(), _dec4 = (0, _decorators.lazy)(), _dec5 = (0, _decorators.lazy)(), _class = class RWSDLField extends _nodes.BaseNode {
21
19
  constructor(objectTypeDef, field, parent) {
22
20
  super();
23
21
  this.objectTypeDef = objectTypeDef;
@@ -39,8 +37,8 @@ let RWSDLField = exports.RWSDLField = (_dec = (0, _decorators.lazy)(), _dec2 = (
39
37
  const node = this.parent.schemaStringNode;
40
38
  start += node.getPos() + 1; // we add one to account for the quote (`)
41
39
  end += node.getPos() + 1;
42
- const startPos = (0, _vscodeLanguageserverTypes2.Position_fromTSMorphOffset)(start, node.getSourceFile());
43
- const endPos = (0, _vscodeLanguageserverTypes2.Position_fromTSMorphOffset)(end, node.getSourceFile());
40
+ const startPos = (0, _diagnostics.Position_fromTSMorphOffset)(start, node.getSourceFile());
41
+ const endPos = (0, _diagnostics.Position_fromTSMorphOffset)(end, node.getSourceFile());
44
42
  return {
45
43
  uri: this.parent.uri,
46
44
  range: {
@@ -56,15 +54,7 @@ let RWSDLField = exports.RWSDLField = (_dec = (0, _decorators.lazy)(), _dec2 = (
56
54
  var _context;
57
55
  return (0, _map.default)(_context = this.field.arguments ?? []).call(_context, a => a.name.value);
58
56
  }
59
- *ideInfo() {
60
- if (this.impl) {
61
- yield {
62
- kind: 'Implementation',
63
- location: this.location,
64
- target: (0, _vscodeLanguageserverTypes2.Location_fromNode)(this.impl.node)
65
- };
66
- }
67
- }
57
+
68
58
  /**
69
59
  * TODO: describe in prose what is going on here.
70
60
  * this is an important rule
@@ -73,44 +63,6 @@ let RWSDLField = exports.RWSDLField = (_dec = (0, _decorators.lazy)(), _dec2 = (
73
63
  var _context2;
74
64
  return (0, _find.default)(_context2 = this.parent.service?.funcs ?? []).call(_context2, f => f.name === this.name);
75
65
  }
76
- // TODO: improve snippet
77
- get defaultImplSnippet() {
78
- const args = this.field.arguments ?? [];
79
- const params = (0, _map.default)(args).call(args, a => a.name.value).join(',');
80
- return `
81
- export const ${this.field.name.value} = ({${params}}) => {
82
- // TODO: implement
83
- }`;
84
- }
85
- get quickFix_addImplementation() {
86
- const {
87
- service
88
- } = this.parent;
89
- const change = new _vscodeLanguageserverTypes.WorkspaceChange({
90
- documentChanges: []
91
- });
92
- let insertPosition = _vscodeLanguageserverTypes.Position.create(0, 0);
93
- let uri = (0, _URL.URL_file)(this.parent.serviceFilePath);
94
- if (service) {
95
- // we'll insert into the end of an existing file
96
- const lastLine = service.sf.getEndLineNumber();
97
- insertPosition = _vscodeLanguageserverTypes.Position.create(lastLine, 0);
98
- uri = service.uri;
99
- } else {
100
- // file doesn't exist
101
- // create the service file before inserting
102
- change.createFile(uri);
103
- }
104
- // insert
105
- change.getTextEditChange({
106
- uri,
107
- version: null
108
- }).insert(insertPosition, this.defaultImplSnippet);
109
- return {
110
- title: 'Add implementation',
111
- edit: change.edit
112
- };
113
- }
114
66
  *diagnostics() {
115
67
  if (!this.impl) {
116
68
  const {
@@ -122,11 +74,10 @@ export const ${this.field.name.value} = ({${params}}) => {
122
74
  diagnostic: {
123
75
  range,
124
76
  message: 'Service Not Implemented',
125
- severity: _vscodeLanguageserverTypes.DiagnosticSeverity.Error,
77
+ severity: _diagnostics.DiagnosticSeverity.Error,
126
78
  code: _errors.RWError.SERVICE_NOT_IMPLEMENTED
127
- },
128
- quickFix: async () => this.quickFix_addImplementation
79
+ }
129
80
  };
130
81
  }
131
82
  }
132
- }, (0, _applyDecoratedDescriptor2.default)(_class.prototype, "id", [_dec], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "id"), _class.prototype), (0, _applyDecoratedDescriptor2.default)(_class.prototype, "location", [_dec2], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "location"), _class.prototype), (0, _applyDecoratedDescriptor2.default)(_class.prototype, "name", [_dec3], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "name"), _class.prototype), (0, _applyDecoratedDescriptor2.default)(_class.prototype, "argumentNames", [_dec4], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "argumentNames"), _class.prototype), (0, _applyDecoratedDescriptor2.default)(_class.prototype, "impl", [_dec5], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "impl"), _class.prototype), (0, _applyDecoratedDescriptor2.default)(_class.prototype, "defaultImplSnippet", [_dec6], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "defaultImplSnippet"), _class.prototype), (0, _applyDecoratedDescriptor2.default)(_class.prototype, "quickFix_addImplementation", [_dec7], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "quickFix_addImplementation"), _class.prototype), _class);
83
+ }, (0, _applyDecoratedDescriptor2.default)(_class.prototype, "id", [_dec], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "id"), _class.prototype), (0, _applyDecoratedDescriptor2.default)(_class.prototype, "location", [_dec2], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "location"), _class.prototype), (0, _applyDecoratedDescriptor2.default)(_class.prototype, "name", [_dec3], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "name"), _class.prototype), (0, _applyDecoratedDescriptor2.default)(_class.prototype, "argumentNames", [_dec4], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "argumentNames"), _class.prototype), (0, _applyDecoratedDescriptor2.default)(_class.prototype, "impl", [_dec5], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "impl"), _class.prototype), _class);
@@ -1,4 +1,4 @@
1
- import { FileNode } from '../ide';
1
+ import { FileNode } from '../nodes';
2
2
  import type { RWProject } from './RWProject';
3
3
  import type { RWSDL } from './RWSDL';
4
4
  import { RWServiceFunction } from './RWServiceFunction';
@@ -1 +1 @@
1
- {"version":3,"file":"RWService.d.ts","sourceRoot":"","sources":["../../src/model/RWService.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAKjC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAEvD,qBAAa,SAAU,SAAQ,QAAQ;IAE5B,QAAQ,EAAE,MAAM;IAChB,MAAM,EAAE,SAAS;gBADjB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,SAAS;IAI1B;;;OAGG;IACH,IAAY,IAAI,WAEf;IAED;;;OAGG;IAEH,IAAY,GAAG,IAAI,KAAK,GAAG,SAAS,CAEnC;IAED,QAAQ;IAIR;;;OAGG;IAEH,IAAY,KAAK,wBAuBhB;CACF"}
1
+ {"version":3,"file":"RWService.d.ts","sourceRoot":"","sources":["../../src/model/RWService.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAKnC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAEvD,qBAAa,SAAU,SAAQ,QAAQ;IAE5B,QAAQ,EAAE,MAAM;IAChB,MAAM,EAAE,SAAS;gBADjB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,SAAS;IAI1B;;;OAGG;IACH,IAAY,IAAI,WAEf;IAED;;;OAGG;IAEH,IAAY,GAAG,IAAI,KAAK,GAAG,SAAS,CAEnC;IAED,QAAQ;IAIR;;;OAGG;IAEH,IAAY,KAAK,wBAuBhB;CACF"}
@@ -11,13 +11,13 @@ var _find = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/insta
11
11
  var _getOwnPropertyDescriptor = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/object/get-own-property-descriptor"));
12
12
  var _applyDecoratedDescriptor2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/applyDecoratedDescriptor"));
13
13
  var tsm = _interopRequireWildcard(require("ts-morph"));
14
- var _ide = require("../ide");
14
+ var _nodes = require("../nodes");
15
15
  var _Array = require("../x/Array");
16
16
  var _decorators = require("../x/decorators");
17
17
  var _path = require("../x/path");
18
18
  var _RWServiceFunction = require("./RWServiceFunction");
19
19
  var _dec, _dec2, _dec3, _class;
20
- let RWService = exports.RWService = (_dec = (0, _decorators.lazy)(), _dec2 = (0, _decorators.lazy)(), _dec3 = (0, _decorators.lazy)(), _class = class RWService extends _ide.FileNode {
20
+ let RWService = exports.RWService = (_dec = (0, _decorators.lazy)(), _dec2 = (0, _decorators.lazy)(), _dec3 = (0, _decorators.lazy)(), _class = class RWService extends _nodes.FileNode {
21
21
  constructor(filePath, parent) {
22
22
  super();
23
23
  this.filePath = filePath;
@@ -1,6 +1,6 @@
1
1
  import * as tsm from 'ts-morph';
2
- import { BaseNode } from '../ide';
3
- import type { ExtendedDiagnostic } from '../x/vscode-languageserver-types';
2
+ import { BaseNode } from '../nodes';
3
+ import type { ExtendedDiagnostic } from '../x/diagnostics';
4
4
  import type { RWSDLField } from './RWSDLField';
5
5
  import type { RWService } from './RWService';
6
6
  export declare class RWServiceFunction extends BaseNode {
@@ -1 +1 @@
1
- {"version":3,"file":"RWServiceFunction.d.ts","sourceRoot":"","sources":["../../src/model/RWServiceFunction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAG/B,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAGjC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAA;AAG1E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAE5C,qBAAa,iBAAkB,SAAQ,QAAQ;IAEpC,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,GAAG,CAAC,mBAAmB,GAAG,GAAG,CAAC,aAAa;IACjD,MAAM,EAAE,SAAS;gBAFjB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,GAAG,CAAC,mBAAmB,GAAG,GAAG,CAAC,aAAa,EACjD,MAAM,EAAE,SAAS;IAK1B,IAAY,EAAE,WAGb;IAED;;;OAGG;IAEH,IAAY,QAAQ,IAAI,UAAU,GAAG,SAAS,CAI7C;IAED,IAAY,cAAc,aAczB;IAEA,WAAW;CAwCb"}
1
+ {"version":3,"file":"RWServiceFunction.d.ts","sourceRoot":"","sources":["../../src/model/RWServiceFunction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAE/B,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAGnC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAI1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAE5C,qBAAa,iBAAkB,SAAQ,QAAQ;IAEpC,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,GAAG,CAAC,mBAAmB,GAAG,GAAG,CAAC,aAAa;IACjD,MAAM,EAAE,SAAS;gBAFjB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,GAAG,CAAC,mBAAmB,GAAG,GAAG,CAAC,aAAa,EACjD,MAAM,EAAE,SAAS;IAK1B,IAAY,EAAE,WAGb;IAED;;;OAGG;IAEH,IAAY,QAAQ,IAAI,UAAU,GAAG,SAAS,CAI7C;IAED,IAAY,cAAc,aAczB;IAEA,WAAW;CAwCb"}
@@ -13,13 +13,12 @@ var _sort = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/insta
13
13
  var _getOwnPropertyDescriptor = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/object/get-own-property-descriptor"));
14
14
  var _applyDecoratedDescriptor2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/applyDecoratedDescriptor"));
15
15
  var tsm = _interopRequireWildcard(require("ts-morph"));
16
- var _vscodeLanguageserverTypes = require("vscode-languageserver-types");
17
- var _ide = require("../ide");
16
+ var _nodes = require("../nodes");
18
17
  var _Array = require("../x/Array");
19
18
  var _decorators = require("../x/decorators");
20
- var _vscodeLanguageserverTypes2 = require("../x/vscode-languageserver-types");
19
+ var _diagnostics = require("../x/diagnostics");
21
20
  var _dec, _dec2, _dec3, _class;
22
- let RWServiceFunction = exports.RWServiceFunction = (_dec = (0, _decorators.lazy)(), _dec2 = (0, _decorators.lazy)(), _dec3 = (0, _decorators.lazy)(), _class = class RWServiceFunction extends _ide.BaseNode {
21
+ let RWServiceFunction = exports.RWServiceFunction = (_dec = (0, _decorators.lazy)(), _dec2 = (0, _decorators.lazy)(), _dec3 = (0, _decorators.lazy)(), _class = class RWServiceFunction extends _nodes.BaseNode {
23
22
  constructor(name, node, parent) {
24
23
  super();
25
24
  this.name = name;
@@ -67,14 +66,14 @@ let RWServiceFunction = exports.RWServiceFunction = (_dec = (0, _decorators.lazy
67
66
  const {
68
67
  uri,
69
68
  range
70
- } = (0, _vscodeLanguageserverTypes2.Location_fromNode)(locationNode);
69
+ } = (0, _diagnostics.Location_fromNode)(locationNode);
71
70
  const message = `Parameter mismatch between SDL and implementation ("${p1}" !== "${p2}")`;
72
71
  const diagnostic = {
73
72
  uri,
74
73
  diagnostic: {
75
74
  range,
76
75
  message,
77
- severity: _vscodeLanguageserverTypes.DiagnosticSeverity.Error,
76
+ severity: _diagnostics.DiagnosticSeverity.Error,
78
77
  // add related information so developers can jump to the SDL definition
79
78
  relatedInformation: [{
80
79
  location: this.sdlField.location,
@@ -1,5 +1,5 @@
1
1
  import * as toml from 'smol-toml';
2
- import { FileNode } from '../ide';
2
+ import { FileNode } from '../nodes';
3
3
  import type { RWProject } from './RWProject';
4
4
  export declare class RWTOML extends FileNode {
5
5
  filePath: string;
@@ -7,6 +7,6 @@ export declare class RWTOML extends FileNode {
7
7
  constructor(filePath: string, parent: RWProject);
8
8
  get parsedTOML(): toml.TomlTable;
9
9
  get web_includeEnvironmentVariables(): string[] | undefined;
10
- diagnostics(): Generator<import("../x/vscode-languageserver-types").ExtendedDiagnostic, void, unknown>;
10
+ diagnostics(): Generator<import("../x/diagnostics").ExtendedDiagnostic, void, unknown>;
11
11
  }
12
12
  //# sourceMappingURL=RWTOML.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RWTOML.d.ts","sourceRoot":"","sources":["../../src/model/RWTOML.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AAGjC,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAIjC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAE5C,qBAAa,MAAO,SAAQ,QAAQ;IAEzB,QAAQ,EAAE,MAAM;IAChB,MAAM,EAAE,SAAS;gBADjB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,SAAS;IAQ1B,IAAY,UAAU,mBAErB;IACD,IAAY,+BAA+B,IAAI,MAAM,EAAE,GAAG,SAAS,CAElE;IACA,WAAW;CAgBb"}
1
+ {"version":3,"file":"RWTOML.d.ts","sourceRoot":"","sources":["../../src/model/RWTOML.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AAEjC,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAKnC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAE5C,qBAAa,MAAO,SAAQ,QAAQ;IAEzB,QAAQ,EAAE,MAAM;IAChB,MAAM,EAAE,SAAS;gBADjB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,SAAS;IAQ1B,IAAY,UAAU,mBAErB;IACD,IAAY,+BAA+B,IAAI,MAAM,EAAE,GAAG,SAAS,CAElE;IACA,WAAW;CAgBb"}
@@ -10,12 +10,12 @@ exports.RWTOML = void 0;
10
10
  var _getOwnPropertyDescriptor = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/object/get-own-property-descriptor"));
11
11
  var _applyDecoratedDescriptor2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/applyDecoratedDescriptor"));
12
12
  var toml = _interopRequireWildcard(require("smol-toml"));
13
- var _vscodeLanguageserverTypes = require("vscode-languageserver-types");
14
- var _ide = require("../ide");
13
+ var _nodes = require("../nodes");
15
14
  var _decorators = require("../x/decorators");
16
- var _vscodeLanguageserverTypes2 = require("../x/vscode-languageserver-types");
15
+ var _diagnostics = require("../x/diagnostics");
16
+ var _Range = require("../x/Range");
17
17
  var _dec, _dec2, _class;
18
- let RWTOML = exports.RWTOML = (_dec = (0, _decorators.lazy)(), _dec2 = (0, _decorators.lazy)(), _class = class RWTOML extends _ide.FileNode {
18
+ let RWTOML = exports.RWTOML = (_dec = (0, _decorators.lazy)(), _dec2 = (0, _decorators.lazy)(), _class = class RWTOML extends _nodes.FileNode {
19
19
  constructor(filePath, parent) {
20
20
  super();
21
21
  this.filePath = filePath;
@@ -40,9 +40,9 @@ let RWTOML = exports.RWTOML = (_dec = (0, _decorators.lazy)(), _dec2 = (0, _deco
40
40
  line: e.line - 1,
41
41
  character: e.column - 1
42
42
  };
43
- const range = _vscodeLanguageserverTypes.Range.create(pos, pos);
43
+ const range = (0, _Range.Range_create)(pos, pos);
44
44
  // Forward the TOML parse error with correct location information
45
- yield (0, _vscodeLanguageserverTypes2.err)({
45
+ yield (0, _diagnostics.err)({
46
46
  uri: this.uri,
47
47
  range
48
48
  }, 'TOML Parser Error: ' + e.message);
@@ -1,23 +1,14 @@
1
1
  import * as tsm from 'ts-morph';
2
- export declare function process_env_findAll(dir: string): ({
2
+ export declare function process_env_findAll(dir: string): {
3
3
  key: string;
4
- node: tsm.PropertyAccessExpression<tsm.ts.PropertyAccessExpression>;
5
- } | {
4
+ node: tsm.Node;
5
+ }[];
6
+ export declare function process_env_findInFile(filePath: string, text: string): {
6
7
  key: string;
7
- node: tsm.ElementAccessExpression<tsm.ts.ElementAccessExpression>;
8
- })[];
9
- export declare function process_env_findInFile(filePath: string, text: string): ({
8
+ node: tsm.Node;
9
+ }[];
10
+ export declare function process_env_findInFile2(sf: tsm.SourceFile): {
10
11
  key: string;
11
- node: tsm.PropertyAccessExpression<tsm.ts.PropertyAccessExpression>;
12
- } | {
13
- key: string;
14
- node: tsm.ElementAccessExpression<tsm.ts.ElementAccessExpression>;
15
- })[];
16
- export declare function process_env_findInFile2(sf: tsm.SourceFile): ({
17
- key: string;
18
- node: tsm.PropertyAccessExpression<tsm.ts.PropertyAccessExpression>;
19
- } | {
20
- key: string;
21
- node: tsm.ElementAccessExpression<tsm.ts.ElementAccessExpression>;
22
- })[];
12
+ node: tsm.Node;
13
+ }[];
23
14
  //# sourceMappingURL=process_env.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"process_env.d.ts","sourceRoot":"","sources":["../../../src/model/util/process_env.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAK/B,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM;;;;;;KAU9C;AAED,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;;;;;;KASpE;AAED,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,GAAG,CAAC,UAAU;;;;;;KAwBzD"}
1
+ {"version":3,"file":"process_env.d.ts","sourceRoot":"","sources":["../../../src/model/util/process_env.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAK/B,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM;SAUrC,MAAM;UAAQ,GAAG,CAAC,IAAI;IAL/B;AAED,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,GACX;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,GAAG,CAAC,IAAI,CAAA;CAAE,EAAE,CASnC;AAED,wBAAgB,uBAAuB,CACrC,EAAE,EAAE,GAAG,CAAC,UAAU,GACjB;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,GAAG,CAAC,IAAI,CAAA;CAAE,EAAE,CAuBnC"}
@@ -9,24 +9,19 @@ _Object$defineProperty(exports, "__esModule", {
9
9
  exports.process_env_findAll = process_env_findAll;
10
10
  exports.process_env_findInFile = process_env_findInFile;
11
11
  exports.process_env_findInFile2 = process_env_findInFile2;
12
- var _replaceAll = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/replace-all"));
12
+ require("core-js/modules/es.array.push.js");
13
+ var _flatMap = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/flat-map"));
13
14
  var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/includes"));
14
15
  var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/filter"));
15
16
  var _nodeFs = _interopRequireDefault(require("node:fs"));
16
- var _path = _interopRequireDefault(require("path"));
17
- var _fastGlob = _interopRequireDefault(require("fast-glob"));
17
+ var _nodePath = _interopRequireDefault(require("node:path"));
18
18
  var tsm = _interopRequireWildcard(require("ts-morph"));
19
- var _Array = require("../../x/Array");
19
+ var _path = require("../../x/path");
20
20
  var _tsMorph2 = require("../../x/ts-morph");
21
21
  function process_env_findAll(dir) {
22
- return (0, _Array.iter)(function* () {
23
- var _context;
24
- // globSync only works with / as the path separator, even on Windows
25
- const globPath = (0, _replaceAll.default)(_context = _path.default.join(dir, 'src/**/*.{js,ts,jsx,tsx}')).call(_context, '\\', '/');
26
- for (const file of _fastGlob.default.sync(globPath)) {
27
- yield* process_env_findInFile(file, _nodeFs.default.readFileSync(file).toString());
28
- }
29
- });
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()));
30
25
  }
31
26
  function process_env_findInFile(filePath, text) {
32
27
  if (!(0, _includes.default)(text).call(text, 'process.env')) {
@@ -41,32 +36,28 @@ function process_env_findInFile(filePath, text) {
41
36
  function process_env_findInFile2(sf) {
42
37
  var _context2;
43
38
  const penvs = (0, _filter.default)(_context2 = sf.getDescendantsOfKind(tsm.SyntaxKind.PropertyAccessExpression)).call(_context2, is_process_env);
44
- return (0, _Array.iter)(function* () {
45
- for (const penv of penvs) {
46
- const node = penv.getParent();
47
- if (!node) {
48
- continue;
49
- }
50
- if (tsm.Node.isPropertyAccessExpression(node)) {
51
- yield {
52
- key: node.getName(),
53
- node
54
- };
55
- } else if (tsm.Node.isElementAccessExpression(node)) {
56
- const arg = node.getArgumentExpression();
57
- if (!arg) {
58
- continue;
59
- }
60
- if (!tsm.Node.isStringLiteral(arg)) {
61
- continue;
62
- }
63
- yield {
39
+ const results = [];
40
+ for (const penv of penvs) {
41
+ const node = penv.getParent();
42
+ if (!node) {
43
+ continue;
44
+ }
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({
64
54
  key: arg.getLiteralText(),
65
55
  node
66
- };
56
+ });
67
57
  }
68
58
  }
69
- });
59
+ }
60
+ return results;
70
61
  }
71
62
  function is_process_env(n) {
72
63
  if (!tsm.Node.isPropertyAccessExpression(n)) {
@@ -0,0 +1,62 @@
1
+ import type * as tsm from 'ts-morph';
2
+ import type { ArrayLike } from './x/Array';
3
+ import type { ExtendedDiagnostic } from './x/diagnostics';
4
+ export type NodeID = string;
5
+ export declare abstract class BaseNode {
6
+ /**
7
+ * Each node MUST have a unique ID.
8
+ * IDs have meaningful information.
9
+ *
10
+ * examples:
11
+ * - /path/to/project
12
+ * - /path/to/project/web/src/Routes.js
13
+ * - /path/to/project/web/src/Routes.js /route1
14
+ */
15
+ abstract get id(): NodeID;
16
+ abstract get parent(): BaseNode | undefined;
17
+ exists: boolean;
18
+ /**
19
+ * Returns the children of this node.
20
+ * Override this.
21
+ */
22
+ children(): ArrayLike<BaseNode>;
23
+ private _children;
24
+ /**
25
+ * Diagnostics for this node (must not include children's diagnostics).
26
+ * Override this.
27
+ */
28
+ diagnostics(): ArrayLike<ExtendedDiagnostic>;
29
+ private _diagnostics;
30
+ /**
31
+ * Collects diagnostics for this node and all descendants.
32
+ * This is what you'll use to gather all the project diagnostics.
33
+ */
34
+ collectDiagnostics(uri?: string): Promise<ExtendedDiagnostic[]>;
35
+ bailOutOnCollection(uri: string): boolean;
36
+ get closestContainingUri(): string | undefined;
37
+ /**
38
+ * Finds a node by ID.
39
+ * The default algorithm tries to be economic and only create the necessary
40
+ * intermediate nodes.
41
+ * Subclasses can override this to add further optimizations.
42
+ * @param id
43
+ */
44
+ findNode(id: NodeID): Promise<BaseNode | undefined>;
45
+ }
46
+ export declare abstract class FileNode extends BaseNode {
47
+ abstract get filePath(): string;
48
+ get uri(): string;
49
+ /**
50
+ * the ID of a FileNode is its file:// uri.
51
+ */
52
+ get id(): string;
53
+ get text(): string;
54
+ get fileExists(): boolean;
55
+ /**
56
+ * parsed ts-morph source file
57
+ */
58
+ get sf(): tsm.SourceFile;
59
+ get basenameNoExt(): string;
60
+ get basename(): string;
61
+ }
62
+ //# sourceMappingURL=nodes.d.ts.map
@@ -0,0 +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,EAAE,WAEb;IACD,IAAY,IAAI,WAEf;IACD,IAAY,UAAU,IAAI,OAAO,CAEhC;IACD;;OAEG;IACH,IAAY,EAAE,IAAI,GAAG,CAAC,UAAU,CAK/B;IACD,IAAY,aAAa,WAExB;IACD,IAAY,QAAQ,WAEnB;CACF"}
package/dist/nodes.js ADDED
@@ -0,0 +1,175 @@
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
+ _Object$defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.FileNode = exports.BaseNode = void 0;
9
+ var _stringify = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/json/stringify"));
10
+ var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/promise"));
11
+ var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/map"));
12
+ var _flat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/flat"));
13
+ var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/filter"));
14
+ var _startsWith = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/starts-with"));
15
+ var _getOwnPropertyDescriptor = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/object/get-own-property-descriptor"));
16
+ var _applyDecoratedDescriptor2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/applyDecoratedDescriptor"));
17
+ var _nodeFs = require("node:fs");
18
+ var _nodePath = require("node:path");
19
+ var _Array = require("./x/Array");
20
+ var _decorators = require("./x/decorators");
21
+ var _path = require("./x/path");
22
+ var _Range = require("./x/Range");
23
+ var _tsMorph = require("./x/ts-morph");
24
+ var _URL = require("./x/URL");
25
+ var _dec, _dec2, _dec3, _dec4, _dec5, _class, _dec6, _dec7, _dec8, _dec9, _dec0, _dec1, _dec10, _class2;
26
+ let BaseNode = exports.BaseNode = (_dec = (0, _decorators.memo)(), _dec2 = (0, _decorators.memo)(), _dec3 = (0, _decorators.memo)(_stringify.default), _dec4 = (0, _decorators.lazy)(), _dec5 = (0, _decorators.memo)(), _class = class BaseNode {
27
+ constructor() {
28
+ this.exists = true;
29
+ }
30
+ /**
31
+ * Each node MUST have a unique ID.
32
+ * IDs have meaningful information.
33
+ *
34
+ * examples:
35
+ * - /path/to/project
36
+ * - /path/to/project/web/src/Routes.js
37
+ * - /path/to/project/web/src/Routes.js /route1
38
+ */
39
+ /**
40
+ * Returns the children of this node.
41
+ * Override this.
42
+ */
43
+ children() {
44
+ return [];
45
+ }
46
+ _children() {
47
+ return (0, _Array.ArrayLike_normalize)(this.children());
48
+ }
49
+
50
+ /**
51
+ * Diagnostics for this node (must not include children's diagnostics).
52
+ * Override this.
53
+ */
54
+ diagnostics() {
55
+ return [];
56
+ }
57
+ _diagnostics() {
58
+ return (0, _Array.ArrayLike_normalize)(this.diagnostics());
59
+ }
60
+
61
+ /**
62
+ * Collects diagnostics for this node and all descendants.
63
+ * This is what you'll use to gather all the project diagnostics.
64
+ */
65
+ async collectDiagnostics(uri) {
66
+ // TODO: catch runtime errors and add them as diagnostics
67
+ // TODO: we can parallelize this further
68
+ if (uri && this.bailOutOnCollection(uri)) {
69
+ return [];
70
+ }
71
+ try {
72
+ var _context;
73
+ const d1 = await this._diagnostics();
74
+ const dd = await _promise.default.all((0, _map.default)(_context = await this._children()).call(_context, c => c.collectDiagnostics(uri)));
75
+ const d2 = (0, _flat.default)(dd).call(dd);
76
+ let all = [...d1, ...d2];
77
+ if (uri) {
78
+ all = (0, _filter.default)(all).call(all, x => x.uri === uri);
79
+ }
80
+ return all;
81
+ } catch (e) {
82
+ const uri = this.closestContainingUri;
83
+ if (!uri) {
84
+ throw e;
85
+ }
86
+ const range = (0, _Range.Range_create)(0, 0, 0, 0);
87
+ return [{
88
+ uri,
89
+ diagnostic: {
90
+ message: e + '',
91
+ range
92
+ }
93
+ }];
94
+ }
95
+ }
96
+ bailOutOnCollection(uri) {
97
+ if (this.id === uri) {
98
+ return false;
99
+ }
100
+ if ((0, _startsWith.default)(uri).call(uri, this.id)) {
101
+ return false;
102
+ }
103
+ return true;
104
+ }
105
+ get closestContainingUri() {
106
+ const {
107
+ uri
108
+ } = this;
109
+ if (uri) {
110
+ return uri;
111
+ }
112
+ if (this.parent) {
113
+ return this.parent.closestContainingUri;
114
+ }
115
+ return undefined;
116
+ }
117
+
118
+ /**
119
+ * Finds a node by ID.
120
+ * The default algorithm tries to be economic and only create the necessary
121
+ * intermediate nodes.
122
+ * Subclasses can override this to add further optimizations.
123
+ * @param id
124
+ */
125
+ async findNode(id) {
126
+ id = (0, _URL.URL_file)(id);
127
+ if (this.id === id) {
128
+ return this;
129
+ }
130
+ if ((0, _startsWith.default)(id).call(id, this.id)) {
131
+ for (const c of await this._children()) {
132
+ // depth first search by default
133
+ const cc = await c.findNode(id);
134
+ if (cc) {
135
+ return cc;
136
+ }
137
+ }
138
+ }
139
+ return undefined;
140
+ }
141
+ }, (0, _applyDecoratedDescriptor2.default)(_class.prototype, "_children", [_dec], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "_children"), _class.prototype), (0, _applyDecoratedDescriptor2.default)(_class.prototype, "_diagnostics", [_dec2], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "_diagnostics"), _class.prototype), (0, _applyDecoratedDescriptor2.default)(_class.prototype, "collectDiagnostics", [_dec3], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "collectDiagnostics"), _class.prototype), (0, _applyDecoratedDescriptor2.default)(_class.prototype, "closestContainingUri", [_dec4], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "closestContainingUri"), _class.prototype), (0, _applyDecoratedDescriptor2.default)(_class.prototype, "findNode", [_dec5], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "findNode"), _class.prototype), _class);
142
+ let FileNode = exports.FileNode = (_dec6 = (0, _decorators.lazy)(), _dec7 = (0, _decorators.lazy)(), _dec8 = (0, _decorators.lazy)(), _dec9 = (0, _decorators.lazy)(), _dec0 = (0, _decorators.lazy)(), _dec1 = (0, _decorators.lazy)(), _dec10 = (0, _decorators.lazy)(), _class2 = class FileNode extends BaseNode {
143
+ get uri() {
144
+ return (0, _URL.URL_file)(this.filePath);
145
+ }
146
+ /**
147
+ * the ID of a FileNode is its file:// uri.
148
+ */
149
+ get id() {
150
+ return this.uri;
151
+ }
152
+ get text() {
153
+ return (0, _nodeFs.readFileSync)(this.filePath, {
154
+ encoding: 'utf8'
155
+ }).toString();
156
+ }
157
+ get fileExists() {
158
+ return (0, _nodeFs.existsSync)(this.filePath);
159
+ }
160
+ /**
161
+ * parsed ts-morph source file
162
+ */
163
+ get sf() {
164
+ if (typeof this.text === 'undefined') {
165
+ throw new Error('undefined file ' + this.filePath);
166
+ }
167
+ return (0, _tsMorph.createTSMSourceFile_cached)(this.filePath, this.text);
168
+ }
169
+ get basenameNoExt() {
170
+ return (0, _path.basenameNoExt)(this.filePath);
171
+ }
172
+ get basename() {
173
+ return (0, _nodePath.basename)(this.filePath);
174
+ }
175
+ }, (0, _applyDecoratedDescriptor2.default)(_class2.prototype, "uri", [_dec6], (0, _getOwnPropertyDescriptor.default)(_class2.prototype, "uri"), _class2.prototype), (0, _applyDecoratedDescriptor2.default)(_class2.prototype, "id", [_dec7], (0, _getOwnPropertyDescriptor.default)(_class2.prototype, "id"), _class2.prototype), (0, _applyDecoratedDescriptor2.default)(_class2.prototype, "text", [_dec8], (0, _getOwnPropertyDescriptor.default)(_class2.prototype, "text"), _class2.prototype), (0, _applyDecoratedDescriptor2.default)(_class2.prototype, "fileExists", [_dec9], (0, _getOwnPropertyDescriptor.default)(_class2.prototype, "fileExists"), _class2.prototype), (0, _applyDecoratedDescriptor2.default)(_class2.prototype, "sf", [_dec0], (0, _getOwnPropertyDescriptor.default)(_class2.prototype, "sf"), _class2.prototype), (0, _applyDecoratedDescriptor2.default)(_class2.prototype, "basenameNoExt", [_dec1], (0, _getOwnPropertyDescriptor.default)(_class2.prototype, "basenameNoExt"), _class2.prototype), (0, _applyDecoratedDescriptor2.default)(_class2.prototype, "basename", [_dec10], (0, _getOwnPropertyDescriptor.default)(_class2.prototype, "basename"), _class2.prototype), _class2);
@@ -0,0 +1,9 @@
1
+ import type { Range } from './Range';
2
+ export type DocumentUri = string;
3
+ export interface Location {
4
+ uri: DocumentUri;
5
+ range: Range;
6
+ }
7
+ export declare function Location_create(uri: DocumentUri, range: Range): Location;
8
+ export declare function Location_is(value: any): value is Location;
9
+ //# sourceMappingURL=Location.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Location.d.ts","sourceRoot":"","sources":["../../src/x/Location.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAEpC,MAAM,MAAM,WAAW,GAAG,MAAM,CAAA;AAEhC,MAAM,WAAW,QAAQ;IACvB,GAAG,EAAE,WAAW,CAAA;IAChB,KAAK,EAAE,KAAK,CAAA;CACb;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,GAAG,QAAQ,CAExE;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,QAAQ,CASzD"}
@@ -0,0 +1,18 @@
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
+ exports.Location_create = Location_create;
8
+ exports.Location_is = Location_is;
9
+ function Location_create(uri, range) {
10
+ return {
11
+ uri,
12
+ range
13
+ };
14
+ }
15
+ function Location_is(value) {
16
+ const candidate = value;
17
+ return candidate && typeof candidate.uri === 'string' && typeof candidate.range === 'object' && candidate.range.start !== undefined && candidate.range.end !== undefined;
18
+ }