@platformos/platformos-check-node 0.0.10 → 0.0.12

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.
@@ -28,6 +28,8 @@ function getPartialName(node) {
28
28
  * When the same argument has different types across calls, use 'object'.
29
29
  */
30
30
  function mergeArgument(existingArgs, arg) {
31
+ if (arg.value.type === liquid_html_parser_1.NodeTypes.NamedArgument)
32
+ return;
31
33
  const inferredType = (0, platformos_check_common_1.inferArgumentType)(arg.value);
32
34
  const existing = existingArgs.get(arg.name);
33
35
  if (existing) {
@@ -1,8 +1,12 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.loadThirdPartyChecks = loadThirdPartyChecks;
4
7
  exports.findThirdPartyChecks = findThirdPartyChecks;
5
8
  const glob_1 = require("glob");
9
+ const normalize_path_1 = __importDefault(require("normalize-path"));
6
10
  function loadThirdPartyChecks(
7
11
  /**
8
12
  * An array of require()-able paths.
@@ -39,8 +43,8 @@ modulePaths = []) {
39
43
  }
40
44
  async function findThirdPartyChecks(nodeModuleRoot) {
41
45
  const paths = [
42
- globJoin(nodeModuleRoot.replace(/\\/g, '/'), '/node_modules/platformos-check-*/'),
43
- globJoin(nodeModuleRoot.replace(/\\/g, '/'), '/node_modules/@*/platformos-check-*/'),
46
+ globJoin((0, normalize_path_1.default)(nodeModuleRoot), '/node_modules/platformos-check-*/'),
47
+ globJoin((0, normalize_path_1.default)(nodeModuleRoot), '/node_modules/@*/platformos-check-*/'),
44
48
  ];
45
49
  const results = await Promise.all(paths.map((path) => (0, glob_1.glob)(path)));
46
50
  return results
@@ -49,7 +53,7 @@ async function findThirdPartyChecks(nodeModuleRoot) {
49
53
  !/platformos-check-vscode/.test(x));
50
54
  }
51
55
  function globJoin(...parts) {
52
- return parts.flatMap((x) => x.replace(/\\/g, '/').replace(/\/+$/, '')).join('/');
56
+ return parts.flatMap((x) => (0, normalize_path_1.default)(x).replace(/\/+$/, '')).join('/');
53
57
  }
54
58
  function isObjLiteral(thing) {
55
59
  return thing !== null && typeof thing === 'object';
@@ -115,6 +115,11 @@ pathLike) {
115
115
  if (pathLike.startsWith('platformos-check:')) {
116
116
  return pathLike;
117
117
  }
118
+ // Support legacy shorthand YAML-symbol style: ':nothing', ':recommended', ':all'
119
+ const expanded = `platformos-check${pathLike}`;
120
+ if (pathLike.startsWith(':') && types_1.ModernIdentifiers.includes(expanded)) {
121
+ return expanded;
122
+ }
118
123
  return resolvePath(root, pathLike);
119
124
  }
120
125
  /**
package/dist/index.d.ts CHANGED
@@ -5,6 +5,7 @@ export * from '@platformos/platformos-check-common';
5
5
  export * from './config/types';
6
6
  export { NodeFileSystem };
7
7
  export { runBackfillDocsCLI } from './backfill-docs';
8
+ export declare function updateDocs(log?: (msg: string) => void): Promise<void>;
8
9
  export declare const loadConfig: typeof resolveConfig;
9
10
  export type AppCheckRun = {
10
11
  app: App;
package/dist/index.js CHANGED
@@ -18,6 +18,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
18
18
  };
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
20
  exports.runCheck = exports.loadConfig = exports.runBackfillDocsCLI = exports.NodeFileSystem = void 0;
21
+ exports.updateDocs = updateDocs;
21
22
  exports.toSourceCode = toSourceCode;
22
23
  exports.check = check;
23
24
  exports.checkAndAutofix = checkAndAutofix;
@@ -32,6 +33,7 @@ const promises_1 = __importDefault(require("node:fs/promises"));
32
33
  const node_path_1 = __importDefault(require("node:path"));
33
34
  const vscode_uri_1 = require("vscode-uri");
34
35
  const glob_1 = require("glob");
36
+ const normalize_path_1 = __importDefault(require("normalize-path"));
35
37
  const autofix_1 = require("./autofix");
36
38
  const config_1 = require("./config");
37
39
  const NodeFileSystem_1 = require("./NodeFileSystem");
@@ -41,6 +43,9 @@ __exportStar(require("@platformos/platformos-check-common"), exports);
41
43
  __exportStar(require("./config/types"), exports);
42
44
  var backfill_docs_1 = require("./backfill-docs");
43
45
  Object.defineProperty(exports, "runBackfillDocsCLI", { enumerable: true, get: function () { return backfill_docs_1.runBackfillDocsCLI; } });
46
+ async function updateDocs(log = () => { }) {
47
+ await (0, platformos_check_docs_updater_1.downloadPlatformOSLiquidDocs)(platformos_check_docs_updater_1.root, log);
48
+ }
44
49
  const loadConfig = async (configPath, root) => {
45
50
  configPath ??= await (0, config_1.findConfigPath)(root);
46
51
  return (0, config_1.loadConfig)(configPath, root);
@@ -106,7 +111,11 @@ async function getApp(config) {
106
111
  // as mentioned in the documentation of node-glob
107
112
  // the path is normalised and '\' are replaced with '/' and then passed to the glob function
108
113
  let normalizedGlob = getAppFilesPathPattern(config.rootUri);
109
- const paths = await (0, glob_1.glob)(normalizedGlob, { absolute: true }).then((result) => result.filter((filePath) => {
114
+ const paths = await (0, glob_1.glob)(normalizedGlob, { absolute: true }).then((result) => result
115
+ // Normalize backslashes to forward slashes so that isKnownLiquidFile() and
116
+ // isIgnored() regex/minimatch patterns (which use forward slashes) work on Windows.
117
+ .map(normalize_path_1.default)
118
+ .filter((filePath) => {
110
119
  // Global ignored paths should not be part of the app
111
120
  if ((0, platformos_check_common_1.isIgnored)(filePath, config))
112
121
  return false;
@@ -114,15 +123,17 @@ async function getApp(config) {
114
123
  // Generator templates, build artifacts, etc. are excluded.
115
124
  if (filePath.endsWith('.liquid') && !(0, platformos_check_common_1.isKnownLiquidFile)(filePath))
116
125
  return false;
126
+ // Only lint .graphql files that belong to a recognized platformOS GraphQL directory.
127
+ // Schema files, generator templates (e.g. ERB .graphql), etc. are excluded.
128
+ if (filePath.endsWith('.graphql') && !(0, platformos_check_common_1.isKnownGraphQLFile)(filePath))
129
+ return false;
117
130
  return true;
118
131
  }));
119
132
  const sourceCodes = await Promise.all(paths.map(toSourceCode));
120
133
  return sourceCodes.filter((x) => x !== undefined);
121
134
  }
122
135
  function getAppFilesPathPattern(rootUri) {
123
- return node_path_1.default
124
- .normalize(node_path_1.default.join((0, node_url_1.fileURLToPath)(rootUri), '**/*.{liquid,json,graphql,yml,yaml}'))
125
- .replace(/\\/g, '/');
136
+ return (0, normalize_path_1.default)(node_path_1.default.join((0, node_url_1.fileURLToPath)(rootUri), '**/*.{liquid,json,graphql,yml,yaml}'));
126
137
  }
127
138
  /** @deprecated Use appCheckRun instead */
128
139
  exports.runCheck = appCheckRun;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformos/platformos-check-node",
3
- "version": "0.0.10",
3
+ "version": "0.0.12",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "author": "platformOS",
@@ -33,9 +33,10 @@
33
33
  "type-check": "tsc --noEmit"
34
34
  },
35
35
  "dependencies": {
36
- "@platformos/platformos-check-common": "0.0.10",
37
- "@platformos/platformos-check-docs-updater": "0.0.10",
36
+ "@platformos/platformos-check-common": "0.0.12",
37
+ "@platformos/platformos-check-docs-updater": "0.0.12",
38
38
  "glob": "^13.0.0",
39
+ "normalize-path": "^3.0.0",
39
40
  "vscode-uri": "^3.1.0",
40
41
  "yaml": "^2.8.2"
41
42
  },