@cedarjs/structure 0.0.4
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/LICENSE +21 -0
- package/README.md +145 -0
- package/dist/errors.d.ts +11 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +19 -0
- package/dist/hosts.d.ts +23 -0
- package/dist/hosts.d.ts.map +1 -0
- package/dist/hosts.js +45 -0
- package/dist/ide.d.ts +122 -0
- package/dist/ide.d.ts.map +1 -0
- package/dist/ide.js +240 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +79 -0
- package/dist/interactive_cli/RedwoodCommandString.d.ts +20 -0
- package/dist/interactive_cli/RedwoodCommandString.d.ts.map +1 -0
- package/dist/interactive_cli/RedwoodCommandString.js +72 -0
- package/dist/interactive_cli/command_builder.d.ts +10 -0
- package/dist/interactive_cli/command_builder.d.ts.map +1 -0
- package/dist/interactive_cli/command_builder.js +196 -0
- package/dist/interactive_cli/dry_run.d.ts +28 -0
- package/dist/interactive_cli/dry_run.d.ts.map +1 -0
- package/dist/interactive_cli/dry_run.js +101 -0
- package/dist/interactive_cli/ui.d.ts +32 -0
- package/dist/interactive_cli/ui.d.ts.map +1 -0
- package/dist/interactive_cli/ui.js +84 -0
- package/dist/language_server/RWLanguageServer.d.ts +30 -0
- package/dist/language_server/RWLanguageServer.d.ts.map +1 -0
- package/dist/language_server/RWLanguageServer.js +201 -0
- package/dist/language_server/commands.d.ts +14 -0
- package/dist/language_server/commands.d.ts.map +1 -0
- package/dist/language_server/commands.js +122 -0
- package/dist/language_server/diagnostics.d.ts +10 -0
- package/dist/language_server/diagnostics.d.ts.map +1 -0
- package/dist/language_server/diagnostics.js +61 -0
- package/dist/language_server/outline.d.ts +7 -0
- package/dist/language_server/outline.d.ts.map +1 -0
- package/dist/language_server/outline.js +37 -0
- package/dist/language_server/start.d.ts +2 -0
- package/dist/language_server/start.d.ts.map +1 -0
- package/dist/language_server/start.js +4 -0
- package/dist/language_server/xmethods.d.ts +11 -0
- package/dist/language_server/xmethods.d.ts.map +1 -0
- package/dist/language_server/xmethods.js +42 -0
- package/dist/model/RWCell.d.ts +22 -0
- package/dist/model/RWCell.d.ts.map +1 -0
- package/dist/model/RWCell.js +111 -0
- package/dist/model/RWComponent.d.ts +11 -0
- package/dist/model/RWComponent.d.ts.map +1 -0
- package/dist/model/RWComponent.js +42 -0
- package/dist/model/RWEnvHelper.d.ts +64 -0
- package/dist/model/RWEnvHelper.d.ts.map +1 -0
- package/dist/model/RWEnvHelper.js +295 -0
- package/dist/model/RWFunction.d.ts +11 -0
- package/dist/model/RWFunction.d.ts.map +1 -0
- package/dist/model/RWFunction.js +19 -0
- package/dist/model/RWLayout.d.ts +11 -0
- package/dist/model/RWLayout.d.ts.map +1 -0
- package/dist/model/RWLayout.js +19 -0
- package/dist/model/RWPage.d.ts +13 -0
- package/dist/model/RWPage.d.ts.map +1 -0
- package/dist/model/RWPage.js +60 -0
- package/dist/model/RWProject.d.ts +61 -0
- package/dist/model/RWProject.d.ts.map +1 -0
- package/dist/model/RWProject.js +170 -0
- package/dist/model/RWRoute.d.ts +58 -0
- package/dist/model/RWRoute.d.ts.map +1 -0
- package/dist/model/RWRoute.js +416 -0
- package/dist/model/RWRouter.d.ts +30 -0
- package/dist/model/RWRouter.d.ts.map +1 -0
- package/dist/model/RWRouter.js +186 -0
- package/dist/model/RWSDL.d.ts +21 -0
- package/dist/model/RWSDL.d.ts.map +1 -0
- package/dist/model/RWSDL.js +89 -0
- package/dist/model/RWSDLField.d.ts +31 -0
- package/dist/model/RWSDLField.d.ts.map +1 -0
- package/dist/model/RWSDLField.js +132 -0
- package/dist/model/RWService.d.ts +26 -0
- package/dist/model/RWService.d.ts.map +1 -0
- package/dist/model/RWService.js +76 -0
- package/dist/model/RWServiceFunction.d.ts +20 -0
- package/dist/model/RWServiceFunction.d.ts.map +1 -0
- package/dist/model/RWServiceFunction.js +100 -0
- package/dist/model/RWTOML.d.ts +12 -0
- package/dist/model/RWTOML.d.ts.map +1 -0
- package/dist/model/RWTOML.js +56 -0
- package/dist/model/index.d.ts +2 -0
- package/dist/model/index.d.ts.map +1 -0
- package/dist/model/index.js +13 -0
- package/dist/model/util/advanced_path_parser.d.ts +12 -0
- package/dist/model/util/advanced_path_parser.d.ts.map +1 -0
- package/dist/model/util/advanced_path_parser.js +38 -0
- package/dist/model/util/process_env.d.ts +23 -0
- package/dist/model/util/process_env.d.ts.map +1 -0
- package/dist/model/util/process_env.js +76 -0
- package/dist/outline/index.d.ts +3 -0
- package/dist/outline/index.d.ts.map +1 -0
- package/dist/outline/index.js +31 -0
- package/dist/outline/outline.d.ts +4 -0
- package/dist/outline/outline.d.ts.map +1 -0
- package/dist/outline/outline.js +260 -0
- package/dist/outline/types.d.ts +88 -0
- package/dist/outline/types.d.ts.map +1 -0
- package/dist/outline/types.js +73 -0
- package/dist/util.d.ts +2 -0
- package/dist/util.d.ts.map +1 -0
- package/dist/util.js +34 -0
- package/dist/x/Array.d.ts +4 -0
- package/dist/x/Array.d.ts.map +1 -0
- package/dist/x/Array.js +26 -0
- package/dist/x/URL.d.ts +15 -0
- package/dist/x/URL.d.ts.map +1 -0
- package/dist/x/URL.js +99 -0
- package/dist/x/child_process.d.ts +15 -0
- package/dist/x/child_process.d.ts.map +1 -0
- package/dist/x/child_process.js +51 -0
- package/dist/x/decorators.d.ts +3 -0
- package/dist/x/decorators.d.ts.map +1 -0
- package/dist/x/decorators.js +26 -0
- package/dist/x/path.d.ts +6 -0
- package/dist/x/path.d.ts.map +1 -0
- package/dist/x/path.js +53 -0
- package/dist/x/prisma.d.ts +19 -0
- package/dist/x/prisma.d.ts.map +1 -0
- package/dist/x/prisma.js +65 -0
- package/dist/x/ts-morph.d.ts +10 -0
- package/dist/x/ts-morph.d.ts.map +1 -0
- package/dist/x/ts-morph.js +56 -0
- package/dist/x/vscode-languageserver-types.d.ts +93 -0
- package/dist/x/vscode-languageserver-types.d.ts.map +1 -0
- package/dist/x/vscode-languageserver-types.js +421 -0
- package/dist/x/vscode-languageserver.d.ts +12 -0
- package/dist/x/vscode-languageserver.d.ts.map +1 -0
- package/dist/x/vscode-languageserver.js +61 -0
- package/dist/x/vscode.d.ts +126 -0
- package/dist/x/vscode.d.ts.map +1 -0
- package/dist/x/vscode.js +294 -0
- package/package.json +67 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as tsm from 'ts-morph';
|
|
2
|
+
export declare function process_env_findAll(dir: string): ({
|
|
3
|
+
key: string;
|
|
4
|
+
node: tsm.PropertyAccessExpression<tsm.ts.PropertyAccessExpression>;
|
|
5
|
+
} | {
|
|
6
|
+
key: string;
|
|
7
|
+
node: tsm.ElementAccessExpression<tsm.ts.ElementAccessExpression>;
|
|
8
|
+
})[];
|
|
9
|
+
export declare function process_env_findInFile(filePath: string, text: string): ({
|
|
10
|
+
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
|
+
})[];
|
|
23
|
+
//# sourceMappingURL=process_env.d.ts.map
|
|
@@ -0,0 +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;;;;;;KAQ9C;AAED,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;;;;;;KASpE;AAED,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,GAAG,CAAC,UAAU;;;;;;KAwBzD"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js/object/define-property");
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime-corejs3/helpers/interopRequireWildcard").default;
|
|
5
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
|
|
6
|
+
_Object$defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
exports.process_env_findAll = process_env_findAll;
|
|
10
|
+
exports.process_env_findInFile = process_env_findInFile;
|
|
11
|
+
exports.process_env_findInFile2 = process_env_findInFile2;
|
|
12
|
+
var _replaceAll = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/replace-all"));
|
|
13
|
+
var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/includes"));
|
|
14
|
+
var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/filter"));
|
|
15
|
+
var _path = require("path");
|
|
16
|
+
var _fastGlob = _interopRequireDefault(require("fast-glob"));
|
|
17
|
+
var _fsExtra = require("fs-extra");
|
|
18
|
+
var tsm = _interopRequireWildcard(require("ts-morph"));
|
|
19
|
+
var _Array = require("../../x/Array");
|
|
20
|
+
var _tsMorph2 = require("../../x/ts-morph");
|
|
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 = (0, _path.join)(dir, 'src/**/*.{js,ts,jsx,tsx}')).call(_context, '\\', '/');
|
|
26
|
+
for (const file of _fastGlob.default.sync(globPath)) {
|
|
27
|
+
yield* process_env_findInFile(file, (0, _fsExtra.readFileSync)(file).toString());
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
function process_env_findInFile(filePath, text) {
|
|
32
|
+
if (!(0, _includes.default)(text).call(text, 'process.env')) {
|
|
33
|
+
return [];
|
|
34
|
+
}
|
|
35
|
+
try {
|
|
36
|
+
return process_env_findInFile2((0, _tsMorph2.createTSMSourceFile_cached)(filePath, text));
|
|
37
|
+
} catch {
|
|
38
|
+
return [];
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function process_env_findInFile2(sf) {
|
|
42
|
+
var _context2;
|
|
43
|
+
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 {
|
|
64
|
+
key: arg.getLiteralText(),
|
|
65
|
+
node
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
function is_process_env(n) {
|
|
72
|
+
if (!tsm.Node.isPropertyAccessExpression(n)) {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
return n.getExpression().getText() === 'process' && n.getName() === 'env';
|
|
76
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/outline/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,WAAW,CAAA"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _context, _context2;
|
|
4
|
+
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js/object/define-property");
|
|
5
|
+
var _forEachInstanceProperty = require("@babel/runtime-corejs3/core-js/instance/for-each");
|
|
6
|
+
var _Object$keys = require("@babel/runtime-corejs3/core-js/object/keys");
|
|
7
|
+
_Object$defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
var _types = require("./types");
|
|
11
|
+
_forEachInstanceProperty(_context = _Object$keys(_types)).call(_context, function (key) {
|
|
12
|
+
if (key === "default" || key === "__esModule") return;
|
|
13
|
+
if (key in exports && exports[key] === _types[key]) return;
|
|
14
|
+
_Object$defineProperty(exports, key, {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () {
|
|
17
|
+
return _types[key];
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
var _outline = require("./outline");
|
|
22
|
+
_forEachInstanceProperty(_context2 = _Object$keys(_outline)).call(_context2, function (key) {
|
|
23
|
+
if (key === "default" || key === "__esModule") return;
|
|
24
|
+
if (key in exports && exports[key] === _outline[key]) return;
|
|
25
|
+
_Object$defineProperty(exports, key, {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () {
|
|
28
|
+
return _outline[key];
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outline.d.ts","sourceRoot":"","sources":["../../src/outline/outline.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAIzC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAG5C,wBAAgB,UAAU,CAAC,OAAO,EAAE,SAAS,GAAG,SAAS,CA0DxD"}
|
|
@@ -0,0 +1,260 @@
|
|
|
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.getOutline = getOutline;
|
|
9
|
+
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/map"));
|
|
10
|
+
var _URL = require("../x/URL");
|
|
11
|
+
var _vscode = require("../x/vscode");
|
|
12
|
+
function getOutline(project) {
|
|
13
|
+
return {
|
|
14
|
+
children: () => [_router(project), _pages(project), _components(project), _layouts(project), _cells(project), _services(project), _functions(project), _schema(project), {
|
|
15
|
+
label: 'redwood.toml',
|
|
16
|
+
iconPath: 'x-redwood',
|
|
17
|
+
...resourceUriAndCommandFor((0, _URL.URL_file)(project.pathHelper.base, 'redwood.toml')),
|
|
18
|
+
menu: {
|
|
19
|
+
kind: 'withDoc',
|
|
20
|
+
doc: (0, _vscode.Command_open)('https://redwoodjs.com/docs/app-configuration-redwood-toml')
|
|
21
|
+
}
|
|
22
|
+
}, {
|
|
23
|
+
label: 'open graphql playground',
|
|
24
|
+
command: (0, _vscode.Command_open)('http://localhost:8911/graphql'),
|
|
25
|
+
iconPath: 'x-graphql',
|
|
26
|
+
menu: {
|
|
27
|
+
kind: 'withDoc',
|
|
28
|
+
doc: (0, _vscode.Command_open)('https://www.apollographql.com/docs/apollo-server/testing/graphql-playground/')
|
|
29
|
+
}
|
|
30
|
+
}, {
|
|
31
|
+
label: 'open storybook',
|
|
32
|
+
command: (0, _vscode.Command_cli)('rw storybook --open'),
|
|
33
|
+
iconPath: 'x-storybook',
|
|
34
|
+
menu: {
|
|
35
|
+
kind: 'withDoc',
|
|
36
|
+
doc: (0, _vscode.Command_open)('https://redwoodjs.com/how-to/mocking-graph-ql-in-storybook')
|
|
37
|
+
}
|
|
38
|
+
}, _rwcli_command_group({
|
|
39
|
+
cmd: 'generate ...',
|
|
40
|
+
tooltip: 'start interactive redwood generator'
|
|
41
|
+
}, {
|
|
42
|
+
cmd: 'dev',
|
|
43
|
+
tooltip: 'start development server and open browser'
|
|
44
|
+
})]
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function _router(project) {
|
|
48
|
+
const {
|
|
49
|
+
router
|
|
50
|
+
} = project;
|
|
51
|
+
return {
|
|
52
|
+
label: 'Routes.js',
|
|
53
|
+
...resourceUriAndCommandFor(router.uri),
|
|
54
|
+
iconPath: 'globe',
|
|
55
|
+
children: () => {
|
|
56
|
+
var _context;
|
|
57
|
+
return (0, _map.default)(_context = router.routes).call(_context, _router_route);
|
|
58
|
+
},
|
|
59
|
+
menu: {
|
|
60
|
+
kind: 'group',
|
|
61
|
+
add: (0, _vscode.Command_cli)('rw generate page ...'),
|
|
62
|
+
doc: (0, _vscode.Command_open)('https://redwoodjs.com/docs/redwood-router')
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
function _router_route(route) {
|
|
67
|
+
return {
|
|
68
|
+
label: route.outlineLabel,
|
|
69
|
+
description: route.outlineDescription,
|
|
70
|
+
command: (0, _vscode.Command_open)(route.location),
|
|
71
|
+
iconPath: route.isPrivate ? 'gist-secret' : 'gist',
|
|
72
|
+
menu: {
|
|
73
|
+
kind: 'route',
|
|
74
|
+
openComponent: route.page ? (0, _vscode.Command_open)(route.page.uri) : undefined,
|
|
75
|
+
openRoute: (0, _vscode.Command_open)(route.location),
|
|
76
|
+
openInBrowser: (0, _vscode.Command_cli)(`rw dev --open='${route.path}'`)
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
function _pages(project) {
|
|
81
|
+
return {
|
|
82
|
+
label: 'pages',
|
|
83
|
+
iconPath: 'globe',
|
|
84
|
+
children: () => {
|
|
85
|
+
var _context2;
|
|
86
|
+
return (0, _map.default)(_context2 = project.pages).call(_context2, _pages_page);
|
|
87
|
+
},
|
|
88
|
+
menu: {
|
|
89
|
+
kind: 'group',
|
|
90
|
+
add: (0, _vscode.Command_cli)('rw generate page ...'),
|
|
91
|
+
doc: (0, _vscode.Command_open)('https://redwoodjs.com/docs/tutorial/chapter1/first-page')
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
function _pages_page(page) {
|
|
96
|
+
return {
|
|
97
|
+
id: page.id,
|
|
98
|
+
label: page.basename,
|
|
99
|
+
...resourceUriAndCommandFor(page.uri),
|
|
100
|
+
description: page.route?.path,
|
|
101
|
+
children: () => [_rwcli_command_group({
|
|
102
|
+
cmd: 'rw destroy page ' + page.basenameNoExt,
|
|
103
|
+
tooltip: 'Delete page and related files'
|
|
104
|
+
})]
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
function _components(project) {
|
|
108
|
+
return {
|
|
109
|
+
label: 'components',
|
|
110
|
+
iconPath: 'extensions',
|
|
111
|
+
children: () => fromFiles(project.components),
|
|
112
|
+
menu: {
|
|
113
|
+
kind: 'group',
|
|
114
|
+
add: (0, _vscode.Command_cli)('rw generate component ...'),
|
|
115
|
+
doc: (0, _vscode.Command_open)('https://redwoodjs.com/docs/cli-commands.html#component')
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
function _layouts(project) {
|
|
120
|
+
return {
|
|
121
|
+
label: 'layouts',
|
|
122
|
+
iconPath: 'preview',
|
|
123
|
+
children: () => fromFiles(project.layouts),
|
|
124
|
+
menu: {
|
|
125
|
+
kind: 'group',
|
|
126
|
+
add: (0, _vscode.Command_cli)('rw generate layout ...'),
|
|
127
|
+
doc: (0, _vscode.Command_open)('https://redwoodjs.com/docs/tutorial/chapter1/layouts')
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
function _cells(project) {
|
|
132
|
+
return {
|
|
133
|
+
label: 'cells',
|
|
134
|
+
iconPath: 'circuit-board',
|
|
135
|
+
children: () => fromFiles(project.cells),
|
|
136
|
+
menu: {
|
|
137
|
+
kind: 'group',
|
|
138
|
+
add: (0, _vscode.Command_cli)('rw generate cell ...'),
|
|
139
|
+
doc: (0, _vscode.Command_open)('https://redwoodjs.com/docs/tutorial/chapter2/cells')
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
function _services(project) {
|
|
144
|
+
return {
|
|
145
|
+
label: 'services',
|
|
146
|
+
iconPath: 'server',
|
|
147
|
+
children: () => fromFiles(project.services),
|
|
148
|
+
menu: {
|
|
149
|
+
kind: 'group',
|
|
150
|
+
add: (0, _vscode.Command_cli)('rw generate service ...'),
|
|
151
|
+
doc: (0, _vscode.Command_open)('https://redwoodjs.com/docs/cli-commands.html#service')
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
function _functions(project) {
|
|
156
|
+
return {
|
|
157
|
+
label: 'functions',
|
|
158
|
+
iconPath: 'server-process',
|
|
159
|
+
// TODO: link to published function
|
|
160
|
+
// http://localhost:8911/graphql
|
|
161
|
+
children: () => fromFiles(project.functions),
|
|
162
|
+
menu: {
|
|
163
|
+
kind: 'group',
|
|
164
|
+
add: (0, _vscode.Command_cli)('rw generate function ...'),
|
|
165
|
+
doc: (0, _vscode.Command_open)('https://redwoodjs.com/docs/serverless-functions')
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
function _schema(project) {
|
|
170
|
+
return {
|
|
171
|
+
label: 'schema.prisma',
|
|
172
|
+
iconPath: 'x-prisma',
|
|
173
|
+
menu: {
|
|
174
|
+
kind: 'withDoc',
|
|
175
|
+
doc: (0, _vscode.Command_open)('https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-schema')
|
|
176
|
+
},
|
|
177
|
+
...resourceUriAndCommandFor(project.pathHelper.api.dbSchema),
|
|
178
|
+
async children() {
|
|
179
|
+
var _context3;
|
|
180
|
+
const dmmf = await project.prismaDMMF();
|
|
181
|
+
if (!dmmf) {
|
|
182
|
+
return [];
|
|
183
|
+
}
|
|
184
|
+
const models = (0, _map.default)(_context3 = dmmf.datamodel.models).call(_context3, model => {
|
|
185
|
+
return {
|
|
186
|
+
label: model.name,
|
|
187
|
+
iconPath: 'database',
|
|
188
|
+
// TODO: location for models and fields
|
|
189
|
+
children() {
|
|
190
|
+
var _context4;
|
|
191
|
+
const fields = (0, _map.default)(_context4 = model.fields).call(_context4, f => ({
|
|
192
|
+
label: f.name,
|
|
193
|
+
iconPath: 'symbol-field',
|
|
194
|
+
description: `${f.type}`
|
|
195
|
+
}));
|
|
196
|
+
const commands = _rwcli_command_group({
|
|
197
|
+
tooltip: 'create graphql interface to access this model',
|
|
198
|
+
cmd: `generate sdl ${model.name}`
|
|
199
|
+
}, {
|
|
200
|
+
cmd: `generate scaffold ${model.name}`,
|
|
201
|
+
tooltip: 'generate pages, SDL, and a services object for this model'
|
|
202
|
+
});
|
|
203
|
+
return [...fields, commands];
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
});
|
|
207
|
+
const commands = _rwcli_command_group({
|
|
208
|
+
cmd: 'db save',
|
|
209
|
+
tooltip: 'save migration file with new changes'
|
|
210
|
+
}, {
|
|
211
|
+
cmd: 'db up',
|
|
212
|
+
tooltip: 'apply migrations'
|
|
213
|
+
});
|
|
214
|
+
return [...models, commands];
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
function _rwcli_command_group(...opts) {
|
|
219
|
+
return {
|
|
220
|
+
label: 'rw cli',
|
|
221
|
+
key: 'rw-cli-commands',
|
|
222
|
+
tooltip: 'Redwood.js CLI commands',
|
|
223
|
+
iconPath: 'terminal',
|
|
224
|
+
children: () => (0, _map.default)(opts).call(opts, _rwcli_command),
|
|
225
|
+
menu: {
|
|
226
|
+
kind: 'withDoc',
|
|
227
|
+
doc: (0, _vscode.Command_open)('https://redwoodjs.com/docs/cli-commands')
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
function _rwcli_command(opts) {
|
|
232
|
+
const {
|
|
233
|
+
cmd,
|
|
234
|
+
tooltip
|
|
235
|
+
} = opts;
|
|
236
|
+
return {
|
|
237
|
+
label: cmd,
|
|
238
|
+
tooltip,
|
|
239
|
+
menu: {
|
|
240
|
+
kind: 'cli',
|
|
241
|
+
run: (0, _vscode.Command_cli)(cmd)
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
function fromFiles(fileNodes) {
|
|
246
|
+
return (0, _map.default)(fileNodes).call(fileNodes, fromFile);
|
|
247
|
+
}
|
|
248
|
+
function fromFile(fileNode) {
|
|
249
|
+
return {
|
|
250
|
+
label: fileNode.basename,
|
|
251
|
+
...resourceUriAndCommandFor(fileNode.uri)
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
function resourceUriAndCommandFor(uri) {
|
|
255
|
+
uri = (0, _URL.URL_file)(uri);
|
|
256
|
+
return {
|
|
257
|
+
resourceUri: uri,
|
|
258
|
+
command: (0, _vscode.Command_open)(uri)
|
|
259
|
+
};
|
|
260
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
export declare enum Icon {
|
|
2
|
+
redwood = "redwood",
|
|
3
|
+
page = "page",
|
|
4
|
+
page_private = "page_private",
|
|
5
|
+
pages = "pages",
|
|
6
|
+
layouts = "layouts",
|
|
7
|
+
netlify = "netlify",
|
|
8
|
+
prisma = "prisma",
|
|
9
|
+
storybook = "storybook",
|
|
10
|
+
services = "services",
|
|
11
|
+
graphql = "graphql",
|
|
12
|
+
play = "play",
|
|
13
|
+
components = "components",
|
|
14
|
+
rw_cli = "rw_cli",
|
|
15
|
+
functions = "functions",
|
|
16
|
+
cells = "cells",
|
|
17
|
+
model = "model"
|
|
18
|
+
}
|
|
19
|
+
export interface OutlineItem {
|
|
20
|
+
/**
|
|
21
|
+
* Label for the outline item.
|
|
22
|
+
* This is the main text.
|
|
23
|
+
*/
|
|
24
|
+
label: string;
|
|
25
|
+
/**
|
|
26
|
+
* If label is not unique amongst siblings, key is used to disambiguate.
|
|
27
|
+
* This is similar to ReactNode.key
|
|
28
|
+
*/
|
|
29
|
+
key?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Secondary text.
|
|
32
|
+
*/
|
|
33
|
+
description?: string;
|
|
34
|
+
tooltip?: string;
|
|
35
|
+
/**
|
|
36
|
+
* - If present, this item will be rendered as a folder (with an expand button).
|
|
37
|
+
* - If undefined, this item will be rendered as a leaf
|
|
38
|
+
*/
|
|
39
|
+
children?(): Promise<OutlineItem[]>;
|
|
40
|
+
/**
|
|
41
|
+
* Whether this outline item should be expanded by default.
|
|
42
|
+
* This is only relevant if children() is defined
|
|
43
|
+
*/
|
|
44
|
+
expanded?: boolean;
|
|
45
|
+
link?: OutlineLinkString;
|
|
46
|
+
/**
|
|
47
|
+
* link to documentation (URL, webpage)
|
|
48
|
+
*/
|
|
49
|
+
doc?: OutlineLinkString;
|
|
50
|
+
add?: OutlineLinkString;
|
|
51
|
+
icon?: Icon;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* A link/action to execute when an outline item is clicked.
|
|
55
|
+
* It can be:
|
|
56
|
+
* - a file URL (with optional position hash)
|
|
57
|
+
* - ex: "file:///somefile.ts"
|
|
58
|
+
* - ex: "file:///Users/foo/bar/project/myfile.js#3:10"
|
|
59
|
+
* - the editor will open and focus on this document when the item is selected
|
|
60
|
+
* - note: a "file://" URL can only be associalted to ONE item in the outline
|
|
61
|
+
* (so vscode can do a reverse search).
|
|
62
|
+
* - an HTTP URL
|
|
63
|
+
* - ex: "http://localhost:9999/foo/bar"
|
|
64
|
+
* - ex: "http://redwoodjs.com/"
|
|
65
|
+
* - the URL will open in the default browser when this item is selected
|
|
66
|
+
* - a redwood CLI action
|
|
67
|
+
* - ex: "rw generate page"
|
|
68
|
+
* - note: the string must start with "rw"
|
|
69
|
+
* - the command will be executed when this item is selected
|
|
70
|
+
* - an interactive redwood action
|
|
71
|
+
* - ex: "rw generate page..."
|
|
72
|
+
* - the string must start with end with "..." (this means interactive)
|
|
73
|
+
* - the interactive process will start when this item is selected
|
|
74
|
+
* - not all redwood commands are supported in interactive mode
|
|
75
|
+
* - see: https://github.com/cedarjs/cedar/tree/main/packages/structure/src/interactive_cli
|
|
76
|
+
*/
|
|
77
|
+
type OutlineLinkString = string;
|
|
78
|
+
export type OutlineItemJSON = Omit<OutlineItem, 'children'> & {
|
|
79
|
+
children?: OutlineItemJSON[];
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* this will recursively await all children and return a serializable representation
|
|
83
|
+
* of the complete outline
|
|
84
|
+
* @param item
|
|
85
|
+
*/
|
|
86
|
+
export declare function outlineToJSON(item: OutlineItem): Promise<OutlineItemJSON>;
|
|
87
|
+
export {};
|
|
88
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/outline/types.ts"],"names":[],"mappings":"AAAA,oBAAY,IAAI;IACd,OAAO,YAAY;IACnB,IAAI,SAAS;IACb,YAAY,iBAAiB;IAC7B,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,SAAS,cAAc;IACvB,QAAQ,aAAa;IACrB,OAAO,YAAY;IACnB,IAAI,SAAS;IACb,UAAU,eAAe;IACzB,MAAM,WAAW;IACjB,SAAS,cAAc;IACvB,KAAK,UAAU;IACf,KAAK,UAAU;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAA;IACb;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IAEpB,OAAO,CAAC,EAAE,MAAM,CAAA;IAEhB;;;OAGG;IACH,QAAQ,CAAC,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC,CAAA;IAEnC;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAElB,IAAI,CAAC,EAAE,iBAAiB,CAAA;IACxB;;OAEG;IACH,GAAG,CAAC,EAAE,iBAAiB,CAAA;IACvB,GAAG,CAAC,EAAE,iBAAiB,CAAA;IAEvB,IAAI,CAAC,EAAE,IAAI,CAAA;CACZ;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,KAAK,iBAAiB,GAAG,MAAM,CAAA;AAE/B,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,GAAG;IAC5D,QAAQ,CAAC,EAAE,eAAe,EAAE,CAAA;CAC7B,CAAA;AAED;;;;GAIG;AACH,wBAAsB,aAAa,CACjC,IAAI,EAAE,WAAW,GAChB,OAAO,CAAC,eAAe,CAAC,CAO1B"}
|
|
@@ -0,0 +1,73 @@
|
|
|
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.Icon = void 0;
|
|
9
|
+
exports.outlineToJSON = outlineToJSON;
|
|
10
|
+
var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/promise"));
|
|
11
|
+
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/map"));
|
|
12
|
+
let Icon = exports.Icon = /*#__PURE__*/function (Icon) {
|
|
13
|
+
Icon["redwood"] = "redwood";
|
|
14
|
+
Icon["page"] = "page";
|
|
15
|
+
Icon["page_private"] = "page_private";
|
|
16
|
+
Icon["pages"] = "pages";
|
|
17
|
+
Icon["layouts"] = "layouts";
|
|
18
|
+
Icon["netlify"] = "netlify";
|
|
19
|
+
Icon["prisma"] = "prisma";
|
|
20
|
+
Icon["storybook"] = "storybook";
|
|
21
|
+
Icon["services"] = "services";
|
|
22
|
+
Icon["graphql"] = "graphql";
|
|
23
|
+
Icon["play"] = "play";
|
|
24
|
+
Icon["components"] = "components";
|
|
25
|
+
Icon["rw_cli"] = "rw_cli";
|
|
26
|
+
Icon["functions"] = "functions";
|
|
27
|
+
Icon["cells"] = "cells";
|
|
28
|
+
Icon["model"] = "model";
|
|
29
|
+
return Icon;
|
|
30
|
+
}({});
|
|
31
|
+
/**
|
|
32
|
+
* A link/action to execute when an outline item is clicked.
|
|
33
|
+
* It can be:
|
|
34
|
+
* - a file URL (with optional position hash)
|
|
35
|
+
* - ex: "file:///somefile.ts"
|
|
36
|
+
* - ex: "file:///Users/foo/bar/project/myfile.js#3:10"
|
|
37
|
+
* - the editor will open and focus on this document when the item is selected
|
|
38
|
+
* - note: a "file://" URL can only be associalted to ONE item in the outline
|
|
39
|
+
* (so vscode can do a reverse search).
|
|
40
|
+
* - an HTTP URL
|
|
41
|
+
* - ex: "http://localhost:9999/foo/bar"
|
|
42
|
+
* - ex: "http://redwoodjs.com/"
|
|
43
|
+
* - the URL will open in the default browser when this item is selected
|
|
44
|
+
* - a redwood CLI action
|
|
45
|
+
* - ex: "rw generate page"
|
|
46
|
+
* - note: the string must start with "rw"
|
|
47
|
+
* - the command will be executed when this item is selected
|
|
48
|
+
* - an interactive redwood action
|
|
49
|
+
* - ex: "rw generate page..."
|
|
50
|
+
* - the string must start with end with "..." (this means interactive)
|
|
51
|
+
* - the interactive process will start when this item is selected
|
|
52
|
+
* - not all redwood commands are supported in interactive mode
|
|
53
|
+
* - see: https://github.com/cedarjs/cedar/tree/main/packages/structure/src/interactive_cli
|
|
54
|
+
*/
|
|
55
|
+
/**
|
|
56
|
+
* this will recursively await all children and return a serializable representation
|
|
57
|
+
* of the complete outline
|
|
58
|
+
* @param item
|
|
59
|
+
*/
|
|
60
|
+
async function outlineToJSON(item) {
|
|
61
|
+
if (!item.children) {
|
|
62
|
+
return {
|
|
63
|
+
...item,
|
|
64
|
+
children: undefined
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
const cs = item.children ? await item.children() : [];
|
|
68
|
+
const css = await _promise.default.all((0, _map.default)(cs).call(cs, outlineToJSON));
|
|
69
|
+
return {
|
|
70
|
+
...item,
|
|
71
|
+
children: css
|
|
72
|
+
};
|
|
73
|
+
}
|
package/dist/util.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,QAuB7C"}
|
package/dist/util.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
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;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type ArrayLike<T> = T[] | Promise<T[]> | IterableIterator<T> | undefined | void | null;
|
|
2
|
+
export declare function ArrayLike_normalize<T>(x: ArrayLike<T>): Promise<T[]>;
|
|
3
|
+
export declare function iter<T>(f: () => IterableIterator<T>): T[];
|
|
4
|
+
//# sourceMappingURL=Array.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Array.d.ts","sourceRoot":"","sources":["../../src/x/Array.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,CAAC,CAAC,IACnB,CAAC,EAAE,GACH,OAAO,CAAC,CAAC,EAAE,CAAC,GACZ,gBAAgB,CAAC,CAAC,CAAC,GACnB,SAAS,GACT,IAAI,GACJ,IAAI,CAAA;AAER,wBAAsB,mBAAmB,CAAC,CAAC,EAAE,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC,CAW1E;AAED,wBAAgB,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,gBAAgB,CAAC,CAAC,CAAC,OAEnD"}
|
package/dist/x/Array.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
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];
|
|
23
|
+
}
|
|
24
|
+
function iter(f) {
|
|
25
|
+
return (0, _from.default)(f());
|
|
26
|
+
}
|
package/dist/x/URL.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a file:// URL
|
|
3
|
+
* Works with linux and windows paths
|
|
4
|
+
* If the passed in value is already as file:// URL, it returns that same value
|
|
5
|
+
* TODO: rename to URL_fromFile
|
|
6
|
+
* @param filePath
|
|
7
|
+
*/
|
|
8
|
+
export declare function URL_file(filePath: string, ...parts: string[]): string;
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* @param uriOrFilePath
|
|
12
|
+
* @param sep separator string, defaults to `require('path').sep`
|
|
13
|
+
*/
|
|
14
|
+
export declare function URL_toFile(uriOrFilePath: string, sep?: "\\" | "/"): string;
|
|
15
|
+
//# sourceMappingURL=URL.d.ts.map
|