@platformos/platformos-graph 0.0.2
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/CHANGELOG.md +10 -0
- package/README.md +83 -0
- package/bin/jsconfig.json +18 -0
- package/bin/platformos-graph +107 -0
- package/dist/getWebComponentMap.d.ts +10 -0
- package/dist/getWebComponentMap.js +66 -0
- package/dist/getWebComponentMap.js.map +1 -0
- package/dist/graph/augment.d.ts +2 -0
- package/dist/graph/augment.js +22 -0
- package/dist/graph/augment.js.map +1 -0
- package/dist/graph/build.d.ts +3 -0
- package/dist/graph/build.js +31 -0
- package/dist/graph/build.js.map +1 -0
- package/dist/graph/module.d.ts +10 -0
- package/dist/graph/module.js +181 -0
- package/dist/graph/module.js.map +1 -0
- package/dist/graph/serialize.d.ts +2 -0
- package/dist/graph/serialize.js +18 -0
- package/dist/graph/serialize.js.map +1 -0
- package/dist/graph/test-helpers.d.ts +33 -0
- package/dist/graph/test-helpers.js +49 -0
- package/dist/graph/test-helpers.js.map +1 -0
- package/dist/graph/traverse.d.ts +14 -0
- package/dist/graph/traverse.js +458 -0
- package/dist/graph/traverse.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +31 -0
- package/dist/index.js.map +1 -0
- package/dist/toSourceCode.d.ts +8 -0
- package/dist/toSourceCode.js +76 -0
- package/dist/toSourceCode.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types.d.ts +144 -0
- package/dist/types.js +13 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/index.d.ts +11 -0
- package/dist/utils/index.js +47 -0
- package/dist/utils/index.js.map +1 -0
- package/docs/graph.png +0 -0
- package/docs/how-it-works.md +89 -0
- package/fixtures/skeleton/app/views/partials/child.liquid +9 -0
- package/fixtures/skeleton/app/views/partials/parent.liquid +9 -0
- package/fixtures/skeleton/assets/theme.css +0 -0
- package/fixtures/skeleton/assets/theme.js +7 -0
- package/fixtures/skeleton/blocks/_private.liquid +1 -0
- package/fixtures/skeleton/blocks/_static.liquid +10 -0
- package/fixtures/skeleton/blocks/group.liquid +27 -0
- package/fixtures/skeleton/blocks/render-static.liquid +22 -0
- package/fixtures/skeleton/blocks/text.liquid +14 -0
- package/fixtures/skeleton/jsconfig.json +9 -0
- package/fixtures/skeleton/layout/theme.liquid +14 -0
- package/fixtures/skeleton/sections/custom-section.liquid +6 -0
- package/fixtures/skeleton/sections/header-group.json +36 -0
- package/fixtures/skeleton/sections/header.liquid +1 -0
- package/fixtures/skeleton/templates/index.json +20 -0
- package/package.json +41 -0
- package/src/getWebComponentMap.ts +81 -0
- package/src/graph/augment.ts +34 -0
- package/src/graph/build.spec.ts +248 -0
- package/src/graph/build.ts +45 -0
- package/src/graph/module.ts +212 -0
- package/src/graph/serialize.spec.ts +62 -0
- package/src/graph/serialize.ts +20 -0
- package/src/graph/test-helpers.ts +57 -0
- package/src/graph/traverse.ts +639 -0
- package/src/index.ts +5 -0
- package/src/toSourceCode.ts +80 -0
- package/src/types.ts +213 -0
- package/src/utils/index.ts +51 -0
- package/tsconfig.build.json +20 -0
- package/tsconfig.json +37 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.skeleton = exports.fixturesRoot = void 0;
|
|
4
|
+
exports.makeGetSourceCode = makeGetSourceCode;
|
|
5
|
+
exports.getDependencies = getDependencies;
|
|
6
|
+
exports.mockImpl = mockImpl;
|
|
7
|
+
const platformos_check_common_1 = require("@platformos/platformos-check-common");
|
|
8
|
+
const platformos_check_node_1 = require("@platformos/platformos-check-node");
|
|
9
|
+
const vitest_1 = require("vitest");
|
|
10
|
+
const vscode_uri_1 = require("vscode-uri");
|
|
11
|
+
const getWebComponentMap_1 = require("../getWebComponentMap");
|
|
12
|
+
const toSourceCode_1 = require("../toSourceCode");
|
|
13
|
+
const utils_1 = require("../utils");
|
|
14
|
+
function makeGetSourceCode(fs) {
|
|
15
|
+
return (0, platformos_check_common_1.memoize)(async function getSourceCode(uri) {
|
|
16
|
+
const source = await fs.readFile(uri);
|
|
17
|
+
return (0, toSourceCode_1.toSourceCode)(vscode_uri_1.URI.file(uri).toString(), source);
|
|
18
|
+
}, utils_1.identity);
|
|
19
|
+
}
|
|
20
|
+
exports.fixturesRoot = platformos_check_common_1.path.join(vscode_uri_1.URI.file(__dirname), ...'../../fixtures'.split('/'));
|
|
21
|
+
exports.skeleton = platformos_check_common_1.path.join(exports.fixturesRoot, 'skeleton');
|
|
22
|
+
async function getDependencies(rootUri, fs = platformos_check_node_1.NodeFileSystem) {
|
|
23
|
+
const getSourceCode = makeGetSourceCode(fs);
|
|
24
|
+
const deps = {
|
|
25
|
+
fs,
|
|
26
|
+
getSectionSchema: (0, platformos_check_common_1.memoize)(async (name) => {
|
|
27
|
+
const uri = platformos_check_common_1.path.join(exports.skeleton, 'sections', `${name}.liquid`);
|
|
28
|
+
const sourceCode = (await getSourceCode(uri));
|
|
29
|
+
return (await (0, platformos_check_common_1.toSchema)('theme', uri, sourceCode, async () => true));
|
|
30
|
+
}, utils_1.identity),
|
|
31
|
+
getBlockSchema: (0, platformos_check_common_1.memoize)(async (name) => {
|
|
32
|
+
const uri = platformos_check_common_1.path.join(exports.skeleton, 'blocks', `${name}.liquid`);
|
|
33
|
+
const sourceCode = (await getSourceCode(uri));
|
|
34
|
+
return (await (0, platformos_check_common_1.toSchema)('theme', uri, sourceCode, async () => true));
|
|
35
|
+
}, utils_1.identity),
|
|
36
|
+
getSourceCode,
|
|
37
|
+
getWebComponentDefinitionReference: (customElementName) => webComponentDefs.get(customElementName),
|
|
38
|
+
};
|
|
39
|
+
const webComponentDefs = await (0, getWebComponentMap_1.getWebComponentMap)(rootUri, deps);
|
|
40
|
+
return deps;
|
|
41
|
+
}
|
|
42
|
+
// This thing is way too hard to type.
|
|
43
|
+
function mockImpl(obj, method, callback) {
|
|
44
|
+
const original = obj[method].bind(obj);
|
|
45
|
+
return vitest_1.vi.spyOn(obj, method).mockImplementation(function () {
|
|
46
|
+
return callback(original, ...arguments);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=test-helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-helpers.js","sourceRoot":"","sources":["../../src/graph/test-helpers.ts"],"names":[],"mappings":";;;AAgBA,8CAKC;AAKD,0CAsBC;AAGD,4BAKC;AAxDD,iFAO6C;AAE7C,6EAAmE;AACnE,mCAA4B;AAC5B,2CAAiC;AACjC,8DAA2D;AAC3D,kDAA+C;AAC/C,oCAAoC;AAEpC,SAAgB,iBAAiB,CAAC,EAAsB;IACtD,OAAO,IAAA,iCAAO,EAAC,KAAK,UAAU,aAAa,CAAC,GAAW;QACrD,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QACtC,OAAO,IAAA,2BAAY,EAAC,gBAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,MAAM,CAAC,CAAC;IACxD,CAAC,EAAE,gBAAQ,CAAC,CAAC;AACf,CAAC;AAEY,QAAA,YAAY,GAAG,8BAAS,CAAC,IAAI,CAAC,gBAAG,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,gBAAgB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;AACnF,QAAA,QAAQ,GAAG,8BAAS,CAAC,IAAI,CAAC,oBAAY,EAAE,UAAU,CAAC,CAAC;AAE1D,KAAK,UAAU,eAAe,CAAC,OAAe,EAAE,KAAyB,sCAAc;IAC5F,MAAM,aAAa,GAAG,iBAAiB,CAAC,EAAE,CAAC,CAAC;IAC5C,MAAM,IAAI,GAAG;QACX,EAAE;QACF,gBAAgB,EAAE,IAAA,iCAAO,EAAC,KAAK,EAAE,IAAY,EAAE,EAAE;YAC/C,MAAM,GAAG,GAAG,8BAAS,CAAC,IAAI,CAAC,gBAAQ,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AC;IAC1C,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AugmentedDependencies, Range, Reference, ThemeGraph, ThemeModule, Void } from '../types';
|
|
2
|
+
export declare function traverseModule(module: ThemeModule, themeGraph: ThemeGraph, deps: AugmentedDependencies): Promise<Void>;
|
|
3
|
+
/**
|
|
4
|
+
* The bind method is the method that links two modules together.
|
|
5
|
+
*
|
|
6
|
+
* It adds the dependency to the source module's dependencies and the target module's references.
|
|
7
|
+
*
|
|
8
|
+
* This function mutates the source and target modules.
|
|
9
|
+
*/
|
|
10
|
+
export declare function bind(source: ThemeModule, target: ThemeModule, { sourceRange, targetRange, type, }?: {
|
|
11
|
+
sourceRange?: Range;
|
|
12
|
+
targetRange?: Range;
|
|
13
|
+
type?: Reference['type'];
|
|
14
|
+
}): void;
|
|
@@ -0,0 +1,458 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.traverseModule = traverseModule;
|
|
4
|
+
exports.bind = bind;
|
|
5
|
+
const liquid_html_parser_1 = require("@platformos/liquid-html-parser");
|
|
6
|
+
const platformos_check_common_1 = require("@platformos/platformos-check-common");
|
|
7
|
+
const utils_1 = require("../utils");
|
|
8
|
+
const module_1 = require("./module");
|
|
9
|
+
async function traverseModule(module, themeGraph, deps) {
|
|
10
|
+
// If the module is already traversed, skip it
|
|
11
|
+
if (themeGraph.modules[module.uri]) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
// Signal to all users that the file is being traversed
|
|
15
|
+
// This will prevent multiple traversals of the same file
|
|
16
|
+
themeGraph.modules[module.uri] = module;
|
|
17
|
+
// Check if the module exists on disk
|
|
18
|
+
module.exists = await (0, utils_1.exists)(deps.fs, module.uri);
|
|
19
|
+
// If the module doesn't exist, we can't traverse it
|
|
20
|
+
if (!module.exists) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
switch (module.type) {
|
|
24
|
+
case "Liquid" /* ModuleType.Liquid */: {
|
|
25
|
+
return traverseLiquidModule(module, themeGraph, deps);
|
|
26
|
+
}
|
|
27
|
+
case "JSON" /* ModuleType.Json */: {
|
|
28
|
+
return traverseJsonModule(module, themeGraph, deps);
|
|
29
|
+
}
|
|
30
|
+
case "JavaScript" /* ModuleType.JavaScript */: {
|
|
31
|
+
return; // TODO graph import/exports ?
|
|
32
|
+
}
|
|
33
|
+
case "CSS" /* ModuleType.Css */:
|
|
34
|
+
case "SVG" /* ModuleType.Svg */:
|
|
35
|
+
case "Image" /* ModuleType.Image */: {
|
|
36
|
+
return; // Nothing to do??
|
|
37
|
+
}
|
|
38
|
+
default: {
|
|
39
|
+
return (0, utils_1.assertNever)(module);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
async function traverseLiquidModule(module, themeGraph, deps) {
|
|
44
|
+
const sourceCode = await deps.getSourceCode(module.uri);
|
|
45
|
+
if (sourceCode.ast instanceof Error)
|
|
46
|
+
return; // can't visit what you can't parse
|
|
47
|
+
const visitor = {
|
|
48
|
+
// {{ 'theme.js' | asset_url }}
|
|
49
|
+
// {{ 'image.png' | asset_img_url }}
|
|
50
|
+
// {{ 'icon.svg' | inline_asset_content }}
|
|
51
|
+
LiquidFilter: async (node, ancestors) => {
|
|
52
|
+
if (['asset_url', 'asset_img_url', 'inline_asset_content'].includes(node.name)) {
|
|
53
|
+
const parentNode = ancestors[ancestors.length - 1];
|
|
54
|
+
if (parentNode.type !== liquid_html_parser_1.NodeTypes.LiquidVariable)
|
|
55
|
+
return;
|
|
56
|
+
if (parentNode.expression.type !== liquid_html_parser_1.NodeTypes.String)
|
|
57
|
+
return;
|
|
58
|
+
if (parentNode.filters[0] !== node)
|
|
59
|
+
return;
|
|
60
|
+
const asset = parentNode.expression.value;
|
|
61
|
+
const module = (0, module_1.getAssetModule)(themeGraph, asset);
|
|
62
|
+
if (!module)
|
|
63
|
+
return;
|
|
64
|
+
return {
|
|
65
|
+
target: module,
|
|
66
|
+
sourceRange: [parentNode.position.start, parentNode.position.end],
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
// {% content_for 'block', type: 'staticBlockName', id: 'id' %}
|
|
71
|
+
ContentForMarkup: async (node, ancestors) => {
|
|
72
|
+
const parentNode = ancestors.at(-1);
|
|
73
|
+
if (node.contentForType.value !== 'block')
|
|
74
|
+
return;
|
|
75
|
+
const blockTypeArg = node.args.find((arg) => arg.name === 'type');
|
|
76
|
+
if (!blockTypeArg)
|
|
77
|
+
return;
|
|
78
|
+
const blockTypeValue = blockTypeArg.value;
|
|
79
|
+
if (blockTypeValue.type !== liquid_html_parser_1.NodeTypes.String)
|
|
80
|
+
return;
|
|
81
|
+
const blockType = blockTypeValue.value;
|
|
82
|
+
return {
|
|
83
|
+
target: (0, module_1.getThemeBlockModule)(themeGraph, blockType),
|
|
84
|
+
sourceRange: [parentNode.position.start, node.position.end],
|
|
85
|
+
};
|
|
86
|
+
},
|
|
87
|
+
// <custom-element></custom-element>
|
|
88
|
+
HtmlElement: async (node) => {
|
|
89
|
+
if (node.name.length !== 1)
|
|
90
|
+
return;
|
|
91
|
+
if (node.name[0].type !== liquid_html_parser_1.NodeTypes.TextNode)
|
|
92
|
+
return;
|
|
93
|
+
const nodeNameNode = node.name[0];
|
|
94
|
+
const nodeName = nodeNameNode.value;
|
|
95
|
+
if (!nodeName.includes('-'))
|
|
96
|
+
return; // skip non-custom-elements
|
|
97
|
+
const result = deps.getWebComponentDefinitionReference(nodeName);
|
|
98
|
+
if (!result)
|
|
99
|
+
return;
|
|
100
|
+
const { assetName, range } = result;
|
|
101
|
+
const module = (0, module_1.getAssetModule)(themeGraph, assetName);
|
|
102
|
+
if (!module)
|
|
103
|
+
return;
|
|
104
|
+
return {
|
|
105
|
+
target: module,
|
|
106
|
+
sourceRange: [node.blockStartPosition.start, nodeNameNode.position.end],
|
|
107
|
+
targetRange: range,
|
|
108
|
+
};
|
|
109
|
+
},
|
|
110
|
+
// {% render 'partial' %}
|
|
111
|
+
RenderMarkup: async (node, ancestors) => {
|
|
112
|
+
const snippet = node.snippet;
|
|
113
|
+
const tag = ancestors.at(-1);
|
|
114
|
+
if (!(0, utils_1.isString)(snippet) && snippet.type === liquid_html_parser_1.NodeTypes.String) {
|
|
115
|
+
return {
|
|
116
|
+
target: (0, module_1.getPartialModule)(themeGraph, snippet.value),
|
|
117
|
+
sourceRange: [tag.position.start, tag.position.end],
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
LiquidTag: async (node) => {
|
|
122
|
+
switch (node.name) {
|
|
123
|
+
// {% sections 'section-group' %}
|
|
124
|
+
case liquid_html_parser_1.NamedTags.sections: {
|
|
125
|
+
if (!(0, utils_1.isString)(node.markup)) {
|
|
126
|
+
const sectionGroupType = node.markup.value;
|
|
127
|
+
return {
|
|
128
|
+
target: (0, module_1.getSectionGroupModule)(themeGraph, sectionGroupType),
|
|
129
|
+
sourceRange: [node.position.start, node.position.end],
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
// {% section 'section' %}
|
|
134
|
+
case liquid_html_parser_1.NamedTags.section: {
|
|
135
|
+
if (!(0, utils_1.isString)(node.markup)) {
|
|
136
|
+
const sectionType = node.markup.value;
|
|
137
|
+
return {
|
|
138
|
+
target: (0, module_1.getSectionModule)(themeGraph, sectionType),
|
|
139
|
+
sourceRange: [node.position.start, node.position.end],
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
const references = await (0, platformos_check_common_1.visit)(sourceCode.ast, visitor);
|
|
147
|
+
for (const reference of references) {
|
|
148
|
+
bind(module, reference.target, {
|
|
149
|
+
sourceRange: reference.sourceRange,
|
|
150
|
+
targetRange: reference.targetRange,
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
const modules = (0, utils_1.unique)(references.map((ref) => ref.target));
|
|
154
|
+
const promises = modules.map((mod) => traverseModule(mod, themeGraph, deps));
|
|
155
|
+
// Look at schema references if any
|
|
156
|
+
if (module.kind === "section" /* LiquidModuleKind.Section */) {
|
|
157
|
+
const sectionName = platformos_check_common_1.path.basename(module.uri, '.liquid');
|
|
158
|
+
const sectionSchema = await deps.getSectionSchema(sectionName);
|
|
159
|
+
promises.push(traverseLiquidSchema(sectionSchema, module, themeGraph, deps));
|
|
160
|
+
}
|
|
161
|
+
else if (module.kind === "block" /* LiquidModuleKind.Block */) {
|
|
162
|
+
const blockName = platformos_check_common_1.path.basename(module.uri, '.liquid');
|
|
163
|
+
const blockSchema = await deps.getBlockSchema(blockName);
|
|
164
|
+
promises.push(traverseLiquidSchema(blockSchema, module, themeGraph, deps));
|
|
165
|
+
}
|
|
166
|
+
return Promise.all(promises);
|
|
167
|
+
}
|
|
168
|
+
async function traverseLiquidSchema(schema, module, themeGraph, deps) {
|
|
169
|
+
if (!schema)
|
|
170
|
+
return;
|
|
171
|
+
const isSection = module.kind === "section" /* LiquidModuleKind.Section */;
|
|
172
|
+
const hasLocalBlocks = isSection && (await (0, utils_1.acceptsLocalBlocks)(platformos_check_common_1.path.basename(module.uri, '.liquid'), deps));
|
|
173
|
+
if (hasLocalBlocks)
|
|
174
|
+
return;
|
|
175
|
+
const { ast, validSchema } = schema;
|
|
176
|
+
if (validSchema instanceof Error || ast instanceof Error)
|
|
177
|
+
return;
|
|
178
|
+
const promises = [];
|
|
179
|
+
// Traverse the blocks
|
|
180
|
+
if (validSchema.blocks) {
|
|
181
|
+
promises.push(traverseSchemaBlocks(schema, module, ast, validSchema.blocks, themeGraph, deps));
|
|
182
|
+
}
|
|
183
|
+
// Traverse the presets
|
|
184
|
+
if (validSchema.presets) {
|
|
185
|
+
promises.push(traverseSchemaPresets(schema, module, ast, validSchema.presets, themeGraph, deps));
|
|
186
|
+
}
|
|
187
|
+
// Traverse section.default if it exists
|
|
188
|
+
if ('default' in validSchema && validSchema.default) {
|
|
189
|
+
promises.push(traverseSchemaDefault(schema, module, ast, validSchema.default, themeGraph, deps));
|
|
190
|
+
}
|
|
191
|
+
return Promise.all(promises);
|
|
192
|
+
}
|
|
193
|
+
async function traverseSchemaBlocks(schema, module, ast, blocks, themeGraph, deps) {
|
|
194
|
+
const promises = [];
|
|
195
|
+
for (const [i, blockDef] of Object.entries(blocks)) {
|
|
196
|
+
const nodePath = ['blocks', i];
|
|
197
|
+
const node = (0, platformos_check_common_1.nodeAtPath)(ast, nodePath);
|
|
198
|
+
const typeProperty = node.children.find((child) => child.key.value === 'type');
|
|
199
|
+
if (!typeProperty)
|
|
200
|
+
continue;
|
|
201
|
+
const sourceRange = [
|
|
202
|
+
schema.offset + typeProperty.loc.start.offset,
|
|
203
|
+
schema.offset + typeProperty.loc.end.offset,
|
|
204
|
+
];
|
|
205
|
+
// blocks: [{ "type": "@theme" }, { "type": "custom-block" }]
|
|
206
|
+
switch (blockDef.type) {
|
|
207
|
+
case '@theme': {
|
|
208
|
+
const publicBlocks = await deps
|
|
209
|
+
.getThemeBlockNames()
|
|
210
|
+
.then((blocks) => blocks.filter((name) => !name.startsWith('_')));
|
|
211
|
+
for (const publicBlock of publicBlocks) {
|
|
212
|
+
const blockModule = (0, module_1.getThemeBlockModule)(themeGraph, platformos_check_common_1.path.basename(publicBlock, '.liquid'));
|
|
213
|
+
bind(module, blockModule, { sourceRange, type: 'indirect' });
|
|
214
|
+
promises.push(traverseModule(blockModule, themeGraph, deps));
|
|
215
|
+
}
|
|
216
|
+
break;
|
|
217
|
+
}
|
|
218
|
+
case '@app': {
|
|
219
|
+
break;
|
|
220
|
+
}
|
|
221
|
+
default: {
|
|
222
|
+
const blockModule = (0, module_1.getThemeBlockModule)(themeGraph, blockDef.type);
|
|
223
|
+
bind(module, blockModule, { sourceRange });
|
|
224
|
+
promises.push(traverseModule(blockModule, themeGraph, deps));
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
return Promise.all(promises);
|
|
229
|
+
}
|
|
230
|
+
async function traverseSchemaPresets(schema, module, ast, presets, themeGraph, deps) {
|
|
231
|
+
const promises = [];
|
|
232
|
+
for (const [i, preset] of presets.entries()) {
|
|
233
|
+
if (!('blocks' in preset))
|
|
234
|
+
continue;
|
|
235
|
+
// Iterate over array entries or object entries depending on how the blocks are defined
|
|
236
|
+
const iterator = Array.isArray(preset.blocks)
|
|
237
|
+
? preset.blocks.entries()
|
|
238
|
+
: Object.entries(preset.blocks);
|
|
239
|
+
for (const [keyOrIndex, block] of iterator) {
|
|
240
|
+
const nodePath = ['presets', i, 'blocks', keyOrIndex];
|
|
241
|
+
const node = (0, platformos_check_common_1.nodeAtPath)(ast, nodePath);
|
|
242
|
+
const blockModule = (0, module_1.getThemeBlockModule)(themeGraph, block.type);
|
|
243
|
+
if (!blockModule)
|
|
244
|
+
continue;
|
|
245
|
+
const typeProperty = node.children.find((child) => child.key.value === 'type');
|
|
246
|
+
if (!typeProperty)
|
|
247
|
+
continue;
|
|
248
|
+
const sourceRange = [
|
|
249
|
+
schema.offset + typeProperty.loc.start.offset,
|
|
250
|
+
schema.offset + typeProperty.loc.end.offset,
|
|
251
|
+
];
|
|
252
|
+
bind(module, blockModule, { sourceRange, type: 'preset' });
|
|
253
|
+
promises.push(traverseModule(blockModule, themeGraph, deps));
|
|
254
|
+
if (block.blocks) {
|
|
255
|
+
promises.push(traverseSchemaPresetBlock(schema, module, ast, block.blocks, nodePath, themeGraph, deps));
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
return Promise.all(promises);
|
|
260
|
+
}
|
|
261
|
+
async function traverseSchemaPresetBlock(schema, module, ast, blocks, parentPath, themeGraph, deps) {
|
|
262
|
+
const promises = [];
|
|
263
|
+
// Iterate over array entries or object entries depending on how the blocks are defined
|
|
264
|
+
const iterator = Array.isArray(blocks) ? blocks.entries() : Object.entries(blocks);
|
|
265
|
+
for (const [keyOrIndex, block] of iterator) {
|
|
266
|
+
const nodePath = [...parentPath, 'blocks', keyOrIndex];
|
|
267
|
+
const node = (0, platformos_check_common_1.nodeAtPath)(ast, nodePath);
|
|
268
|
+
const blockModule = (0, module_1.getThemeBlockModule)(themeGraph, block.type);
|
|
269
|
+
if (!blockModule)
|
|
270
|
+
continue;
|
|
271
|
+
const typeProperty = node.children.find((child) => child.key.value === 'type');
|
|
272
|
+
if (!typeProperty)
|
|
273
|
+
continue;
|
|
274
|
+
const sourceRange = [
|
|
275
|
+
schema.offset + typeProperty.loc.start.offset,
|
|
276
|
+
schema.offset + typeProperty.loc.end.offset,
|
|
277
|
+
];
|
|
278
|
+
bind(module, blockModule, { sourceRange, type: 'preset' });
|
|
279
|
+
promises.push(traverseModule(blockModule, themeGraph, deps));
|
|
280
|
+
if (block.blocks) {
|
|
281
|
+
promises.push(traverseSchemaPresetBlock(schema, module, ast, block.blocks, nodePath, themeGraph, deps));
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
return Promise.all(promises);
|
|
285
|
+
}
|
|
286
|
+
async function traverseSchemaDefault(schema, module, ast, preset, themeGraph, deps) {
|
|
287
|
+
const promises = [];
|
|
288
|
+
if (!('blocks' in preset))
|
|
289
|
+
return;
|
|
290
|
+
// Iterate over array entries or object entries depending on how the blocks are defined
|
|
291
|
+
const iterator = Array.isArray(preset.blocks)
|
|
292
|
+
? preset.blocks.entries()
|
|
293
|
+
: Object.entries(preset.blocks);
|
|
294
|
+
for (const [keyOrIndex, block] of iterator) {
|
|
295
|
+
const nodePath = ['default', 'blocks', keyOrIndex];
|
|
296
|
+
const node = (0, platformos_check_common_1.nodeAtPath)(ast, nodePath);
|
|
297
|
+
const blockModule = (0, module_1.getThemeBlockModule)(themeGraph, block.type);
|
|
298
|
+
if (!blockModule)
|
|
299
|
+
continue;
|
|
300
|
+
const typeProperty = node.children.find((child) => child.key.value === 'type');
|
|
301
|
+
if (!typeProperty)
|
|
302
|
+
continue;
|
|
303
|
+
const sourceRange = [
|
|
304
|
+
schema.offset + typeProperty.loc.start.offset,
|
|
305
|
+
schema.offset + typeProperty.loc.end.offset,
|
|
306
|
+
];
|
|
307
|
+
bind(module, blockModule, { sourceRange, type: 'preset' });
|
|
308
|
+
promises.push(traverseModule(blockModule, themeGraph, deps));
|
|
309
|
+
}
|
|
310
|
+
return Promise.all(promises);
|
|
311
|
+
}
|
|
312
|
+
async function traverseJsonModule(module, themeGraph, deps) {
|
|
313
|
+
const sourceCode = await deps.getSourceCode(module.uri);
|
|
314
|
+
if (sourceCode.type !== platformos_check_common_1.SourceCodeType.JSON)
|
|
315
|
+
throw (0, utils_1.unexpected)();
|
|
316
|
+
const ast = sourceCode.ast;
|
|
317
|
+
if (ast instanceof Error)
|
|
318
|
+
return; // can't visit what you can't parse
|
|
319
|
+
switch (module.kind) {
|
|
320
|
+
case "template" /* JsonModuleKind.Template */: {
|
|
321
|
+
// Should only happen once per template
|
|
322
|
+
const template = (0, platformos_check_common_1.parseJSON)(sourceCode.source);
|
|
323
|
+
const promises = [];
|
|
324
|
+
for (const [key, section] of Object.entries(template.sections)) {
|
|
325
|
+
const sectionType = section.type;
|
|
326
|
+
const path = ['sections', key];
|
|
327
|
+
const node = (0, platformos_check_common_1.nodeAtPath)(ast, path);
|
|
328
|
+
const sectionModule = (0, module_1.getSectionModule)(themeGraph, sectionType);
|
|
329
|
+
const typeProperty = node.children.find((child) => child.key.value === 'type');
|
|
330
|
+
const start = typeProperty.loc.start.offset;
|
|
331
|
+
const end = typeProperty.loc.end.offset;
|
|
332
|
+
const sourceRange = [start, end];
|
|
333
|
+
// Link the template to the section
|
|
334
|
+
bind(module, sectionModule, { sourceRange });
|
|
335
|
+
promises.push(
|
|
336
|
+
// Traverse the section themeselves
|
|
337
|
+
traverseModule(sectionModule, themeGraph, deps),
|
|
338
|
+
// Link the blocks used in the section to the template
|
|
339
|
+
traverseSectionReferences(module, ast, path, section, themeGraph, deps));
|
|
340
|
+
}
|
|
341
|
+
// Link the template to the layout
|
|
342
|
+
const layout = template.layout;
|
|
343
|
+
const layoutModule = (0, module_1.getLayoutModule)(themeGraph, template.layout);
|
|
344
|
+
if (layoutModule) {
|
|
345
|
+
let sourceRange = undefined;
|
|
346
|
+
let indirect = true;
|
|
347
|
+
if (layout !== false && layout !== undefined) {
|
|
348
|
+
const layoutPath = ['layout'];
|
|
349
|
+
const node = (0, platformos_check_common_1.nodeAtPath)(ast, layoutPath);
|
|
350
|
+
sourceRange = [node.loc.start.offset, node.loc.end.offset];
|
|
351
|
+
indirect = false; // this is a direct reference to the layout
|
|
352
|
+
}
|
|
353
|
+
bind(module, layoutModule, { sourceRange, type: 'indirect' });
|
|
354
|
+
promises.push(traverseModule(layoutModule, themeGraph, deps));
|
|
355
|
+
}
|
|
356
|
+
return Promise.all(promises);
|
|
357
|
+
}
|
|
358
|
+
case "section-group" /* JsonModuleKind.SectionGroup */: {
|
|
359
|
+
const sectionGroup = (0, platformos_check_common_1.parseJSON)(sourceCode.source);
|
|
360
|
+
const promises = [];
|
|
361
|
+
for (const [key, section] of Object.entries(sectionGroup.sections)) {
|
|
362
|
+
const sectionType = section.type;
|
|
363
|
+
const path = ['sections', key];
|
|
364
|
+
const node = (0, platformos_check_common_1.nodeAtPath)(ast, path);
|
|
365
|
+
const sectionModule = (0, module_1.getSectionModule)(themeGraph, sectionType);
|
|
366
|
+
const typeProperty = node.children.find((child) => child.key.value === 'type');
|
|
367
|
+
const start = typeProperty.loc.start.offset;
|
|
368
|
+
const end = typeProperty.loc.end.offset;
|
|
369
|
+
const sourceRange = [start, end];
|
|
370
|
+
// Link the template to the section
|
|
371
|
+
bind(module, sectionModule, { sourceRange });
|
|
372
|
+
promises.push(
|
|
373
|
+
// Traverse the section themeselves
|
|
374
|
+
traverseModule(sectionModule, themeGraph, deps),
|
|
375
|
+
// Link the blocks used in the section to the template
|
|
376
|
+
traverseSectionReferences(module, ast, path, section, themeGraph, deps));
|
|
377
|
+
}
|
|
378
|
+
return Promise.all(promises);
|
|
379
|
+
}
|
|
380
|
+
default: {
|
|
381
|
+
return (0, utils_1.assertNever)(module.kind);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* Traverses the actual references contained inside Template.Template['sections'] and Template.SectionGroup['sections'].
|
|
387
|
+
*
|
|
388
|
+
* Does nothing if the mode is not `GraphMode.Production`.
|
|
389
|
+
*/
|
|
390
|
+
async function traverseSectionReferences(source, // template or section group
|
|
391
|
+
sourceAst, nodePath = [], section, themeGraph, deps) {
|
|
392
|
+
if (!section.blocks)
|
|
393
|
+
return;
|
|
394
|
+
const sectionHasLocalBlocks = await (0, utils_1.acceptsLocalBlocks)(section.type, deps);
|
|
395
|
+
if (sectionHasLocalBlocks)
|
|
396
|
+
return;
|
|
397
|
+
const promises = [];
|
|
398
|
+
for (const [key, block] of Object.entries(section.blocks)) {
|
|
399
|
+
const blockType = block.type;
|
|
400
|
+
const blockModule = (0, module_1.getThemeBlockModule)(themeGraph, blockType);
|
|
401
|
+
const path = [...nodePath, 'blocks', key];
|
|
402
|
+
const node = (0, platformos_check_common_1.nodeAtPath)(sourceAst, path);
|
|
403
|
+
const typeProperty = node.children.find((child) => child.key.value === 'type');
|
|
404
|
+
const start = typeProperty.loc.start.offset;
|
|
405
|
+
const end = typeProperty.loc.end.offset;
|
|
406
|
+
const sourceRange = [start, end];
|
|
407
|
+
// Link the template to the block
|
|
408
|
+
bind(source, blockModule, { sourceRange });
|
|
409
|
+
promises.push(
|
|
410
|
+
// Traverse the block themselves
|
|
411
|
+
traverseModule(blockModule, themeGraph, deps),
|
|
412
|
+
// Traverse the block references
|
|
413
|
+
traverseBlockReferences(source, sourceAst, path, block, themeGraph, deps));
|
|
414
|
+
}
|
|
415
|
+
return Promise.all(promises);
|
|
416
|
+
}
|
|
417
|
+
async function traverseBlockReferences(source, // template or section group
|
|
418
|
+
sourceAst, nodePath = [], block, themeGraph, deps) {
|
|
419
|
+
if (!block.blocks)
|
|
420
|
+
return;
|
|
421
|
+
const promises = [];
|
|
422
|
+
for (const [key, childBlock] of Object.entries(block.blocks)) {
|
|
423
|
+
const childBlockType = childBlock.type;
|
|
424
|
+
const childBlockModule = (0, module_1.getThemeBlockModule)(themeGraph, childBlockType);
|
|
425
|
+
const path = [...nodePath, 'blocks', key];
|
|
426
|
+
const node = (0, platformos_check_common_1.nodeAtPath)(sourceAst, path);
|
|
427
|
+
const typeProperty = node.children.find((child) => child.key.value === 'type');
|
|
428
|
+
const start = typeProperty.loc.start.offset;
|
|
429
|
+
const end = typeProperty.loc.end.offset;
|
|
430
|
+
const sourceRange = [start, end];
|
|
431
|
+
// Link the template/section group to the block
|
|
432
|
+
bind(source, childBlockModule, { sourceRange });
|
|
433
|
+
promises.push(
|
|
434
|
+
// Traverse the child block themselves
|
|
435
|
+
traverseModule(childBlockModule, themeGraph, deps),
|
|
436
|
+
// Traverse the child block references
|
|
437
|
+
traverseBlockReferences(source, sourceAst, path, childBlock, themeGraph, deps));
|
|
438
|
+
}
|
|
439
|
+
return Promise.all(promises);
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* The bind method is the method that links two modules together.
|
|
443
|
+
*
|
|
444
|
+
* It adds the dependency to the source module's dependencies and the target module's references.
|
|
445
|
+
*
|
|
446
|
+
* This function mutates the source and target modules.
|
|
447
|
+
*/
|
|
448
|
+
function bind(source, target, { sourceRange, targetRange, type = 'direct', // the type of dependency, can be 'direct', 'indirect' or 'preset'
|
|
449
|
+
} = {}) {
|
|
450
|
+
const dependency = {
|
|
451
|
+
source: { uri: source.uri, range: sourceRange },
|
|
452
|
+
target: { uri: target.uri, range: targetRange },
|
|
453
|
+
type: type,
|
|
454
|
+
};
|
|
455
|
+
source.dependencies.push(dependency);
|
|
456
|
+
target.references.push(dependency);
|
|
457
|
+
}
|
|
458
|
+
//# sourceMappingURL=traverse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"traverse.js","sourceRoot":"","sources":["../../src/graph/traverse.ts"],"names":[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QACxC,+CAA+C;QAC/C,IAAI,CAAC,MAAM,EAAE,gBAAgB,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC;QAChD,QAAQ,CAAC,IAAI;QACX,sCAAsC;QACtC,cAAc,CAAC,gBAAgB,EAAE,UAAU,EAAE,IAAI,CAAC;QAClD,sCAAsC;QACtC,uBAAuB,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,IAAI,CAAC,CAC/E,CAAC;IACJ,CAAC;IAED,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC/B,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,IAAI,CAClB,MAAmB,EACnB,MAAmB,EACnB,EACE,WAAW,EACX,WAAW,EACX,IAAI,GAAG,QAAQ,EAAE,kEAAkE;KAKjF,EAAE;IAEN,MAAM,UAAU,GAAc;QAC5B,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE;QAC/C,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE;QAC/C,IAAI,EAAE,IAAI;KACX,CAAC;IAEF,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACrC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AACrC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { buildThemeGraph } from './graph/build';
|
|
2
|
+
export { serializeThemeGraph } from './graph/serialize';
|
|
3
|
+
export { getWebComponentMap, findWebComponentReferences } from './getWebComponentMap';
|
|
4
|
+
export { toCssSourceCode, toJsSourceCode, toSourceCode, toSvgSourceCode } from './toSourceCode';
|
|
5
|
+
export * from './types';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.toSvgSourceCode = exports.toSourceCode = exports.toJsSourceCode = exports.toCssSourceCode = exports.findWebComponentReferences = exports.getWebComponentMap = exports.serializeThemeGraph = exports.buildThemeGraph = void 0;
|
|
18
|
+
var build_1 = require("./graph/build");
|
|
19
|
+
Object.defineProperty(exports, "buildThemeGraph", { enumerable: true, get: function () { return build_1.buildThemeGraph; } });
|
|
20
|
+
var serialize_1 = require("./graph/serialize");
|
|
21
|
+
Object.defineProperty(exports, "serializeThemeGraph", { enumerable: true, get: function () { return serialize_1.serializeThemeGraph; } });
|
|
22
|
+
var getWebComponentMap_1 = require("./getWebComponentMap");
|
|
23
|
+
Object.defineProperty(exports, "getWebComponentMap", { enumerable: true, get: function () { return getWebComponentMap_1.getWebComponentMap; } });
|
|
24
|
+
Object.defineProperty(exports, "findWebComponentReferences", { enumerable: true, get: function () { return getWebComponentMap_1.findWebComponentReferences; } });
|
|
25
|
+
var toSourceCode_1 = require("./toSourceCode");
|
|
26
|
+
Object.defineProperty(exports, "toCssSourceCode", { enumerable: true, get: function () { return toSourceCode_1.toCssSourceCode; } });
|
|
27
|
+
Object.defineProperty(exports, "toJsSourceCode", { enumerable: true, get: function () { return toSourceCode_1.toJsSourceCode; } });
|
|
28
|
+
Object.defineProperty(exports, "toSourceCode", { enumerable: true, get: function () { return toSourceCode_1.toSourceCode; } });
|
|
29
|
+
Object.defineProperty(exports, "toSvgSourceCode", { enumerable: true, get: function () { return toSourceCode_1.toSvgSourceCode; } });
|
|
30
|
+
__exportStar(require("./types"), exports);
|
|
31
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,uCAAgD;AAAvC,wGAAA,eAAe,OAAA;AACxB,+CAAwD;AAA/C,gHAAA,mBAAmB,OAAA;AAC5B,2DAAsF;AAA7E,wHAAA,kBAAkB,OAAA;AAAE,gIAAA,0BAA0B,OAAA;AACvD,+CAAgG;AAAvF,+GAAA,eAAe,OAAA;AAAE,8GAAA,cAAc,OAAA;AAAE,4GAAA,YAAY,OAAA;AAAE,+GAAA,eAAe,OAAA;AACvE,0CAAwB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { UriString } from '@platformos/platformos-check-common';
|
|
2
|
+
import { Program } from 'acorn';
|
|
3
|
+
import { CssSourceCode, FileSourceCode, JsSourceCode, SvgSourceCode } from './types';
|
|
4
|
+
export declare function toCssSourceCode(uri: UriString, source: string): Promise<CssSourceCode>;
|
|
5
|
+
export declare function toSvgSourceCode(uri: UriString, source: string): Promise<SvgSourceCode>;
|
|
6
|
+
export declare function toJsSourceCode(uri: UriString, source: string): Promise<JsSourceCode>;
|
|
7
|
+
export declare function parseJs(source: string): Program | Error;
|
|
8
|
+
export declare function toSourceCode(uri: UriString, source: string): Promise<FileSourceCode>;
|