@cedarjs/structure 2.8.1-next.116 → 2.8.1-rc.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 (110) hide show
  1. package/README.md +1 -1
  2. package/dist/errors.js +15 -9
  3. package/dist/index.d.ts +7 -7
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +67 -40
  6. package/dist/model/RWCell.d.ts +4 -4
  7. package/dist/model/RWCell.d.ts.map +1 -1
  8. package/dist/model/RWCell.js +103 -111
  9. package/dist/model/RWComponent.d.ts +2 -2
  10. package/dist/model/RWComponent.d.ts.map +1 -1
  11. package/dist/model/RWComponent.js +41 -46
  12. package/dist/model/RWEnvHelper.d.ts +4 -4
  13. package/dist/model/RWEnvHelper.d.ts.map +1 -1
  14. package/dist/model/RWEnvHelper.js +205 -212
  15. package/dist/model/RWFunction.d.ts +2 -2
  16. package/dist/model/RWFunction.d.ts.map +1 -1
  17. package/dist/model/RWFunction.js +15 -10
  18. package/dist/model/RWLayout.d.ts +2 -2
  19. package/dist/model/RWLayout.d.ts.map +1 -1
  20. package/dist/model/RWLayout.js +15 -10
  21. package/dist/model/RWPage.d.ts +3 -3
  22. package/dist/model/RWPage.d.ts.map +1 -1
  23. package/dist/model/RWPage.js +57 -61
  24. package/dist/model/RWProject.d.ts +17 -11
  25. package/dist/model/RWProject.d.ts.map +1 -1
  26. package/dist/model/RWProject.js +164 -218
  27. package/dist/model/RWRoute.d.ts +5 -5
  28. package/dist/model/RWRoute.d.ts.map +1 -1
  29. package/dist/model/RWRoute.js +262 -312
  30. package/dist/model/RWRouter.d.ts +4 -4
  31. package/dist/model/RWRouter.d.ts.map +1 -1
  32. package/dist/model/RWRouter.js +126 -130
  33. package/dist/model/RWSDL.d.ts +5 -5
  34. package/dist/model/RWSDL.d.ts.map +1 -1
  35. package/dist/model/RWSDL.js +84 -96
  36. package/dist/model/RWSDLField.d.ts +6 -6
  37. package/dist/model/RWSDLField.d.ts.map +1 -1
  38. package/dist/model/RWSDLField.js +81 -79
  39. package/dist/model/RWService.d.ts +4 -4
  40. package/dist/model/RWService.d.ts.map +1 -1
  41. package/dist/model/RWService.js +76 -76
  42. package/dist/model/RWServiceFunction.d.ts +4 -4
  43. package/dist/model/RWServiceFunction.d.ts.map +1 -1
  44. package/dist/model/RWServiceFunction.js +97 -95
  45. package/dist/model/RWTOML.d.ts +3 -3
  46. package/dist/model/RWTOML.d.ts.map +1 -1
  47. package/dist/model/RWTOML.js +55 -53
  48. package/dist/model/index.d.ts +2 -2
  49. package/dist/model/index.d.ts.map +1 -1
  50. package/dist/model/index.js +20 -3
  51. package/dist/model/util/process_env.js +62 -44
  52. package/dist/nodes.d.ts +2 -2
  53. package/dist/nodes.d.ts.map +1 -1
  54. package/dist/nodes.js +164 -171
  55. package/dist/util.js +33 -23
  56. package/dist/x/Array.js +25 -15
  57. package/dist/x/Location.d.ts +1 -1
  58. package/dist/x/Location.d.ts.map +1 -1
  59. package/dist/x/Location.js +17 -11
  60. package/dist/x/Position.js +29 -18
  61. package/dist/x/Range.d.ts +1 -1
  62. package/dist/x/Range.d.ts.map +1 -1
  63. package/dist/x/Range.js +22 -17
  64. package/dist/x/URL.js +75 -59
  65. package/dist/x/child_process.d.ts +1 -1
  66. package/dist/x/child_process.d.ts.map +1 -1
  67. package/dist/x/child_process.js +49 -35
  68. package/dist/x/decorators.d.ts +2 -2
  69. package/dist/x/decorators.d.ts.map +1 -1
  70. package/dist/x/decorators.js +26 -46
  71. package/dist/x/diagnostics.d.ts +3 -3
  72. package/dist/x/diagnostics.d.ts.map +1 -1
  73. package/dist/x/diagnostics.js +259 -163
  74. package/dist/x/path.js +55 -36
  75. package/dist/x/prisma.d.ts +2 -2
  76. package/dist/x/prisma.d.ts.map +1 -1
  77. package/dist/x/prisma.js +55 -32
  78. package/dist/x/ts-morph.js +45 -34
  79. package/package.json +17 -38
  80. package/dist/errors.js.map +0 -1
  81. package/dist/index.js.map +0 -1
  82. package/dist/model/RWCell.js.map +0 -1
  83. package/dist/model/RWComponent.js.map +0 -1
  84. package/dist/model/RWEnvHelper.js.map +0 -1
  85. package/dist/model/RWFunction.js.map +0 -1
  86. package/dist/model/RWLayout.js.map +0 -1
  87. package/dist/model/RWPage.js.map +0 -1
  88. package/dist/model/RWProject.js.map +0 -1
  89. package/dist/model/RWRoute.js.map +0 -1
  90. package/dist/model/RWRouter.js.map +0 -1
  91. package/dist/model/RWSDL.js.map +0 -1
  92. package/dist/model/RWSDLField.js.map +0 -1
  93. package/dist/model/RWService.js.map +0 -1
  94. package/dist/model/RWServiceFunction.js.map +0 -1
  95. package/dist/model/RWTOML.js.map +0 -1
  96. package/dist/model/index.js.map +0 -1
  97. package/dist/model/util/process_env.js.map +0 -1
  98. package/dist/nodes.js.map +0 -1
  99. package/dist/util.js.map +0 -1
  100. package/dist/x/Array.js.map +0 -1
  101. package/dist/x/Location.js.map +0 -1
  102. package/dist/x/Position.js.map +0 -1
  103. package/dist/x/Range.js.map +0 -1
  104. package/dist/x/URL.js.map +0 -1
  105. package/dist/x/child_process.js.map +0 -1
  106. package/dist/x/decorators.js.map +0 -1
  107. package/dist/x/diagnostics.js.map +0 -1
  108. package/dist/x/path.js.map +0 -1
  109. package/dist/x/prisma.js.map +0 -1
  110. package/dist/x/ts-morph.js.map +0 -1
package/dist/util.js CHANGED
@@ -1,24 +1,34 @@
1
- export function validateRoutePath(path) {
2
- // copied from https://github.com/cedarjs/cedar/blob/master/packages/router/src/util.js
3
- // Check that path begins with a slash.
4
- if (!path.startsWith('/')) {
5
- throw new Error(`Route path does not begin with a slash: "${path}"`);
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.validateRoutePath = validateRoutePath;
9
+ var _startsWith = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/starts-with"));
10
+ var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/includes"));
11
+ var _matchAll = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/match-all"));
12
+ function validateRoutePath(path) {
13
+ // copied from https://github.com/cedarjs/cedar/blob/master/packages/router/src/util.js
14
+ // Check that path begins with a slash.
15
+ if (!(0, _startsWith.default)(path).call(path, '/')) {
16
+ throw new Error(`Route path does not begin with a slash: "${path}"`);
17
+ }
18
+ if ((0, _includes.default)(path).call(path, ' ')) {
19
+ throw new Error(`Route path contains spaces: "${path}"`);
20
+ }
21
+
22
+ // Check for duplicate named params.
23
+ const matches = (0, _matchAll.default)(path).call(path, /\{([^}]+)\}/g);
24
+ const memo = {};
25
+ for (const match of matches) {
26
+ // Extract the param's name to make sure there aren't any duplicates
27
+ const param = match[1].split(':')[0];
28
+ if (memo[param]) {
29
+ throw new Error(`Route path contains duplicate parameter: "${path}"`);
30
+ } else {
31
+ memo[param] = true;
6
32
  }
7
- if (path.includes(' ')) {
8
- throw new Error(`Route path contains spaces: "${path}"`);
9
- }
10
- // Check for duplicate named params.
11
- const matches = path.matchAll(/\{([^}]+)\}/g);
12
- const memo = {};
13
- for (const match of matches) {
14
- // Extract the param's name to make sure there aren't any duplicates
15
- const param = match[1].split(':')[0];
16
- if (memo[param]) {
17
- throw new Error(`Route path contains duplicate parameter: "${path}"`);
18
- }
19
- else {
20
- memo[param] = true;
21
- }
22
- }
23
- }
24
- //# sourceMappingURL=util.js.map
33
+ }
34
+ }
package/dist/x/Array.js CHANGED
@@ -1,16 +1,26 @@
1
- export async function ArrayLike_normalize(x) {
2
- if (x instanceof Promise) {
3
- return x;
4
- }
5
- if (x === null) {
6
- return [];
7
- }
8
- if (typeof x === 'undefined') {
9
- return [];
10
- }
11
- return [...x];
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.ArrayLike_normalize = ArrayLike_normalize;
9
+ exports.iter = iter;
10
+ var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/promise"));
11
+ var _from = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/array/from"));
12
+ async function ArrayLike_normalize(x) {
13
+ if (x instanceof _promise.default) {
14
+ return x;
15
+ }
16
+ if (x === null) {
17
+ return [];
18
+ }
19
+ if (typeof x === 'undefined') {
20
+ return [];
21
+ }
22
+ return [...x];
12
23
  }
13
- export function iter(f) {
14
- return Array.from(f());
15
- }
16
- //# sourceMappingURL=Array.js.map
24
+ function iter(f) {
25
+ return (0, _from.default)(f());
26
+ }
@@ -1,4 +1,4 @@
1
- import type { Range } from './Range.js';
1
+ import type { Range } from './Range';
2
2
  export type DocumentUri = string;
3
3
  export interface Location {
4
4
  uri: DocumentUri;
@@ -1 +1 @@
1
- {"version":3,"file":"Location.d.ts","sourceRoot":"","sources":["../../src/x/Location.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAEvC,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"}
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"}
@@ -1,12 +1,18 @@
1
- export function Location_create(uri, range) {
2
- return { uri, range };
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
+ };
3
14
  }
4
- export function Location_is(value) {
5
- const candidate = value;
6
- return (candidate &&
7
- typeof candidate.uri === 'string' &&
8
- typeof candidate.range === 'object' &&
9
- candidate.range.start !== undefined &&
10
- candidate.range.end !== undefined);
11
- }
12
- //# sourceMappingURL=Location.js.map
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
+ }
@@ -1,24 +1,35 @@
1
- export function Position_create(line, character) {
2
- return { line, character };
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.Position_compare = Position_compare;
8
+ exports.Position_create = Position_create;
9
+ function Position_create(line, character) {
10
+ return {
11
+ line,
12
+ character
13
+ };
3
14
  }
15
+
4
16
  /**
5
17
  * p1 is greater|smaller|equal than/to p2
6
18
  * @param p1
7
19
  * @param p2
8
20
  */
9
- export function Position_compare(p1, p2) {
10
- if (p1.line > p2.line) {
11
- return 'greater';
12
- }
13
- if (p2.line > p1.line) {
14
- return 'smaller';
15
- }
16
- if (p1.character > p2.character) {
17
- return 'greater';
18
- }
19
- if (p2.character > p1.character) {
20
- return 'smaller';
21
- }
22
- return 'equal';
23
- }
24
- //# sourceMappingURL=Position.js.map
21
+ function Position_compare(p1, p2) {
22
+ if (p1.line > p2.line) {
23
+ return 'greater';
24
+ }
25
+ if (p2.line > p1.line) {
26
+ return 'smaller';
27
+ }
28
+ if (p1.character > p2.character) {
29
+ return 'greater';
30
+ }
31
+ if (p2.character > p1.character) {
32
+ return 'smaller';
33
+ }
34
+ return 'equal';
35
+ }
package/dist/x/Range.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Position } from './Position.js';
1
+ import type { Position } from './Position';
2
2
  export interface Range {
3
3
  start: Position;
4
4
  end: Position;
@@ -1 +1 @@
1
- {"version":3,"file":"Range.d.ts","sourceRoot":"","sources":["../../src/x/Range.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAG7C,MAAM,WAAW,KAAK;IACpB,KAAK,EAAE,QAAQ,CAAA;IACf,GAAG,EAAE,QAAQ,CAAA;CACd;AAED,wBAAgB,YAAY,CAC1B,SAAS,EAAE,MAAM,EACjB,cAAc,EAAE,MAAM,EACtB,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,GACnB,KAAK,CAAA;AACR,wBAAgB,YAAY,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,QAAQ,GAAG,KAAK,CAAA"}
1
+ {"version":3,"file":"Range.d.ts","sourceRoot":"","sources":["../../src/x/Range.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAG1C,MAAM,WAAW,KAAK;IACpB,KAAK,EAAE,QAAQ,CAAA;IACf,GAAG,EAAE,QAAQ,CAAA;CACd;AAED,wBAAgB,YAAY,CAC1B,SAAS,EAAE,MAAM,EACjB,cAAc,EAAE,MAAM,EACtB,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,GACnB,KAAK,CAAA;AACR,wBAAgB,YAAY,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,QAAQ,GAAG,KAAK,CAAA"}
package/dist/x/Range.js CHANGED
@@ -1,17 +1,22 @@
1
- import { Position_create } from './Position.js';
2
- export function Range_create(one, two, three, four) {
3
- if (typeof one === 'number' &&
4
- typeof two === 'number' &&
5
- typeof three === 'number' &&
6
- typeof four === 'number') {
7
- return {
8
- start: Position_create(one, two),
9
- end: Position_create(three, four),
10
- };
11
- }
12
- else if (typeof one === 'object' && typeof two === 'object') {
13
- return { start: one, end: two };
14
- }
15
- throw new Error('Invalid arguments to Range_create');
16
- }
17
- //# sourceMappingURL=Range.js.map
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.Range_create = Range_create;
8
+ var _Position = require("./Position");
9
+ function Range_create(one, two, three, four) {
10
+ if (typeof one === 'number' && typeof two === 'number' && typeof three === 'number' && typeof four === 'number') {
11
+ return {
12
+ start: (0, _Position.Position_create)(one, two),
13
+ end: (0, _Position.Position_create)(three, four)
14
+ };
15
+ } else if (typeof one === 'object' && typeof two === 'object') {
16
+ return {
17
+ start: one,
18
+ end: two
19
+ };
20
+ }
21
+ throw new Error('Invalid arguments to Range_create');
22
+ }
package/dist/x/URL.js CHANGED
@@ -1,4 +1,17 @@
1
- import { isAbsolute, join, normalize, sep as path_sep } from 'node:path';
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.URL_file = URL_file;
9
+ exports.URL_toFile = URL_toFile;
10
+ var _startsWith = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/starts-with"));
11
+ var _url = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/url"));
12
+ var _indexOf = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/index-of"));
13
+ var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/includes"));
14
+ var _path = require("path");
2
15
  /**
3
16
  * Creates a file:// URL
4
17
  * Works with linux and windows paths
@@ -6,34 +19,36 @@ import { isAbsolute, join, normalize, sep as path_sep } from 'node:path';
6
19
  * TODO: rename to URL_fromFile
7
20
  * @param filePath
8
21
  */
9
- export function URL_file(filePath, ...parts) {
10
- if (filePath.startsWith(FILE_SCHEME)) {
11
- filePath = filePath.substr(FILE_SCHEME.length);
12
- }
13
- if (parts.length > 0) {
14
- filePath = join(filePath, ...parts);
15
- }
16
- return new URL(FILE_SCHEME + normalize(filePath)).href;
22
+ function URL_file(filePath, ...parts) {
23
+ if ((0, _startsWith.default)(filePath).call(filePath, FILE_SCHEME)) {
24
+ filePath = filePath.substr(FILE_SCHEME.length);
25
+ }
26
+ if (parts.length > 0) {
27
+ filePath = (0, _path.join)(filePath, ...parts);
28
+ }
29
+ return new _url.default(FILE_SCHEME + (0, _path.normalize)(filePath)).href;
17
30
  }
31
+
18
32
  /**
19
33
  *
20
34
  * @param uriOrFilePath
21
35
  * @param sep separator string, defaults to `require('path').sep`
22
36
  */
23
- export function URL_toFile(uriOrFilePath, sep = path_sep) {
24
- if (typeof uriOrFilePath !== 'string') {
25
- throw new Error('arg error');
26
- }
27
- if (uriOrFilePath.startsWith(FILE_SCHEME)) {
28
- return fileUriToPath(uriOrFilePath, sep);
29
- }
30
- const p = normalize(uriOrFilePath);
31
- if (!isAbsolute(p)) {
32
- throw new Error('absolute path expected: ' + p);
33
- }
34
- return p;
37
+ function URL_toFile(uriOrFilePath, sep = _path.sep) {
38
+ if (typeof uriOrFilePath !== 'string') {
39
+ throw new Error('arg error');
40
+ }
41
+ if ((0, _startsWith.default)(uriOrFilePath).call(uriOrFilePath, FILE_SCHEME)) {
42
+ return fileUriToPath(uriOrFilePath, sep);
43
+ }
44
+ const p = (0, _path.normalize)(uriOrFilePath);
45
+ if (!(0, _path.isAbsolute)(p)) {
46
+ throw new Error('absolute path expected: ' + p);
47
+ }
48
+ return p;
35
49
  }
36
50
  const FILE_SCHEME = 'file://';
51
+
37
52
  /**
38
53
  * based on https://github.com/TooTallNate/file-uri-to-path/blob/master/src/index.ts
39
54
  * main changes:
@@ -43,41 +58,42 @@ const FILE_SCHEME = 'file://';
43
58
  * @param uri
44
59
  * @param sep
45
60
  */
46
- function fileUriToPath(uri, sep = path_sep) {
47
- if (typeof uri !== 'string' ||
48
- uri.length <= 7 ||
49
- !uri.startsWith(FILE_SCHEME)) {
50
- throw new TypeError('must pass in a file:// URI to convert to a file path');
51
- }
52
- const rest = decodeURIComponent(uri.substring(7));
53
- const firstSlash = rest.indexOf('/');
54
- let host = rest.substring(0, firstSlash);
55
- let path = rest.substring(firstSlash + 1);
56
- // 2. Scheme Definition
57
- // As a special case, <host> can be the string "localhost" or the empty
58
- // string; this is interpreted as "the machine from which the URL is
59
- // being interpreted".
60
- if (host === 'localhost') {
61
- host = '';
62
- }
63
- if (host) {
64
- host = sep + sep + host;
65
- }
66
- // 3.2 Drives, drive letters, mount points, file system root
67
- // Drive letters are mapped into the top of a file URI in various ways,
68
- // depending on the implementation; some applications substitute
69
- // vertical bar ("|") for the colon after the drive letter, yielding
70
- // "file:///c|/tmp/test.txt". In some cases, the colon is left
71
- // unchanged, as in "file:///c:/tmp/test.txt". In other cases, the
72
- // colon is simply omitted, as in "file:///c/tmp/test.txt".
73
- path = path.replace(/^(.+)\|/, '$1:');
74
- const parts = path.split('/');
75
- // if the first segment is NOT a windows drive
76
- // we insert an extra empty segment
77
- // this will result in an initial slash (unix style)
78
- if (!parts[0].includes(':')) {
79
- parts.unshift('');
80
- }
81
- return parts.join(sep);
82
- }
83
- //# sourceMappingURL=URL.js.map
61
+ function fileUriToPath(uri, sep = _path.sep) {
62
+ var _context;
63
+ if (typeof uri !== 'string' || uri.length <= 7 || !(0, _startsWith.default)(uri).call(uri, FILE_SCHEME)) {
64
+ throw new TypeError('must pass in a file:// URI to convert to a file path');
65
+ }
66
+ const rest = decodeURIComponent(uri.substring(7));
67
+ const firstSlash = (0, _indexOf.default)(rest).call(rest, '/');
68
+ let host = rest.substring(0, firstSlash);
69
+ let path = rest.substring(firstSlash + 1);
70
+
71
+ // 2. Scheme Definition
72
+ // As a special case, <host> can be the string "localhost" or the empty
73
+ // string; this is interpreted as "the machine from which the URL is
74
+ // being interpreted".
75
+ if (host === 'localhost') {
76
+ host = '';
77
+ }
78
+ if (host) {
79
+ host = sep + sep + host;
80
+ }
81
+
82
+ // 3.2 Drives, drive letters, mount points, file system root
83
+ // Drive letters are mapped into the top of a file URI in various ways,
84
+ // depending on the implementation; some applications substitute
85
+ // vertical bar ("|") for the colon after the drive letter, yielding
86
+ // "file:///c|/tmp/test.txt". In some cases, the colon is left
87
+ // unchanged, as in "file:///c:/tmp/test.txt". In other cases, the
88
+ // colon is simply omitted, as in "file:///c/tmp/test.txt".
89
+ path = path.replace(/^(.+)\|/, '$1:');
90
+ const parts = path.split('/');
91
+
92
+ // if the first segment is NOT a windows drive
93
+ // we insert an extra empty segment
94
+ // this will result in an initial slash (unix style)
95
+ if (!(0, _includes.default)(_context = parts[0]).call(_context, ':')) {
96
+ parts.unshift('');
97
+ }
98
+ return parts.join(sep);
99
+ }
@@ -1,4 +1,4 @@
1
- import * as child_process from 'node:child_process';
1
+ import * as child_process from 'child_process';
2
2
  export type SpawnOut = {
3
3
  stderr: string;
4
4
  stdout: string;
@@ -1 +1 @@
1
- {"version":3,"file":"child_process.d.ts","sourceRoot":"","sources":["../../src/x/child_process.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAA;AAEnD,MAAM,MAAM,QAAQ,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,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,kBAAkB,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,GAAG;IAAE,MAAM,EAAE,MAAM,IAAI,CAAA;CAAE,CAAA;AAEvE,wBAAgB,uBAAuB,CAAC,CAAC,EAAE,CAAC,EAC1C,CAAC,EAAE,kBAAkB,CAAC,CAAC,CAAC,EACxB,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GACb,kBAAkB,CAAC,CAAC,CAAC,CAIvB"}
@@ -1,37 +1,51 @@
1
- import * as child_process from 'node:child_process';
2
- export function spawnCancellable(cmd, args, opts) {
3
- let cp;
4
- const promise = new Promise((resolve, reject) => {
5
- cp = child_process.spawn(cmd, args, opts);
6
- let stderr = '', stdout = '';
7
- cp.stdout.on('data', (data) => {
8
- stdout += data;
9
- opts?.stdout_cb?.(data);
10
- });
11
- cp.stderr.on('data', (data) => {
12
- stderr += data;
13
- opts?.stderr_cb?.(data);
14
- });
15
- cp.on('close', (code) => {
16
- resolve({ stdout, stderr, code });
17
- });
18
- cp.on('error', (err) => {
19
- reject(err);
20
- });
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.CancellablePromise_then = CancellablePromise_then;
10
+ exports.spawnCancellable = spawnCancellable;
11
+ var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/promise"));
12
+ var child_process = _interopRequireWildcard(require("child_process"));
13
+ function spawnCancellable(cmd, args, opts) {
14
+ let cp;
15
+ const promise = new _promise.default((resolve, reject) => {
16
+ cp = child_process.spawn(cmd, args, opts);
17
+ let stderr = '',
18
+ stdout = '';
19
+ cp.stdout.on('data', data => {
20
+ stdout += data;
21
+ opts?.stdout_cb?.(data);
21
22
  });
22
- promise.cancel = () => {
23
- try {
24
- cp.kill();
25
- }
26
- catch {
27
- // intentionally left empty
28
- }
29
- };
30
- return promise;
31
- }
32
- export function CancellablePromise_then(p, f) {
33
- const p2 = p.then(f);
34
- p2.cancel = p.cancel;
35
- return p2;
23
+ cp.stderr.on('data', data => {
24
+ stderr += data;
25
+ opts?.stderr_cb?.(data);
26
+ });
27
+ cp.on('close', code => {
28
+ resolve({
29
+ stdout,
30
+ stderr,
31
+ code
32
+ });
33
+ });
34
+ cp.on('error', err => {
35
+ reject(err);
36
+ });
37
+ });
38
+ promise.cancel = () => {
39
+ try {
40
+ cp.kill();
41
+ } catch {
42
+ // intentionally left empty
43
+ }
44
+ };
45
+ return promise;
36
46
  }
37
- //# sourceMappingURL=child_process.js.map
47
+ function CancellablePromise_then(p, f) {
48
+ const p2 = p.then(f);
49
+ p2.cancel = p.cancel;
50
+ return p2;
51
+ }
@@ -1,3 +1,3 @@
1
- export declare function lazy<T>(): (_target: object, key: string | symbol, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
2
- export declare function memo(keySerializer?: (...args: unknown[]) => string): (_target: object, _key: string | symbol, descriptor: PropertyDescriptor) => PropertyDescriptor;
1
+ export { LazyGetter as lazy } from 'lazy-get-decorator';
2
+ export { Debounce as debounce, Memoize as memo } from 'lodash-decorators';
3
3
  //# sourceMappingURL=decorators.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../../src/x/decorators.ts"],"names":[],"mappings":"AAAA,wBAAgB,IAAI,CAAC,CAAC,MAElB,SAAS,MAAM,EACf,KAAK,MAAM,GAAG,MAAM,EACpB,YAAY,uBAAuB,CAAC,CAAC,CAAC,KACrC,uBAAuB,CAAC,CAAC,CAAC,CAkB9B;AAED,wBAAgB,IAAI,CAAC,aAAa,GAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,MAAe,IAEvE,SAAS,MAAM,EACf,MAAM,MAAM,GAAG,MAAM,EACrB,YAAY,kBAAkB,KAC7B,kBAAkB,CA0BtB"}
1
+ {"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../../src/x/decorators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,IAAI,IAAI,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,EAAE,QAAQ,IAAI,QAAQ,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,mBAAmB,CAAA"}
@@ -1,46 +1,26 @@
1
- export function lazy() {
2
- return function (_target, key, descriptor) {
3
- const getter = descriptor.get;
4
- if (!getter) {
5
- throw new Error('@lazy can only be used on getters');
6
- }
7
- return {
8
- get() {
9
- const value = getter.call(this);
10
- Object.defineProperty(this, key, {
11
- value,
12
- enumerable: descriptor.enumerable,
13
- });
14
- return value;
15
- },
16
- enumerable: descriptor.enumerable,
17
- configurable: true,
18
- };
19
- };
20
- }
21
- export function memo(keySerializer = String) {
22
- return function (_target, _key, descriptor) {
23
- const original = descriptor.value;
24
- return {
25
- ...descriptor,
26
- value(...args) {
27
- if (!this.__memoCache) {
28
- this.__memoCache = new Map();
29
- }
30
- const cacheKey = _key;
31
- if (!this.__memoCache.has(cacheKey)) {
32
- this.__memoCache.set(cacheKey, new Map());
33
- }
34
- const methodCache = this.__memoCache.get(cacheKey);
35
- const argsKey = keySerializer(...args);
36
- if (methodCache.has(argsKey)) {
37
- return methodCache.get(argsKey);
38
- }
39
- const result = original.apply(this, args);
40
- methodCache.set(argsKey, result);
41
- return result;
42
- },
43
- };
44
- };
45
- }
46
- //# sourceMappingURL=decorators.js.map
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, "debounce", {
8
+ enumerable: true,
9
+ get: function () {
10
+ return _lodashDecorators.Debounce;
11
+ }
12
+ });
13
+ _Object$defineProperty(exports, "lazy", {
14
+ enumerable: true,
15
+ get: function () {
16
+ return _lazyGetDecorator.LazyGetter;
17
+ }
18
+ });
19
+ _Object$defineProperty(exports, "memo", {
20
+ enumerable: true,
21
+ get: function () {
22
+ return _lodashDecorators.Memoize;
23
+ }
24
+ });
25
+ var _lazyGetDecorator = require("lazy-get-decorator");
26
+ var _lodashDecorators = require("lodash-decorators");
@@ -1,7 +1,7 @@
1
1
  import * as tsm from 'ts-morph';
2
- import type { Location } from './Location.js';
3
- import type { Position } from './Position.js';
4
- import type { Range } from './Range.js';
2
+ import type { Location } from './Location';
3
+ import type { Position } from './Position';
4
+ import type { Range } from './Range';
5
5
  export type DocumentUri = string;
6
6
  export declare enum DiagnosticSeverity {
7
7
  Error = 1,
@@ -1 +1 @@
1
- {"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../../src/x/diagnostics.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAE/B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAE7C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAE7C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAIvC,MAAM,MAAM,WAAW,GAAG,MAAM,CAAA;AAEhC,oBAAY,kBAAkB;IAC5B,KAAK,IAAI;IACT,OAAO,IAAI;IACX,WAAW,IAAI;IACf,IAAI,IAAI;CACT;AAED,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,KAAK,CAAA;IACZ,QAAQ,CAAC,EAAE,kBAAkB,CAAA;IAC7B,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACtB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,UAAU,CAS7D;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,WAA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