@platformos/platformos-check-node 0.0.8 → 0.0.10
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { App } from '@platformos/platformos-check-common';
|
|
2
2
|
import { PartialUsage } from './types';
|
|
3
3
|
/**
|
|
4
|
-
* Collect all partial usages from
|
|
4
|
+
* Collect all partial usages from an app by visiting function, render, and include tags.
|
|
5
5
|
*/
|
|
6
|
-
export declare function collectPartialUsages(
|
|
6
|
+
export declare function collectPartialUsages(app: App, verbose?: boolean, log?: (message: string) => void): Promise<Map<string, PartialUsage>>;
|
|
@@ -10,8 +10,8 @@ const liquid_html_parser_2 = require("@platformos/liquid-html-parser");
|
|
|
10
10
|
*/
|
|
11
11
|
function getPartialName(node) {
|
|
12
12
|
if (node.type === liquid_html_parser_1.NodeTypes.RenderMarkup) {
|
|
13
|
-
if (node.
|
|
14
|
-
return node.
|
|
13
|
+
if (node.partial.type === liquid_html_parser_1.NodeTypes.String) {
|
|
14
|
+
return node.partial.value;
|
|
15
15
|
}
|
|
16
16
|
return undefined;
|
|
17
17
|
}
|
|
@@ -63,11 +63,11 @@ function parseUsageKey(key) {
|
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
65
|
/**
|
|
66
|
-
* Collect all partial usages from
|
|
66
|
+
* Collect all partial usages from an app by visiting function, render, and include tags.
|
|
67
67
|
*/
|
|
68
|
-
async function collectPartialUsages(
|
|
68
|
+
async function collectPartialUsages(app, verbose = false, log = console.log) {
|
|
69
69
|
const usageMap = new Map();
|
|
70
|
-
for (const sourceCode of
|
|
70
|
+
for (const sourceCode of app) {
|
|
71
71
|
if (sourceCode.type !== platformos_check_common_1.SourceCodeType.LiquidHtml)
|
|
72
72
|
continue;
|
|
73
73
|
if (!(0, liquid_html_parser_2.isLiquidHtmlNode)(sourceCode.ast))
|
package/dist/index.d.ts
CHANGED
|
@@ -23,5 +23,3 @@ export declare function getApp(config: Config): Promise<App>;
|
|
|
23
23
|
export declare function getAppFilesPathPattern(rootUri: string): string;
|
|
24
24
|
/** @deprecated Use appCheckRun instead */
|
|
25
25
|
export declare const runCheck: typeof appCheckRun;
|
|
26
|
-
/** @deprecated Use appCheckRun instead */
|
|
27
|
-
export declare const themeCheckRun: typeof appCheckRun;
|
package/dist/index.js
CHANGED
|
@@ -17,7 +17,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
17
17
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
18
|
};
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.
|
|
20
|
+
exports.runCheck = exports.loadConfig = exports.runBackfillDocsCLI = exports.NodeFileSystem = void 0;
|
|
21
21
|
exports.toSourceCode = toSourceCode;
|
|
22
22
|
exports.check = check;
|
|
23
23
|
exports.checkAndAutofix = checkAndAutofix;
|
|
@@ -106,9 +106,16 @@ async function getApp(config) {
|
|
|
106
106
|
// as mentioned in the documentation of node-glob
|
|
107
107
|
// the path is normalised and '\' are replaced with '/' and then passed to the glob function
|
|
108
108
|
let normalizedGlob = getAppFilesPathPattern(config.rootUri);
|
|
109
|
-
const paths = await (0, glob_1.glob)(normalizedGlob, { absolute: true }).then((result) =>
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
const paths = await (0, glob_1.glob)(normalizedGlob, { absolute: true }).then((result) => result.filter((filePath) => {
|
|
110
|
+
// Global ignored paths should not be part of the app
|
|
111
|
+
if ((0, platformos_check_common_1.isIgnored)(filePath, config))
|
|
112
|
+
return false;
|
|
113
|
+
// Only lint .liquid files that belong to a recognized platformOS directory.
|
|
114
|
+
// Generator templates, build artifacts, etc. are excluded.
|
|
115
|
+
if (filePath.endsWith('.liquid') && !(0, platformos_check_common_1.isKnownLiquidFile)(filePath))
|
|
116
|
+
return false;
|
|
117
|
+
return true;
|
|
118
|
+
}));
|
|
112
119
|
const sourceCodes = await Promise.all(paths.map(toSourceCode));
|
|
113
120
|
return sourceCodes.filter((x) => x !== undefined);
|
|
114
121
|
}
|
|
@@ -119,6 +126,4 @@ function getAppFilesPathPattern(rootUri) {
|
|
|
119
126
|
}
|
|
120
127
|
/** @deprecated Use appCheckRun instead */
|
|
121
128
|
exports.runCheck = appCheckRun;
|
|
122
|
-
/** @deprecated Use appCheckRun instead */
|
|
123
|
-
exports.themeCheckRun = appCheckRun;
|
|
124
129
|
//# sourceMappingURL=index.js.map
|
|
@@ -57,7 +57,7 @@ async function createMockNodeModule(tempDir, moduleName, moduleContent = exports
|
|
|
57
57
|
return nodeModuleRoot;
|
|
58
58
|
}
|
|
59
59
|
async function makeTempWorkspace(structure) {
|
|
60
|
-
const root = await promises_1.default.mkdtemp(node_path_1.default.join(
|
|
60
|
+
const root = await promises_1.default.mkdtemp(node_path_1.default.join(node_os_1.default.tmpdir(), 'platformos-check-'));
|
|
61
61
|
if (!root)
|
|
62
62
|
throw new Error('Could not create temp dir for temp workspace');
|
|
63
63
|
await createFiles(structure, [root]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platformos/platformos-check-node",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"author": "platformOS",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"type-check": "tsc --noEmit"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@platformos/platformos-check-common": "0.0.
|
|
37
|
-
"@platformos/platformos-check-docs-updater": "0.0.
|
|
36
|
+
"@platformos/platformos-check-common": "0.0.10",
|
|
37
|
+
"@platformos/platformos-check-docs-updater": "0.0.10",
|
|
38
38
|
"glob": "^13.0.0",
|
|
39
39
|
"vscode-uri": "^3.1.0",
|
|
40
40
|
"yaml": "^2.8.2"
|