@cedarjs/structure 2.2.1 → 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.
- package/README.md +8 -24
- package/dist/index.d.ts +3 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -23
- package/dist/model/RWCell.d.ts +4 -3
- package/dist/model/RWCell.d.ts.map +1 -1
- package/dist/model/RWCell.js +7 -8
- package/dist/model/RWComponent.d.ts +1 -1
- package/dist/model/RWComponent.d.ts.map +1 -1
- package/dist/model/RWComponent.js +2 -2
- package/dist/model/RWEnvHelper.d.ts +3 -7
- package/dist/model/RWEnvHelper.d.ts.map +1 -1
- package/dist/model/RWEnvHelper.js +33 -114
- package/dist/model/RWFunction.d.ts +1 -1
- package/dist/model/RWFunction.d.ts.map +1 -1
- package/dist/model/RWFunction.js +2 -2
- package/dist/model/RWLayout.d.ts +1 -1
- package/dist/model/RWLayout.d.ts.map +1 -1
- package/dist/model/RWLayout.js +2 -2
- package/dist/model/RWPage.d.ts +1 -1
- package/dist/model/RWPage.d.ts.map +1 -1
- package/dist/model/RWPage.js +2 -2
- package/dist/model/RWProject.d.ts +1 -4
- package/dist/model/RWProject.d.ts.map +1 -1
- package/dist/model/RWProject.js +17 -19
- package/dist/model/RWRoute.d.ts +3 -16
- package/dist/model/RWRoute.d.ts.map +1 -1
- package/dist/model/RWRoute.js +11 -137
- package/dist/model/RWRouter.d.ts +2 -6
- package/dist/model/RWRouter.d.ts.map +1 -1
- package/dist/model/RWRouter.js +10 -62
- package/dist/model/RWSDL.d.ts +2 -2
- package/dist/model/RWSDL.d.ts.map +1 -1
- package/dist/model/RWSDL.js +4 -4
- package/dist/model/RWSDLField.d.ts +3 -7
- package/dist/model/RWSDLField.d.ts.map +1 -1
- package/dist/model/RWSDLField.js +10 -59
- package/dist/model/RWService.d.ts +1 -1
- package/dist/model/RWService.d.ts.map +1 -1
- package/dist/model/RWService.js +2 -2
- package/dist/model/RWServiceFunction.d.ts +2 -2
- package/dist/model/RWServiceFunction.d.ts.map +1 -1
- package/dist/model/RWServiceFunction.js +5 -6
- package/dist/model/RWTOML.d.ts +2 -2
- package/dist/model/RWTOML.d.ts.map +1 -1
- package/dist/model/RWTOML.js +6 -6
- package/dist/model/util/process_env.d.ts +9 -18
- package/dist/model/util/process_env.d.ts.map +1 -1
- package/dist/model/util/process_env.js +25 -34
- package/dist/nodes.d.ts +62 -0
- package/dist/nodes.d.ts.map +1 -0
- package/dist/nodes.js +175 -0
- package/dist/x/Location.d.ts +9 -0
- package/dist/x/Location.d.ts.map +1 -0
- package/dist/x/Location.js +18 -0
- package/dist/x/Position.d.ts +12 -0
- package/dist/x/Position.d.ts.map +1 -0
- package/dist/x/Position.js +35 -0
- package/dist/x/Range.d.ts +8 -0
- package/dist/x/Range.d.ts.map +1 -0
- package/dist/x/Range.js +22 -0
- package/dist/x/{vscode-languageserver-types.d.ts → diagnostics.d.ts} +27 -36
- package/dist/x/diagnostics.d.ts.map +1 -0
- package/dist/x/{vscode-languageserver-types.js → diagnostics.js} +30 -135
- package/dist/x/path.d.ts +1 -0
- package/dist/x/path.d.ts.map +1 -1
- package/dist/x/path.js +25 -17
- package/dist/x/prisma.d.ts +2 -3
- package/dist/x/prisma.d.ts.map +1 -1
- package/dist/x/prisma.js +5 -5
- package/package.json +3 -8
- package/dist/hosts.d.ts +0 -23
- package/dist/hosts.d.ts.map +0 -1
- package/dist/hosts.js +0 -44
- package/dist/ide.d.ts +0 -122
- package/dist/ide.d.ts.map +0 -1
- package/dist/ide.js +0 -240
- package/dist/interactive_cli/RedwoodCommandString.d.ts +0 -20
- package/dist/interactive_cli/RedwoodCommandString.d.ts.map +0 -1
- package/dist/interactive_cli/RedwoodCommandString.js +0 -72
- package/dist/interactive_cli/command_builder.d.ts +0 -10
- package/dist/interactive_cli/command_builder.d.ts.map +0 -1
- package/dist/interactive_cli/command_builder.js +0 -196
- package/dist/interactive_cli/dry_run.d.ts +0 -28
- package/dist/interactive_cli/dry_run.d.ts.map +0 -1
- package/dist/interactive_cli/dry_run.js +0 -104
- package/dist/interactive_cli/ui.d.ts +0 -32
- package/dist/interactive_cli/ui.d.ts.map +0 -1
- package/dist/interactive_cli/ui.js +0 -84
- package/dist/language_server/RWLanguageServer.d.ts +0 -30
- package/dist/language_server/RWLanguageServer.d.ts.map +0 -1
- package/dist/language_server/RWLanguageServer.js +0 -201
- package/dist/language_server/commands.d.ts +0 -14
- package/dist/language_server/commands.d.ts.map +0 -1
- package/dist/language_server/commands.js +0 -122
- package/dist/language_server/diagnostics.d.ts +0 -10
- package/dist/language_server/diagnostics.d.ts.map +0 -1
- package/dist/language_server/diagnostics.js +0 -61
- package/dist/language_server/outline.d.ts +0 -7
- package/dist/language_server/outline.d.ts.map +0 -1
- package/dist/language_server/outline.js +0 -37
- package/dist/language_server/start.d.ts +0 -2
- package/dist/language_server/start.d.ts.map +0 -1
- package/dist/language_server/start.js +0 -4
- package/dist/language_server/xmethods.d.ts +0 -11
- package/dist/language_server/xmethods.d.ts.map +0 -1
- package/dist/language_server/xmethods.js +0 -42
- package/dist/model/util/advanced_path_parser.d.ts +0 -12
- package/dist/model/util/advanced_path_parser.d.ts.map +0 -1
- package/dist/model/util/advanced_path_parser.js +0 -38
- package/dist/outline/index.d.ts +0 -3
- package/dist/outline/index.d.ts.map +0 -1
- package/dist/outline/index.js +0 -31
- package/dist/outline/outline.d.ts +0 -4
- package/dist/outline/outline.d.ts.map +0 -1
- package/dist/outline/outline.js +0 -262
- package/dist/outline/types.d.ts +0 -87
- package/dist/outline/types.d.ts.map +0 -1
- package/dist/outline/types.js +0 -72
- package/dist/x/vscode-languageserver-types.d.ts.map +0 -1
- package/dist/x/vscode-languageserver.d.ts +0 -12
- package/dist/x/vscode-languageserver.d.ts.map +0 -1
- package/dist/x/vscode-languageserver.js +0 -61
- package/dist/x/vscode.d.ts +0 -126
- package/dist/x/vscode.d.ts.map +0 -1
- package/dist/x/vscode.js +0 -294
package/dist/hosts.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
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.DefaultHost = void 0;
|
|
9
|
-
var _replaceAll = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/replace-all"));
|
|
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 _nodeFs = _interopRequireDefault(require("node:fs"));
|
|
13
|
-
var _fastGlob = _interopRequireDefault(require("fast-glob"));
|
|
14
|
-
var _projectConfig = require("@cedarjs/project-config");
|
|
15
|
-
var _decorators = require("./x/decorators");
|
|
16
|
-
var _dec, _class;
|
|
17
|
-
/**
|
|
18
|
-
* The host interface allows us to decouple the "model/*"
|
|
19
|
-
* classes from access to the file system.
|
|
20
|
-
* This is critical for editor support (ex: showing diagnostics on unsaved files)
|
|
21
|
-
*/
|
|
22
|
-
let DefaultHost = exports.DefaultHost = (_dec = (0, _decorators.lazy)(), _class = class DefaultHost {
|
|
23
|
-
existsSync(path) {
|
|
24
|
-
return _nodeFs.default.existsSync(path);
|
|
25
|
-
}
|
|
26
|
-
readFileSync(path) {
|
|
27
|
-
return _nodeFs.default.readFileSync(path, {
|
|
28
|
-
encoding: 'utf8'
|
|
29
|
-
}).toString();
|
|
30
|
-
}
|
|
31
|
-
readdirSync(path) {
|
|
32
|
-
return _nodeFs.default.readdirSync(path);
|
|
33
|
-
}
|
|
34
|
-
globSync(pattern) {
|
|
35
|
-
// globSync only works with / as the path separator, even on Windows
|
|
36
|
-
return _fastGlob.default.sync((0, _replaceAll.default)(pattern).call(pattern, '\\', '/'));
|
|
37
|
-
}
|
|
38
|
-
writeFileSync(path, contents) {
|
|
39
|
-
return _nodeFs.default.writeFileSync(path, contents);
|
|
40
|
-
}
|
|
41
|
-
get paths() {
|
|
42
|
-
return (0, _projectConfig.getPaths)();
|
|
43
|
-
}
|
|
44
|
-
}, (0, _applyDecoratedDescriptor2.default)(_class.prototype, "paths", [_dec], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "paths"), _class.prototype), _class);
|
package/dist/ide.d.ts
DELETED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import type * as tsm from 'ts-morph';
|
|
2
|
-
import type { TextDocuments } from 'vscode-languageserver';
|
|
3
|
-
import type { TextDocument } from 'vscode-languageserver-textdocument';
|
|
4
|
-
import type { CodeLens, DocumentLink, Hover, Location } from 'vscode-languageserver-types';
|
|
5
|
-
import type { Host } from './hosts';
|
|
6
|
-
import { DefaultHost } from './hosts';
|
|
7
|
-
import type { ArrayLike } from './x/Array';
|
|
8
|
-
import type { ExtendedDiagnostic } from './x/vscode-languageserver-types';
|
|
9
|
-
export type NodeID = string;
|
|
10
|
-
export type IDEInfo = Definition | Implementation | Reference | CodeLensX | HoverX | Decoration | DocumentLinkX;
|
|
11
|
-
export interface Definition {
|
|
12
|
-
kind: 'Definition';
|
|
13
|
-
location: Location;
|
|
14
|
-
target: Location;
|
|
15
|
-
}
|
|
16
|
-
export interface Implementation {
|
|
17
|
-
kind: 'Implementation';
|
|
18
|
-
location: Location;
|
|
19
|
-
target: Location;
|
|
20
|
-
}
|
|
21
|
-
export interface Reference {
|
|
22
|
-
kind: 'Reference';
|
|
23
|
-
location: Location;
|
|
24
|
-
target: Location;
|
|
25
|
-
}
|
|
26
|
-
export interface CodeLensX {
|
|
27
|
-
kind: 'CodeLens';
|
|
28
|
-
location: Location;
|
|
29
|
-
codeLens: CodeLens;
|
|
30
|
-
}
|
|
31
|
-
export interface HoverX {
|
|
32
|
-
kind: 'Hover';
|
|
33
|
-
location: Location;
|
|
34
|
-
hover: Hover;
|
|
35
|
-
}
|
|
36
|
-
export interface Decoration {
|
|
37
|
-
kind: 'Decoration';
|
|
38
|
-
location: Location;
|
|
39
|
-
style: 'path_punctuation' | 'path_parameter' | 'path_slash' | 'path_parameter_type';
|
|
40
|
-
}
|
|
41
|
-
export interface DocumentLinkX {
|
|
42
|
-
kind: 'DocumentLink';
|
|
43
|
-
location: Location;
|
|
44
|
-
link: DocumentLink;
|
|
45
|
-
}
|
|
46
|
-
export declare abstract class BaseNode {
|
|
47
|
-
/**
|
|
48
|
-
* Each node MUST have a unique ID.
|
|
49
|
-
* IDs have meaningful information.
|
|
50
|
-
*
|
|
51
|
-
* examples:
|
|
52
|
-
* - /path/to/project
|
|
53
|
-
* - /path/to/project/web/src/Routes.js
|
|
54
|
-
* - /path/to/project/web/src/Routes.js /route1
|
|
55
|
-
*/
|
|
56
|
-
abstract get id(): NodeID;
|
|
57
|
-
abstract get parent(): BaseNode | undefined;
|
|
58
|
-
get host(): Host;
|
|
59
|
-
exists: boolean;
|
|
60
|
-
/**
|
|
61
|
-
* Returns the children of this node.
|
|
62
|
-
* Override this.
|
|
63
|
-
*/
|
|
64
|
-
children(): ArrayLike<BaseNode>;
|
|
65
|
-
private _children;
|
|
66
|
-
/**
|
|
67
|
-
* Diagnostics for this node (must not include children's diagnostics).
|
|
68
|
-
* Override this.
|
|
69
|
-
*/
|
|
70
|
-
diagnostics(): ArrayLike<ExtendedDiagnostic>;
|
|
71
|
-
private _diagnostics;
|
|
72
|
-
/**
|
|
73
|
-
* IDE info for this node.
|
|
74
|
-
* Override this.
|
|
75
|
-
*/
|
|
76
|
-
ideInfo(): ArrayLike<IDEInfo>;
|
|
77
|
-
private _ideInfo;
|
|
78
|
-
collectIDEInfo(uri?: string): Promise<IDEInfo[]>;
|
|
79
|
-
/**
|
|
80
|
-
* Collects diagnostics for this node and all descendants.
|
|
81
|
-
* This is what you'll use to gather all the project diagnostics.
|
|
82
|
-
*/
|
|
83
|
-
collectDiagnostics(uri?: string): Promise<ExtendedDiagnostic[]>;
|
|
84
|
-
bailOutOnCollection(uri: string): boolean;
|
|
85
|
-
get closestContainingUri(): string | undefined;
|
|
86
|
-
/**
|
|
87
|
-
* Finds a node by ID.
|
|
88
|
-
* The default algorithm tries to be economic and only create the necessary
|
|
89
|
-
* intermediate nodes.
|
|
90
|
-
* Subclasses can override this to add further optimizations.
|
|
91
|
-
* @param id
|
|
92
|
-
*/
|
|
93
|
-
findNode(id: NodeID): Promise<BaseNode | undefined>;
|
|
94
|
-
}
|
|
95
|
-
export declare abstract class FileNode extends BaseNode {
|
|
96
|
-
abstract get filePath(): string;
|
|
97
|
-
get uri(): string;
|
|
98
|
-
/**
|
|
99
|
-
* the ID of a FileNode is its file:// uri.
|
|
100
|
-
*/
|
|
101
|
-
get id(): string;
|
|
102
|
-
get text(): string;
|
|
103
|
-
get fileExists(): boolean;
|
|
104
|
-
/**
|
|
105
|
-
* parsed ts-morph source file
|
|
106
|
-
*/
|
|
107
|
-
get sf(): tsm.SourceFile;
|
|
108
|
-
get basenameNoExt(): string;
|
|
109
|
-
get basename(): string;
|
|
110
|
-
}
|
|
111
|
-
export declare class HostWithDocumentsStore implements Host {
|
|
112
|
-
documents: TextDocuments<TextDocument>;
|
|
113
|
-
defaultHost: DefaultHost;
|
|
114
|
-
constructor(documents: TextDocuments<TextDocument>);
|
|
115
|
-
readFileSync(path: string): string;
|
|
116
|
-
existsSync(path: string): boolean;
|
|
117
|
-
readdirSync(path: string): string[];
|
|
118
|
-
globSync(pattern: string): string[];
|
|
119
|
-
writeFileSync(path: string, contents: string): void;
|
|
120
|
-
get paths(): import("@cedarjs/project-config").Paths;
|
|
121
|
-
}
|
|
122
|
-
//# sourceMappingURL=ide.d.ts.map
|
package/dist/ide.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ide.d.ts","sourceRoot":"","sources":["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AC/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;AAED,qBAAa,sBAAuB,YAAW,IAAI;IAE9B,SAAS,EAAE,aAAa,CAAC,YAAY,CAAC;IADzD,WAAW,cAAoB;gBACZ,SAAS,EAAE,aAAa,CAAC,YAAY,CAAC;IACzD,YAAY,CAAC,IAAI,EAAE,MAAM;IAQzB,UAAU,CAAC,IAAI,EAAE,MAAM;IAGvB,WAAW,CAAC,IAAI,EAAE,MAAM;IAGxB,QAAQ,CAAC,OAAO,EAAE,MAAM;IAGxB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAG5C,IAAI,KAAK,4CAER;CACF"}
|
package/dist/ide.js
DELETED
|
@@ -1,240 +0,0 @@
|
|
|
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.HostWithDocumentsStore = 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 _path = require("path");
|
|
18
|
-
var _vscodeLanguageserverTypes = require("vscode-languageserver-types");
|
|
19
|
-
var _hosts = require("./hosts");
|
|
20
|
-
var _Array = require("./x/Array");
|
|
21
|
-
var _decorators = require("./x/decorators");
|
|
22
|
-
var _path2 = require("./x/path");
|
|
23
|
-
var _tsMorph = require("./x/ts-morph");
|
|
24
|
-
var _URL = require("./x/URL");
|
|
25
|
-
var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _class, _dec9, _dec0, _dec1, _dec10, _dec11, _dec12, _dec13, _class2;
|
|
26
|
-
let BaseNode = exports.BaseNode = (_dec = (0, _decorators.lazy)(), _dec2 = (0, _decorators.memo)(), _dec3 = (0, _decorators.memo)(), _dec4 = (0, _decorators.memo)(), _dec5 = (0, _decorators.memo)(_stringify.default), _dec6 = (0, _decorators.memo)(_stringify.default), _dec7 = (0, _decorators.lazy)(), _dec8 = (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
|
-
get host() {
|
|
40
|
-
if (this.parent) {
|
|
41
|
-
return this.parent.host;
|
|
42
|
-
}
|
|
43
|
-
throw new Error("Could not find host implementation on root node (you must override the 'host' getter)");
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Returns the children of this node.
|
|
47
|
-
* Override this.
|
|
48
|
-
*/
|
|
49
|
-
children() {
|
|
50
|
-
return [];
|
|
51
|
-
}
|
|
52
|
-
_children() {
|
|
53
|
-
return (0, _Array.ArrayLike_normalize)(this.children());
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Diagnostics for this node (must not include children's diagnostics).
|
|
58
|
-
* Override this.
|
|
59
|
-
*/
|
|
60
|
-
diagnostics() {
|
|
61
|
-
return [];
|
|
62
|
-
}
|
|
63
|
-
_diagnostics() {
|
|
64
|
-
return (0, _Array.ArrayLike_normalize)(this.diagnostics());
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* IDE info for this node.
|
|
69
|
-
* Override this.
|
|
70
|
-
*/
|
|
71
|
-
ideInfo() {
|
|
72
|
-
return [];
|
|
73
|
-
}
|
|
74
|
-
_ideInfo() {
|
|
75
|
-
return (0, _Array.ArrayLike_normalize)(this.ideInfo());
|
|
76
|
-
}
|
|
77
|
-
async collectIDEInfo(uri) {
|
|
78
|
-
if (uri && this.bailOutOnCollection(uri)) {
|
|
79
|
-
return [];
|
|
80
|
-
}
|
|
81
|
-
try {
|
|
82
|
-
var _context;
|
|
83
|
-
const d1 = await this._ideInfo();
|
|
84
|
-
const dd = await _promise.default.all((0, _map.default)(_context = await this._children()).call(_context, c => c.collectIDEInfo(uri)));
|
|
85
|
-
const d2 = (0, _flat.default)(dd).call(dd);
|
|
86
|
-
let all = [...d1, ...d2];
|
|
87
|
-
if (uri) {
|
|
88
|
-
all = (0, _filter.default)(all).call(all, x => x.location.uri === uri);
|
|
89
|
-
}
|
|
90
|
-
return all;
|
|
91
|
-
} catch (e) {
|
|
92
|
-
// TODO: this diagnostic is also interesting
|
|
93
|
-
console.log(e);
|
|
94
|
-
return [];
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Collects diagnostics for this node and all descendants.
|
|
100
|
-
* This is what you'll use to gather all the project diagnostics.
|
|
101
|
-
*/
|
|
102
|
-
async collectDiagnostics(uri) {
|
|
103
|
-
// TODO: catch runtime errors and add them as diagnostics
|
|
104
|
-
// TODO: we can parallelize this further
|
|
105
|
-
if (uri && this.bailOutOnCollection(uri)) {
|
|
106
|
-
return [];
|
|
107
|
-
}
|
|
108
|
-
try {
|
|
109
|
-
var _context2;
|
|
110
|
-
const d1 = await this._diagnostics();
|
|
111
|
-
const dd = await _promise.default.all((0, _map.default)(_context2 = await this._children()).call(_context2, c => c.collectDiagnostics(uri)));
|
|
112
|
-
const d2 = (0, _flat.default)(dd).call(dd);
|
|
113
|
-
let all = [...d1, ...d2];
|
|
114
|
-
if (uri) {
|
|
115
|
-
all = (0, _filter.default)(all).call(all, x => x.uri === uri);
|
|
116
|
-
}
|
|
117
|
-
return all;
|
|
118
|
-
} catch (e) {
|
|
119
|
-
const uri = this.closestContainingUri;
|
|
120
|
-
if (!uri) {
|
|
121
|
-
throw e;
|
|
122
|
-
}
|
|
123
|
-
const range = _vscodeLanguageserverTypes.Range.create(0, 0, 0, 0);
|
|
124
|
-
return [{
|
|
125
|
-
uri,
|
|
126
|
-
diagnostic: {
|
|
127
|
-
message: e + '',
|
|
128
|
-
range
|
|
129
|
-
}
|
|
130
|
-
}];
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
bailOutOnCollection(uri) {
|
|
134
|
-
if (this.id === uri) {
|
|
135
|
-
return false;
|
|
136
|
-
}
|
|
137
|
-
if ((0, _startsWith.default)(uri).call(uri, this.id)) {
|
|
138
|
-
return false;
|
|
139
|
-
}
|
|
140
|
-
return true;
|
|
141
|
-
}
|
|
142
|
-
get closestContainingUri() {
|
|
143
|
-
const {
|
|
144
|
-
uri
|
|
145
|
-
} = this;
|
|
146
|
-
if (uri) {
|
|
147
|
-
return uri;
|
|
148
|
-
}
|
|
149
|
-
if (this.parent) {
|
|
150
|
-
return this.parent.closestContainingUri;
|
|
151
|
-
}
|
|
152
|
-
return undefined;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Finds a node by ID.
|
|
157
|
-
* The default algorithm tries to be economic and only create the necessary
|
|
158
|
-
* intermediate nodes.
|
|
159
|
-
* Subclasses can override this to add further optimizations.
|
|
160
|
-
* @param id
|
|
161
|
-
*/
|
|
162
|
-
async findNode(id) {
|
|
163
|
-
id = (0, _URL.URL_file)(id);
|
|
164
|
-
if (this.id === id) {
|
|
165
|
-
return this;
|
|
166
|
-
}
|
|
167
|
-
if ((0, _startsWith.default)(id).call(id, this.id)) {
|
|
168
|
-
for (const c of await this._children()) {
|
|
169
|
-
// depth first search by default
|
|
170
|
-
const cc = await c.findNode(id);
|
|
171
|
-
if (cc) {
|
|
172
|
-
return cc;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
return undefined;
|
|
177
|
-
}
|
|
178
|
-
}, (0, _applyDecoratedDescriptor2.default)(_class.prototype, "host", [_dec], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "host"), _class.prototype), (0, _applyDecoratedDescriptor2.default)(_class.prototype, "_children", [_dec2], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "_children"), _class.prototype), (0, _applyDecoratedDescriptor2.default)(_class.prototype, "_diagnostics", [_dec3], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "_diagnostics"), _class.prototype), (0, _applyDecoratedDescriptor2.default)(_class.prototype, "_ideInfo", [_dec4], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "_ideInfo"), _class.prototype), (0, _applyDecoratedDescriptor2.default)(_class.prototype, "collectIDEInfo", [_dec5], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "collectIDEInfo"), _class.prototype), (0, _applyDecoratedDescriptor2.default)(_class.prototype, "collectDiagnostics", [_dec6], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "collectDiagnostics"), _class.prototype), (0, _applyDecoratedDescriptor2.default)(_class.prototype, "closestContainingUri", [_dec7], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "closestContainingUri"), _class.prototype), (0, _applyDecoratedDescriptor2.default)(_class.prototype, "findNode", [_dec8], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "findNode"), _class.prototype), _class);
|
|
179
|
-
let FileNode = exports.FileNode = (_dec9 = (0, _decorators.lazy)(), _dec0 = (0, _decorators.lazy)(), _dec1 = (0, _decorators.lazy)(), _dec10 = (0, _decorators.lazy)(), _dec11 = (0, _decorators.lazy)(), _dec12 = (0, _decorators.lazy)(), _dec13 = (0, _decorators.lazy)(), _class2 = class FileNode extends BaseNode {
|
|
180
|
-
get uri() {
|
|
181
|
-
return (0, _URL.URL_file)(this.filePath);
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* the ID of a FileNode is its file:// uri.
|
|
185
|
-
*/
|
|
186
|
-
get id() {
|
|
187
|
-
return this.uri;
|
|
188
|
-
}
|
|
189
|
-
get text() {
|
|
190
|
-
return this.host.readFileSync(this.filePath);
|
|
191
|
-
}
|
|
192
|
-
get fileExists() {
|
|
193
|
-
return this.host.existsSync(this.filePath);
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* parsed ts-morph source file
|
|
197
|
-
*/
|
|
198
|
-
get sf() {
|
|
199
|
-
if (typeof this.text === 'undefined') {
|
|
200
|
-
throw new Error('undefined file ' + this.filePath);
|
|
201
|
-
}
|
|
202
|
-
return (0, _tsMorph.createTSMSourceFile_cached)(this.filePath, this.text);
|
|
203
|
-
}
|
|
204
|
-
get basenameNoExt() {
|
|
205
|
-
return (0, _path2.basenameNoExt)(this.filePath);
|
|
206
|
-
}
|
|
207
|
-
get basename() {
|
|
208
|
-
return (0, _path.basename)(this.filePath);
|
|
209
|
-
}
|
|
210
|
-
}, (0, _applyDecoratedDescriptor2.default)(_class2.prototype, "uri", [_dec9], (0, _getOwnPropertyDescriptor.default)(_class2.prototype, "uri"), _class2.prototype), (0, _applyDecoratedDescriptor2.default)(_class2.prototype, "id", [_dec0], (0, _getOwnPropertyDescriptor.default)(_class2.prototype, "id"), _class2.prototype), (0, _applyDecoratedDescriptor2.default)(_class2.prototype, "text", [_dec1], (0, _getOwnPropertyDescriptor.default)(_class2.prototype, "text"), _class2.prototype), (0, _applyDecoratedDescriptor2.default)(_class2.prototype, "fileExists", [_dec10], (0, _getOwnPropertyDescriptor.default)(_class2.prototype, "fileExists"), _class2.prototype), (0, _applyDecoratedDescriptor2.default)(_class2.prototype, "sf", [_dec11], (0, _getOwnPropertyDescriptor.default)(_class2.prototype, "sf"), _class2.prototype), (0, _applyDecoratedDescriptor2.default)(_class2.prototype, "basenameNoExt", [_dec12], (0, _getOwnPropertyDescriptor.default)(_class2.prototype, "basenameNoExt"), _class2.prototype), (0, _applyDecoratedDescriptor2.default)(_class2.prototype, "basename", [_dec13], (0, _getOwnPropertyDescriptor.default)(_class2.prototype, "basename"), _class2.prototype), _class2);
|
|
211
|
-
class HostWithDocumentsStore {
|
|
212
|
-
constructor(documents) {
|
|
213
|
-
this.defaultHost = new _hosts.DefaultHost();
|
|
214
|
-
this.documents = documents;
|
|
215
|
-
}
|
|
216
|
-
readFileSync(path) {
|
|
217
|
-
const uri = (0, _URL.URL_file)(path);
|
|
218
|
-
const doc = this.documents.get(uri);
|
|
219
|
-
if (doc) {
|
|
220
|
-
return doc.getText();
|
|
221
|
-
}
|
|
222
|
-
return this.defaultHost.readFileSync(path);
|
|
223
|
-
}
|
|
224
|
-
existsSync(path) {
|
|
225
|
-
return this.defaultHost.existsSync(path);
|
|
226
|
-
}
|
|
227
|
-
readdirSync(path) {
|
|
228
|
-
return this.defaultHost.readdirSync(path);
|
|
229
|
-
}
|
|
230
|
-
globSync(pattern) {
|
|
231
|
-
return this.defaultHost.globSync(pattern);
|
|
232
|
-
}
|
|
233
|
-
writeFileSync(path, contents) {
|
|
234
|
-
return this.defaultHost.writeFileSync(path, contents);
|
|
235
|
-
}
|
|
236
|
-
get paths() {
|
|
237
|
-
return this.defaultHost.paths;
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
exports.HostWithDocumentsStore = HostWithDocumentsStore;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import yargs_parser from 'yargs-parser';
|
|
2
|
-
/**
|
|
3
|
-
* A value class wrapping a Redwood command string.
|
|
4
|
-
* - perform basic validation on construction
|
|
5
|
-
* - used throughout the package to representa a command (instead of using 'string')
|
|
6
|
-
*/
|
|
7
|
-
export declare class RedwoodCommandString {
|
|
8
|
-
original: string;
|
|
9
|
-
isComplete: boolean;
|
|
10
|
-
/**
|
|
11
|
-
* this is what we can pass down to the actual CLI
|
|
12
|
-
* it doesn't include "yarn redwood"
|
|
13
|
-
* ex: "generate page Foo /foo"
|
|
14
|
-
*/
|
|
15
|
-
processed: string;
|
|
16
|
-
constructor(original: string);
|
|
17
|
-
get parsed(): yargs_parser.Arguments;
|
|
18
|
-
get isInterceptable(): boolean;
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=RedwoodCommandString.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RedwoodCommandString.d.ts","sourceRoot":"","sources":["../../src/interactive_cli/RedwoodCommandString.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,cAAc,CAAA;AAIvC;;;;GAIG;AACH,qBAAa,oBAAoB;IASZ,QAAQ,EAAE,MAAM;IARnC,UAAU,UAAO;IAEjB;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAA;gBACE,QAAQ,EAAE,MAAM;IA0BnC,IAAY,MAAM,2BAEjB;IAED,IAAY,eAAe,YAgB1B;CACF"}
|
|
@@ -1,72 +0,0 @@
|
|
|
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.RedwoodCommandString = void 0;
|
|
9
|
-
var _endsWith = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/ends-with"));
|
|
10
|
-
var _trim = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/trim"));
|
|
11
|
-
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/map"));
|
|
12
|
-
var _getOwnPropertyDescriptor = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/object/get-own-property-descriptor"));
|
|
13
|
-
var _applyDecoratedDescriptor2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/applyDecoratedDescriptor"));
|
|
14
|
-
var _yargsParser = _interopRequireDefault(require("yargs-parser"));
|
|
15
|
-
var _decorators = require("../x/decorators");
|
|
16
|
-
var _dec, _dec2, _class;
|
|
17
|
-
/**
|
|
18
|
-
* A value class wrapping a Redwood command string.
|
|
19
|
-
* - perform basic validation on construction
|
|
20
|
-
* - used throughout the package to representa a command (instead of using 'string')
|
|
21
|
-
*/
|
|
22
|
-
let RedwoodCommandString = exports.RedwoodCommandString = (_dec = (0, _decorators.lazy)(), _dec2 = (0, _decorators.lazy)(), _class = class RedwoodCommandString {
|
|
23
|
-
constructor(original) {
|
|
24
|
-
var _context, _context2;
|
|
25
|
-
this.isComplete = true;
|
|
26
|
-
/**
|
|
27
|
-
* this is what we can pass down to the actual CLI
|
|
28
|
-
* it doesn't include "yarn redwood"
|
|
29
|
-
* ex: "generate page Foo /foo"
|
|
30
|
-
*/
|
|
31
|
-
this.processed = void 0;
|
|
32
|
-
this.original = original;
|
|
33
|
-
let v = original;
|
|
34
|
-
if (typeof v !== 'string') {
|
|
35
|
-
throw new Error('redwood command must be a string');
|
|
36
|
-
}
|
|
37
|
-
if ((0, _endsWith.default)(_context = (0, _trim.default)(v).call(v)).call(_context, '...')) {
|
|
38
|
-
this.isComplete = false;
|
|
39
|
-
const pp = v.split('...');
|
|
40
|
-
pp.pop();
|
|
41
|
-
v = pp.join('');
|
|
42
|
-
}
|
|
43
|
-
const parts = (0, _map.default)(_context2 = (0, _trim.default)(v).call(v).split(' ')).call(_context2, s => (0, _trim.default)(s).call(s));
|
|
44
|
-
if (parts[0] === 'yarn') {
|
|
45
|
-
parts.shift();
|
|
46
|
-
}
|
|
47
|
-
if (parts[0] === 'redwood' || parts[0] === 'rw') {
|
|
48
|
-
parts.shift();
|
|
49
|
-
}
|
|
50
|
-
this.processed = parts.join(' ');
|
|
51
|
-
}
|
|
52
|
-
get parsed() {
|
|
53
|
-
return (0, _yargsParser.default)(this.processed);
|
|
54
|
-
}
|
|
55
|
-
get isInterceptable() {
|
|
56
|
-
let a = this.parsed._[0];
|
|
57
|
-
const b = this.parsed._[1];
|
|
58
|
-
if (a === 'g') {
|
|
59
|
-
a = 'generate';
|
|
60
|
-
}
|
|
61
|
-
if (a !== 'generate') {
|
|
62
|
-
return false;
|
|
63
|
-
}
|
|
64
|
-
if (b === 'sdl') {
|
|
65
|
-
return false;
|
|
66
|
-
} // <-- why?
|
|
67
|
-
if (b === 'scaffold') {
|
|
68
|
-
return false;
|
|
69
|
-
} // <-- why?
|
|
70
|
-
return true;
|
|
71
|
-
}
|
|
72
|
-
}, (0, _applyDecoratedDescriptor2.default)(_class.prototype, "parsed", [_dec], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "parsed"), _class.prototype), (0, _applyDecoratedDescriptor2.default)(_class.prototype, "isInterceptable", [_dec2], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "isInterceptable"), _class.prototype), _class);
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { RWProject } from '../model/RWProject';
|
|
2
|
-
import { RedwoodCommandString } from './RedwoodCommandString';
|
|
3
|
-
import type { UI } from './ui';
|
|
4
|
-
export interface Opts {
|
|
5
|
-
cmd: RedwoodCommandString;
|
|
6
|
-
project: RWProject;
|
|
7
|
-
ui: UI;
|
|
8
|
-
}
|
|
9
|
-
export declare function command_builder(opts: Opts): Promise<RedwoodCommandString | undefined>;
|
|
10
|
-
//# sourceMappingURL=command_builder.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"command_builder.d.ts","sourceRoot":"","sources":["../../src/interactive_cli/command_builder.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAInD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,MAAM,CAAA;AAE9B,MAAM,WAAW,IAAI;IACnB,GAAG,EAAE,oBAAoB,CAAA;IACzB,OAAO,EAAE,SAAS,CAAA;IAClB,EAAE,EAAE,EAAE,CAAA;CACP;AAED,wBAAgB,eAAe,CAC7B,IAAI,EAAE,IAAI,GACT,OAAO,CAAC,oBAAoB,GAAG,SAAS,CAAC,CAE3C"}
|