@platformos/platformos-graph 0.0.7 → 0.0.9
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 +18 -0
- package/README.md +10 -11
- package/dist/getWebComponentMap.js +1 -1
- package/dist/getWebComponentMap.js.map +1 -1
- package/dist/graph/augment.js +0 -3
- package/dist/graph/augment.js.map +1 -1
- package/dist/graph/build.d.ts +2 -2
- package/dist/graph/build.js +7 -8
- package/dist/graph/build.js.map +1 -1
- package/dist/graph/module.d.ts +6 -9
- package/dist/graph/module.js +54 -123
- package/dist/graph/module.js.map +1 -1
- package/dist/graph/serialize.d.ts +2 -2
- package/dist/graph/serialize.js +2 -2
- package/dist/graph/serialize.js.map +1 -1
- package/dist/graph/test-helpers.d.ts +0 -13
- package/dist/graph/test-helpers.js +0 -10
- package/dist/graph/test-helpers.js.map +1 -1
- package/dist/graph/traverse.d.ts +3 -3
- package/dist/graph/traverse.js +19 -349
- package/dist/graph/traverse.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +4 -6
- package/dist/index.js.map +1 -1
- package/dist/toSourceCode.d.ts +1 -4
- package/dist/toSourceCode.js +8 -52
- package/dist/toSourceCode.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types.d.ts +21 -78
- package/dist/types.js.map +1 -1
- package/dist/utils/index.d.ts +0 -3
- package/dist/utils/index.js +0 -18
- package/dist/utils/index.js.map +1 -1
- package/docs/how-it-works.md +9 -10
- package/fixtures/skeleton/app/views/layouts/application.liquid +13 -0
- package/fixtures/skeleton/app/views/pages/index.liquid +5 -0
- package/fixtures/skeleton/app/views/partials/header.liquid +3 -0
- package/fixtures/skeleton/app/views/partials/parent.liquid +1 -1
- package/package.json +5 -5
- package/src/getWebComponentMap.ts +1 -1
- package/src/graph/augment.ts +1 -13
- package/src/graph/build.spec.ts +33 -173
- package/src/graph/build.ts +11 -14
- package/src/graph/module.ts +60 -144
- package/src/graph/serialize.spec.ts +22 -29
- package/src/graph/serialize.ts +2 -2
- package/src/graph/test-helpers.ts +1 -18
- package/src/graph/traverse.ts +31 -504
- package/src/index.ts +3 -3
- package/src/toSourceCode.ts +14 -55
- package/src/types.ts +23 -100
- package/src/utils/index.ts +0 -24
- package/fixtures/skeleton/blocks/_private.liquid +0 -1
- package/fixtures/skeleton/blocks/_static.liquid +0 -10
- package/fixtures/skeleton/blocks/group.liquid +0 -27
- package/fixtures/skeleton/blocks/render-static.liquid +0 -22
- package/fixtures/skeleton/blocks/text.liquid +0 -14
- package/fixtures/skeleton/jsconfig.json +0 -9
- package/fixtures/skeleton/layout/theme.liquid +0 -14
- package/fixtures/skeleton/sections/custom-section.liquid +0 -6
- package/fixtures/skeleton/sections/header-group.json +0 -36
- package/fixtures/skeleton/sections/header.liquid +0 -1
- package/fixtures/skeleton/templates/index.json +0 -20
- /package/fixtures/skeleton/assets/{theme.css → app.css} +0 -0
- /package/fixtures/skeleton/assets/{theme.js → app.js} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# shopify/theme-graph
|
|
2
2
|
|
|
3
|
+
## 0.0.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Beta release
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @platformos/liquid-html-parser@0.0.9
|
|
10
|
+
- @platformos/platformos-check-common@0.0.9
|
|
11
|
+
|
|
12
|
+
## 0.0.8
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Beta release
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
- @platformos/liquid-html-parser@0.0.8
|
|
19
|
+
- @platformos/platformos-check-common@0.0.8
|
|
20
|
+
|
|
3
21
|
## 0.0.7
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -12,20 +12,20 @@ A platformOS Graph is a data structure that spans Liquid, JSON, JavaScript and C
|
|
|
12
12
|
It has the following interface:
|
|
13
13
|
|
|
14
14
|
```ts
|
|
15
|
-
interface
|
|
16
|
-
rootUri: UriString; // e.g. 'file:/path/to/
|
|
17
|
-
entryPoints:
|
|
18
|
-
modules: Record<UriString,
|
|
15
|
+
interface AppGraph {
|
|
16
|
+
rootUri: UriString; // e.g. 'file:/path/to/my-app'
|
|
17
|
+
entryPoints: AppModule[];
|
|
18
|
+
modules: Record<UriString, AppModule>
|
|
19
19
|
}
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
An `AppModule` holds _dependencies_ and _references_ of a module. For instance,
|
|
23
23
|
|
|
24
24
|
```ts
|
|
25
25
|
interface LiquidModule {
|
|
26
26
|
uri: UriString;
|
|
27
27
|
type: 'liquid';
|
|
28
|
-
kind: '
|
|
28
|
+
kind: 'layout' | 'partial' | 'page';
|
|
29
29
|
references: Reference[];
|
|
30
30
|
dependencies: Reference[];
|
|
31
31
|
}
|
|
@@ -44,9 +44,8 @@ interface Reference {
|
|
|
44
44
|
target: { uri: string, range?: Range };
|
|
45
45
|
|
|
46
46
|
type:
|
|
47
|
-
| 'direct' // e.g. {% render 'child' %}, {{ '
|
|
48
|
-
| 'indirect' // e.g.
|
|
49
|
-
| 'preset' // e.g. Section and block presets
|
|
47
|
+
| 'direct' // e.g. {% render 'child' %}, {{ 'app.js' | asset_url }}, <custom-element>, etc.
|
|
48
|
+
| 'indirect' // e.g. files that loosely depend on another
|
|
50
49
|
}
|
|
51
50
|
```
|
|
52
51
|
|
|
@@ -62,13 +61,13 @@ npm install @platformos/platformos-graph
|
|
|
62
61
|
|
|
63
62
|
### Through the VS Code extension
|
|
64
63
|
|
|
65
|
-
The
|
|
64
|
+
The app graph is used by the VS Code extension to power the dependencies, references and dead code features.
|
|
66
65
|
|
|
67
66
|
### From the CLI
|
|
68
67
|
|
|
69
68
|
```
|
|
70
69
|
Usage:
|
|
71
|
-
platformos-graph <path-to-
|
|
70
|
+
platformos-graph <path-to-app-directory>
|
|
72
71
|
|
|
73
72
|
Example:
|
|
74
73
|
platformos-graph horizon > graph.json
|
|
@@ -28,7 +28,7 @@ async function getWebComponentMap(rootUri, { fs, getSourceCode }) {
|
|
|
28
28
|
}
|
|
29
29
|
async function findWebComponentReferences(uri, assetRoot, getSourceCode, result) {
|
|
30
30
|
const sourceCode = await getSourceCode(uri);
|
|
31
|
-
if (
|
|
31
|
+
if (!uri.endsWith('.js')) {
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
34
|
const ast = sourceCode.ast;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getWebComponentMap.js","sourceRoot":"","sources":["../src/getWebComponentMap.ts"],"names":[],"mappings":";;AAsBA,gDAiBC;AAED,gEAuCC;AAhFD,iFAAmF;AACnF,2CAA+C;AAI/C;;;;;;GAMG;AACH,MAAM,IAAI,GACR,+UAA+U,CAAC;AAElV;;;;;;GAMG;AACI,KAAK,UAAU,kBAAkB,CACtC,OAAe,EACf,EAAE,EAAE,EAAE,aAAa,EAA8C;IAEjE,MAAM,gBAAgB,GAAoB,IAAI,GAAG,EAAE,CAAC;IACpD,MAAM,SAAS,GAAG,8BAAI,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAC/C,MAAM,OAAO,GAAG,MAAM,IAAA,gDAAsB,EAAC,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,CACzE,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,CACzB,CAAC;IAEF,MAAM,OAAO,CAAC,GAAG,CACf,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAClB,0BAA0B,CAAC,GAAG,EAAE,SAAS,EAAE,aAAa,EAAE,gBAAgB,CAAC,CAC5E,CACF,CAAC;IAEF,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAEM,KAAK,UAAU,0BAA0B,CAC9C,GAAW,EACX,SAAiB,EACjB,aAA4C,EA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T,CAAC;IAED,KAAK,MAAM,IAAI,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC;QAC5B,IAAA,qBAAK,EAAC,IAAI,EAAE;YACV,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS;gBAC7B,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;oBAC5D,2DAA2D;oBAC3D,MAAM,UAAU,GAAG,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;oBACpC,IAAI,CAAC,UAAU;wBAAE,OAAO;oBACxB,IAAI,UAAU,CAAC,IAAI,KAAK,gBAAgB;wBAAE,OAAO;oBACjD,MAAM,MAAM,GAAI,UAA6B,CAAC,MAAM,CAAC;oBACrD,IAAI,MAAM,CAAC,IAAI,KAAK,kBAAkB;wBAAE,OAAO;oBAC/C,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;oBACjC,IAAI,QAAQ,CAAC,IAAI,KAAK,YAAY;wBAAE,OAAO;oBAC3C,IAAI,QAAQ,CAAC,IAAI,KAAK,QAAQ;wBAAE,OAAO;oBAEvC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE;wBACrB,SAAS,EAAE,8BAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC;wBACxC,KAAK,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC;qBAClC,CAAC,CAAC;gBACL,CAAC;gBACD,OAAO,IAAI,CAAC;YACd,CAAC;SACF,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
|
package/dist/graph/augment.js
CHANGED
|
@@ -7,8 +7,6 @@ const utils_1 = require("../utils");
|
|
|
7
7
|
function augmentDependencies(rootUri, ideps) {
|
|
8
8
|
return {
|
|
9
9
|
fs: ideps.fs,
|
|
10
|
-
getBlockSchema: (0, platformos_check_common_1.memoize)(ideps.getBlockSchema, utils_1.identity),
|
|
11
|
-
getSectionSchema: (0, platformos_check_common_1.memoize)(ideps.getSectionSchema, utils_1.identity),
|
|
12
10
|
// parse at most once
|
|
13
11
|
getSourceCode: (0, platformos_check_common_1.memoize)(ideps.getSourceCode ??
|
|
14
12
|
async function defaultGetSourceCode(uri) {
|
|
@@ -16,7 +14,6 @@ function augmentDependencies(rootUri, ideps) {
|
|
|
16
14
|
return (0, toSourceCode_1.toSourceCode)(uri, contents);
|
|
17
15
|
}, utils_1.identity),
|
|
18
16
|
getWebComponentDefinitionReference: ideps.getWebComponentDefinitionReference,
|
|
19
|
-
getThemeBlockNames: (0, platformos_check_common_1.memo)(() => (0, platformos_check_common_1.recursiveReadDirectory)(ideps.fs, platformos_check_common_1.path.join(rootUri, 'blocks'), ([uri]) => uri.endsWith('.liquid')).then((uris) => uris.map((uri) => platformos_check_common_1.path.basename(uri, '.liquid')))),
|
|
20
17
|
};
|
|
21
18
|
}
|
|
22
19
|
//# sourceMappingURL=augment.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"augment.js","sourceRoot":"","sources":["../../src/graph/augment.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"augment.js","sourceRoot":"","sources":["../../src/graph/augment.ts"],"names":[],"mappings":";;AAKA,kDAgBC;AArBD,iFAAoE;AACpE,kDAA+C;AAE/C,oCAAoC;AAEpC,SAAgB,mBAAmB,CAAC,OAAe,EAAE,KAAoB;IACvE,OAAO;QACL,EAAE,EAAE,KAAK,CAAC,EAAE;QAEZ,qBAAqB;QACrB,aAAa,EAAE,IAAA,iCAAO,EACpB,KAAK,CAAC,aAAa;YACjB,KAAK,UAAU,oBAAoB,CAAC,GAAG;gBACrC,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;gBAC9C,OAAO,IAAA,2BAAY,EAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;YACrC,CAAC,EACH,gBAAQ,CACT;QAED,kCAAkC,EAAE,KAAK,CAAC,kCAAkC;KAC7E,CAAC;AACJ,CAAC"}
|
package/dist/graph/build.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { UriString } from '@platformos/platformos-check-common';
|
|
2
|
-
import { IDependencies,
|
|
3
|
-
export declare function
|
|
2
|
+
import { IDependencies, AppGraph } from '../types';
|
|
3
|
+
export declare function buildAppGraph(rootUri: UriString, ideps: IDependencies, entryPoints?: UriString[]): Promise<AppGraph>;
|
package/dist/graph/build.js
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.buildAppGraph = buildAppGraph;
|
|
4
4
|
const platformos_check_common_1 = require("@platformos/platformos-check-common");
|
|
5
5
|
const augment_1 = require("./augment");
|
|
6
6
|
const module_1 = require("./module");
|
|
7
7
|
const traverse_1 = require("./traverse");
|
|
8
|
-
async function
|
|
8
|
+
async function buildAppGraph(rootUri, ideps, entryPoints) {
|
|
9
9
|
const deps = (0, augment_1.augmentDependencies)(rootUri, ideps);
|
|
10
10
|
entryPoints =
|
|
11
11
|
entryPoints ??
|
|
12
12
|
(await (0, platformos_check_common_1.recursiveReadDirectory)(deps.fs, rootUri, ([uri]) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
|
|
18
|
-
return isTemplateFile || isSectionFile;
|
|
13
|
+
if (!uri.endsWith('.liquid'))
|
|
14
|
+
return false;
|
|
15
|
+
// Layouts are entry points — they wrap all page content.
|
|
16
|
+
// Pages are also entry points — they are directly requested.
|
|
17
|
+
return (0, platformos_check_common_1.isLayout)(uri) || (0, platformos_check_common_1.isPage)(uri);
|
|
19
18
|
}));
|
|
20
19
|
const graph = {
|
|
21
20
|
entryPoints: [],
|
package/dist/graph/build.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/graph/build.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/graph/build.ts"],"names":[],"mappings":";;AAYA,sCA6BC;AAzCD,iFAM6C;AAE7C,uCAAgD;AAChD,qCAAqC;AACrC,yCAA4C;AAErC,KAAK,UAAU,aAAa,CACjC,OAAkB,EAClB,KAAoB,EACpB,WAAyB;IAEzB,MAAM,IAAI,GAAG,IAAA,6BAAmB,EAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAEjD,WAAW;QACT,WAAW;YACX,CAAC,MAAM,IAAA,gDAAY,EAAC,IAAI,CAAC,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE;gBAC9C,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC;oBAAE,OAAO,KAAK,CAAC;gBAC3C,yDAAyD;gBACzD,6DAA6D;gBAC7D,OAAO,IAAA,kCAAQ,EAAC,GAAG,CAAC,IAAI,IAAA,gCAAM,EAAC,GAAG,CAAC,CAAC;YACtC,CAAC,CAAC,CAAC,CAAC;IAEN,MAAM,KAAK,GAAa;QACtB,WAAW,EAAE,EAAE;QACf,OAAO,EAAE,EAAE;QACX,OAAO;KACR,CAAC;IAEF,KAAK,CAAC,WAAW,GAAG,WAAW;SAC5B,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,kBAAS,EAAC,KAAK,EAAE,GAAG,CAAC,CAAC;SACnC,MAAM,CAAC,CAAC,CAAC,EAAkB,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC;IAElD,MAAM,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,yBAAc,EAAC,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IAExF,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/graph/module.d.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { UriString } from '@platformos/platformos-check-common';
|
|
2
|
-
import {
|
|
3
|
-
export declare function getModule(
|
|
4
|
-
export declare function
|
|
5
|
-
export declare function
|
|
6
|
-
export declare function
|
|
7
|
-
export declare function
|
|
8
|
-
export declare function getAssetModule(themeGraph: ThemeGraph, asset: string): JavaScriptModule | CssModule | SvgModule | ImageModule | undefined;
|
|
9
|
-
export declare function getPartialModule(themeGraph: ThemeGraph, partial: string): LiquidModule;
|
|
10
|
-
export declare function getLayoutModule(themeGraph: ThemeGraph, layoutName?: string | false | undefined): LiquidModule | undefined;
|
|
2
|
+
import { AssetModule, AppGraph, AppModule, LiquidModule } from '../types';
|
|
3
|
+
export declare function getModule(appGraph: AppGraph, uri: UriString): AppModule | undefined;
|
|
4
|
+
export declare function getAssetModule(appGraph: AppGraph, asset: string): AssetModule | undefined;
|
|
5
|
+
export declare function getPartialModule(appGraph: AppGraph, partial: string): LiquidModule;
|
|
6
|
+
export declare function getLayoutModule(appGraph: AppGraph, layoutUri: string | false | undefined): LiquidModule | undefined;
|
|
7
|
+
export declare function getPageModule(appGraph: AppGraph, pageUri: string): LiquidModule;
|
package/dist/graph/module.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getModule = getModule;
|
|
4
|
-
exports.getTemplateModule = getTemplateModule;
|
|
5
|
-
exports.getThemeBlockModule = getThemeBlockModule;
|
|
6
|
-
exports.getSectionModule = getSectionModule;
|
|
7
|
-
exports.getSectionGroupModule = getSectionGroupModule;
|
|
8
4
|
exports.getAssetModule = getAssetModule;
|
|
9
5
|
exports.getPartialModule = getPartialModule;
|
|
10
6
|
exports.getLayoutModule = getLayoutModule;
|
|
7
|
+
exports.getPageModule = getPageModule;
|
|
11
8
|
const platformos_check_common_1 = require("@platformos/platformos-check-common");
|
|
12
9
|
const types_1 = require("../types");
|
|
13
10
|
const utils_1 = require("../utils");
|
|
@@ -19,131 +16,59 @@ const utils_1 = require("../utils");
|
|
|
19
16
|
* graphs' modules record), we want to avoid creating two different module objects
|
|
20
17
|
* that represent the same file.
|
|
21
18
|
*
|
|
22
|
-
* We're using a WeakMap<
|
|
19
|
+
* We're using a WeakMap<AppGraph> to cache modules so that if the app graph
|
|
23
20
|
* gets garbage collected, the module cache will also be garbage collected.
|
|
24
21
|
*
|
|
25
22
|
* This allows us to have a module cache without changing the API of the
|
|
26
|
-
*
|
|
23
|
+
* AppGraph (no need for a `visited` property on modules, etc.)
|
|
27
24
|
*/
|
|
28
25
|
const ModuleCache = new WeakMap();
|
|
29
|
-
function getModule(
|
|
30
|
-
const cache = getCache(
|
|
26
|
+
function getModule(appGraph, uri) {
|
|
27
|
+
const cache = getCache(appGraph);
|
|
31
28
|
if (cache.has(uri)) {
|
|
32
29
|
return cache.get(uri);
|
|
33
30
|
}
|
|
34
|
-
const relativePath = platformos_check_common_1.path.relative(uri,
|
|
31
|
+
const relativePath = platformos_check_common_1.path.relative(uri, appGraph.rootUri);
|
|
35
32
|
switch (true) {
|
|
36
|
-
case
|
|
37
|
-
return
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
case relativePath.startsWith('
|
|
43
|
-
return
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
if (relativePath.endsWith('.json')) {
|
|
47
|
-
return getSectionGroupModule(themeGraph, platformos_check_common_1.path.basename(uri, '.json'));
|
|
48
|
-
}
|
|
49
|
-
return getSectionModule(themeGraph, platformos_check_common_1.path.basename(uri, '.liquid'));
|
|
50
|
-
}
|
|
51
|
-
case relativePath.includes('/views/partials') || relativePath.includes('/lib/'): {
|
|
52
|
-
return getPartialModule(themeGraph, platformos_check_common_1.path.basename(uri, '.liquid'));
|
|
53
|
-
}
|
|
54
|
-
case relativePath.startsWith('snippets'): {
|
|
55
|
-
return getPartialModule(themeGraph, platformos_check_common_1.path.basename(uri, '.liquid'));
|
|
56
|
-
}
|
|
57
|
-
case relativePath.startsWith('templates'): {
|
|
58
|
-
return getTemplateModule(themeGraph, uri);
|
|
59
|
-
}
|
|
33
|
+
case (0, platformos_check_common_1.isLayout)(uri):
|
|
34
|
+
return getLayoutModule(appGraph, uri);
|
|
35
|
+
case (0, platformos_check_common_1.isPage)(uri):
|
|
36
|
+
return getPageModule(appGraph, uri);
|
|
37
|
+
case (0, platformos_check_common_1.isPartial)(uri):
|
|
38
|
+
return getPartialModule(appGraph, platformos_check_common_1.path.basename(uri, '.liquid'));
|
|
39
|
+
case relativePath.startsWith('assets') || relativePath.startsWith('modules'):
|
|
40
|
+
return getAssetModule(appGraph, platformos_check_common_1.path.basename(uri));
|
|
41
|
+
case relativePath.startsWith('snippets'):
|
|
42
|
+
return getPartialModule(appGraph, platformos_check_common_1.path.basename(uri, '.liquid'));
|
|
60
43
|
}
|
|
61
44
|
}
|
|
62
|
-
function
|
|
63
|
-
const extension = (0, utils_1.extname)(uri);
|
|
64
|
-
switch (extension) {
|
|
65
|
-
case 'json': {
|
|
66
|
-
return module(themeGraph, {
|
|
67
|
-
type: "JSON" /* ModuleType.Json */,
|
|
68
|
-
kind: "template" /* JsonModuleKind.Template */,
|
|
69
|
-
dependencies: [],
|
|
70
|
-
references: [],
|
|
71
|
-
uri: uri,
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
case 'liquid': {
|
|
75
|
-
return module(themeGraph, {
|
|
76
|
-
type: "Liquid" /* ModuleType.Liquid */,
|
|
77
|
-
kind: "template" /* LiquidModuleKind.Template */,
|
|
78
|
-
dependencies: [],
|
|
79
|
-
references: [],
|
|
80
|
-
uri: uri,
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
default: {
|
|
84
|
-
throw new Error(`Unknown template type for ${uri}`);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
function getThemeBlockModule(themeGraph, blockType) {
|
|
89
|
-
const uri = platformos_check_common_1.path.join(themeGraph.rootUri, 'blocks', `${blockType}.liquid`);
|
|
90
|
-
return module(themeGraph, {
|
|
91
|
-
type: "Liquid" /* ModuleType.Liquid */,
|
|
92
|
-
kind: "block" /* LiquidModuleKind.Block */,
|
|
93
|
-
dependencies: [],
|
|
94
|
-
references: [],
|
|
95
|
-
uri,
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
function getSectionModule(themeGraph, sectionType) {
|
|
99
|
-
const uri = platformos_check_common_1.path.join(themeGraph.rootUri, 'sections', `${sectionType}.liquid`);
|
|
100
|
-
return module(themeGraph, {
|
|
101
|
-
type: "Liquid" /* ModuleType.Liquid */,
|
|
102
|
-
kind: "section" /* LiquidModuleKind.Section */,
|
|
103
|
-
dependencies: [],
|
|
104
|
-
references: [],
|
|
105
|
-
uri,
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
function getSectionGroupModule(themeGraph, sectionGroupType) {
|
|
109
|
-
const uri = platformos_check_common_1.path.join(themeGraph.rootUri, 'sections', `${sectionGroupType}.json`);
|
|
110
|
-
return module(themeGraph, {
|
|
111
|
-
type: "JSON" /* ModuleType.Json */,
|
|
112
|
-
kind: "section-group" /* JsonModuleKind.SectionGroup */,
|
|
113
|
-
dependencies: [],
|
|
114
|
-
references: [],
|
|
115
|
-
uri,
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
function getAssetModule(themeGraph, asset) {
|
|
45
|
+
function getAssetModule(appGraph, asset) {
|
|
119
46
|
const extension = (0, utils_1.extname)(asset);
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
if (!type) {
|
|
47
|
+
const SUPPORTED_ASSET_EXTENSIONS = [
|
|
48
|
+
...types_1.SUPPORTED_ASSET_IMAGE_EXTENSIONS,
|
|
49
|
+
'js',
|
|
50
|
+
'css',
|
|
51
|
+
'svg',
|
|
52
|
+
'pdf',
|
|
53
|
+
'woff',
|
|
54
|
+
'woff2',
|
|
55
|
+
'ttf',
|
|
56
|
+
'eot',
|
|
57
|
+
];
|
|
58
|
+
if (!SUPPORTED_ASSET_EXTENSIONS.includes(extension)) {
|
|
134
59
|
return undefined;
|
|
135
60
|
}
|
|
136
|
-
return module(
|
|
137
|
-
type
|
|
61
|
+
return module(appGraph, {
|
|
62
|
+
type: "Asset" /* ModuleType.Asset */,
|
|
138
63
|
kind: 'unused',
|
|
139
64
|
dependencies: [],
|
|
140
65
|
references: [],
|
|
141
|
-
uri: platformos_check_common_1.path.join(
|
|
66
|
+
uri: platformos_check_common_1.path.join(appGraph.rootUri, 'assets', asset),
|
|
142
67
|
});
|
|
143
68
|
}
|
|
144
|
-
function getPartialModule(
|
|
145
|
-
const uri = platformos_check_common_1.path.join(
|
|
146
|
-
return module(
|
|
69
|
+
function getPartialModule(appGraph, partial) {
|
|
70
|
+
const uri = platformos_check_common_1.path.join(appGraph.rootUri, 'app/views/partials', `${partial}.liquid`);
|
|
71
|
+
return module(appGraph, {
|
|
147
72
|
type: "Liquid" /* ModuleType.Liquid */,
|
|
148
73
|
kind: "partial" /* LiquidModuleKind.Partial */,
|
|
149
74
|
uri: uri,
|
|
@@ -151,28 +76,34 @@ function getPartialModule(themeGraph, partial) {
|
|
|
151
76
|
references: [],
|
|
152
77
|
});
|
|
153
78
|
}
|
|
154
|
-
function getLayoutModule(
|
|
155
|
-
if (
|
|
79
|
+
function getLayoutModule(appGraph, layoutUri) {
|
|
80
|
+
if (!layoutUri)
|
|
156
81
|
return undefined;
|
|
157
|
-
|
|
158
|
-
layoutName = 'theme';
|
|
159
|
-
const uri = platformos_check_common_1.path.join(themeGraph.rootUri, 'layout', `${layoutName}.liquid`);
|
|
160
|
-
return module(themeGraph, {
|
|
82
|
+
return module(appGraph, {
|
|
161
83
|
type: "Liquid" /* ModuleType.Liquid */,
|
|
162
84
|
kind: "layout" /* LiquidModuleKind.Layout */,
|
|
163
|
-
uri:
|
|
85
|
+
uri: layoutUri,
|
|
86
|
+
dependencies: [],
|
|
87
|
+
references: [],
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
function getPageModule(appGraph, pageUri) {
|
|
91
|
+
return module(appGraph, {
|
|
92
|
+
type: "Liquid" /* ModuleType.Liquid */,
|
|
93
|
+
kind: "page" /* LiquidModuleKind.Page */,
|
|
94
|
+
uri: pageUri,
|
|
164
95
|
dependencies: [],
|
|
165
96
|
references: [],
|
|
166
97
|
});
|
|
167
98
|
}
|
|
168
|
-
function getCache(
|
|
169
|
-
if (!ModuleCache.has(
|
|
170
|
-
ModuleCache.set(
|
|
99
|
+
function getCache(appGraph) {
|
|
100
|
+
if (!ModuleCache.has(appGraph)) {
|
|
101
|
+
ModuleCache.set(appGraph, new Map());
|
|
171
102
|
}
|
|
172
|
-
return ModuleCache.get(
|
|
103
|
+
return ModuleCache.get(appGraph);
|
|
173
104
|
}
|
|
174
|
-
function module(
|
|
175
|
-
const cache = getCache(
|
|
105
|
+
function module(appGraph, mod) {
|
|
106
|
+
const cache = getCache(appGraph);
|
|
176
107
|
if (!cache.has(mod.uri)) {
|
|
177
108
|
cache.set(mod.uri, mod);
|
|
178
109
|
}
|
package/dist/graph/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/graph/module.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/graph/module.ts"],"names":[],"mappings":";;AA4BA,8BAwBC;AAED,wCA0BC;AAED,4CASC;AAED,0CAYC;AAED,sCAQC;AAnHD,iFAAmG;AACnG,oCAQkB;AAClB,oCAAmC;AAEnC;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,GAA8C,IAAI,OAAO,EA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,UAAU,EAAE,EAAE;KACf,CAAC,CAAC;AACL,CAAC;AAED,SAAS,QAAQ,CAAC,QAAkB;IAClC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC/B,WAAW,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;IACvC,CAAC;IACD,OAAO,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAE,CAAC;AACpC,CAAC;AAED,SAAS,MAAM,CAAsB,QAAkB,EAAE,GAAM;IAC7D,MAAM,KAAK,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACjC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;QACxB,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAC1B,CAAC;IACD,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAO,CAAC;AAClC,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { SerializableGraph,
|
|
2
|
-
export declare function
|
|
1
|
+
import { SerializableGraph, AppGraph } from '../types';
|
|
2
|
+
export declare function serializeAppGraph(graph: AppGraph): SerializableGraph;
|
package/dist/graph/serialize.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
function
|
|
3
|
+
exports.serializeAppGraph = serializeAppGraph;
|
|
4
|
+
function serializeAppGraph(graph) {
|
|
5
5
|
const nodes = Object.values(graph.modules).map((module) => ({
|
|
6
6
|
uri: module.uri,
|
|
7
7
|
type: module.type,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serialize.js","sourceRoot":"","sources":["../../src/graph/serialize.ts"],"names":[],"mappings":";;AAEA,
|
|
1
|
+
{"version":3,"file":"serialize.js","sourceRoot":"","sources":["../../src/graph/serialize.ts"],"names":[],"mappings":";;AAEA,8CAiBC;AAjBD,SAAgB,iBAAiB,CAAC,KAAe;IAC/C,MAAM,KAAK,GAAuB,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAC9E,GAAG,EAAE,MAAM,CAAC,GAAG;QACf,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,GAAG,CAAC,QAAQ,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACzD,CAAC,CAAC,CAAC;IAEJ,MAAM,KAAK,GAAuB,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,OAAO,CACpE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,YAAY,CAChC,CAAC;IAEF,OAAO;QACL,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,KAAK;QACL,KAAK;KACN,CAAC;AACJ,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { SectionSchema, ThemeBlockSchema } from '@platformos/platformos-check-common';
|
|
2
1
|
import { AbstractFileSystem } from '@platformos/platformos-common';
|
|
3
2
|
export declare function makeGetSourceCode(fs: AbstractFileSystem): {
|
|
4
3
|
(x: string): Promise<import("..").FileSourceCode>;
|
|
@@ -10,18 +9,6 @@ export declare const fixturesRoot: string;
|
|
|
10
9
|
export declare const skeleton: string;
|
|
11
10
|
export declare function getDependencies(rootUri: string, fs?: AbstractFileSystem): Promise<{
|
|
12
11
|
fs: AbstractFileSystem;
|
|
13
|
-
getSectionSchema: {
|
|
14
|
-
(x: string): Promise<SectionSchema>;
|
|
15
|
-
force(x: string): Promise<SectionSchema>;
|
|
16
|
-
invalidate(x: string): void;
|
|
17
|
-
clearCache(): void;
|
|
18
|
-
};
|
|
19
|
-
getBlockSchema: {
|
|
20
|
-
(x: string): Promise<ThemeBlockSchema>;
|
|
21
|
-
force(x: string): Promise<ThemeBlockSchema>;
|
|
22
|
-
invalidate(x: string): void;
|
|
23
|
-
clearCache(): void;
|
|
24
|
-
};
|
|
25
12
|
getSourceCode: {
|
|
26
13
|
(x: string): Promise<import("..").FileSourceCode>;
|
|
27
14
|
force(x: string): Promise<import("..").FileSourceCode>;
|
|
@@ -23,16 +23,6 @@ async function getDependencies(rootUri, fs = platformos_check_node_1.NodeFileSys
|
|
|
23
23
|
const getSourceCode = makeGetSourceCode(fs);
|
|
24
24
|
const deps = {
|
|
25
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
26
|
getSourceCode,
|
|
37
27
|
getWebComponentDefinitionReference: (customElementName) => webComponentDefs.get(customElementName),
|
|
38
28
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-helpers.js","sourceRoot":"","sources":["../../src/graph/test-helpers.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"test-helpers.js","sourceRoot":"","sources":["../../src/graph/test-helpers.ts"],"names":[],"mappings":";;;AASA,8CAKC;AAKD,0CAYC;AAGD,4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,WAAE,CAAC,KAAK,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,kBAAkB,CAAC;QAC9C,OAAO,QAAQ,CAAC,QAAQ,EAAE,GAAG,SAAS,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/graph/traverse.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AugmentedDependencies,
|
|
2
|
-
export declare function traverseModule(module:
|
|
1
|
+
import { AugmentedDependencies, AppGraph, AppModule, Range, Reference, Void } from '../types';
|
|
2
|
+
export declare function traverseModule(module: AppModule, appGraph: AppGraph, deps: AugmentedDependencies): Promise<Void>;
|
|
3
3
|
/**
|
|
4
4
|
* The bind method is the method that links two modules together.
|
|
5
5
|
*
|
|
@@ -7,7 +7,7 @@ export declare function traverseModule(module: ThemeModule, themeGraph: ThemeGra
|
|
|
7
7
|
*
|
|
8
8
|
* This function mutates the source and target modules.
|
|
9
9
|
*/
|
|
10
|
-
export declare function bind(source:
|
|
10
|
+
export declare function bind(source: AppModule, target: AppModule, { sourceRange, targetRange, type, }?: {
|
|
11
11
|
sourceRange?: Range;
|
|
12
12
|
targetRange?: Range;
|
|
13
13
|
type?: Reference['type'];
|