@platformos/platformos-common 0.0.9 → 0.0.11

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @platformos/platformos-common
2
2
 
3
+ ## 0.0.11
4
+
5
+ ### Patch Changes
6
+
7
+ - Beta release
8
+
9
+ ## 0.0.10
10
+
11
+ ### Patch Changes
12
+
13
+ - Beta release
14
+
3
15
  ## 0.0.9
4
16
 
5
17
  ### Patch Changes
package/CLAUDE.md ADDED
@@ -0,0 +1,70 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## Package Overview
6
+
7
+ `@platformos/platformos-common` is a shared library providing utilities used across the platformOS tools monorepo: file type classification, document/partial location resolution, translation loading, and the `AbstractFileSystem` interface for environment portability.
8
+
9
+ ## Commands
10
+
11
+ ```bash
12
+ # Build
13
+ yarn build
14
+
15
+ # Run tests (vitest)
16
+ yarn test
17
+
18
+ # Run a single test file
19
+ yarn test src/path-utils.spec.ts
20
+
21
+ # Type-check without emitting
22
+ yarn type-check
23
+ ```
24
+
25
+ ## Architecture
26
+
27
+ ### `AbstractFileSystem` (`AbstractFileSystem.ts`)
28
+
29
+ Interface that abstracts filesystem operations (`stat`, `readFile`, `readDirectory`) so the same logic runs in Node.js, the browser, and VS Code. All classes in this package depend on it rather than any concrete `fs` module. Consumers provide an implementation at construction time.
30
+
31
+ ### `path-utils.ts` — File type classification
32
+
33
+ `FILE_TYPE_DIRS` is the **single source of truth** for all platformOS directory names, mapping each `PlatformOSFileType` enum value to its canonical directory names (including legacy aliases from the server's `converters_config.rb`).
34
+
35
+ `TYPE_MATCHERS` pre-compiles one regex per type from `FILE_TYPE_DIRS`, matching both app-level paths (`/(app|marketplace_builder)/{dir}/`) and module paths (`/(public|private)/{dir}/`). This design prevents false positives — e.g. `app/lib/smses/file.liquid` resolves to `Partial`, not `Sms`, because `/(app|marketplace_builder)/lib/` matches `Partial` first.
36
+
37
+ Key exported functions:
38
+ - `getFileType(uri)` — returns `PlatformOSFileType | undefined`
39
+ - `getAppPaths(type)` — returns `app/`-prefixed search paths for a file type
40
+ - `getModulePaths(type, moduleName)` — returns all `{app/,}modules/{name}/{public,private}/` search paths
41
+ - `isKnownLiquidFile`, `isKnownGraphQLFile`, `isPartial`, `isPage`, `isLayout`, etc. — convenience predicates
42
+
43
+ When adding a new file type or directory alias, update only `FILE_TYPE_DIRS`. The regex matchers, `getAppPaths`, and `getModulePaths` all derive from it automatically.
44
+
45
+ ### `DocumentsLocator` (`documents-locator/DocumentsLocator.ts`)
46
+
47
+ Resolves a document reference (from Liquid tags like `render`, `function`, `include`, `graphql`, `asset`) to a concrete filesystem URI, and lists matching completions.
48
+
49
+ - `locate(rootUri, nodeType, fileName)` — tries all candidate search paths in order, returns the first URI that `stat()`s as a file. Handles the `modules/{name}/...` prefix convention by routing to module paths instead of app paths.
50
+ - `list(rootUri, nodeType, filePrefix)` — walks all candidate directories and returns sorted, de-duplicated relative names matching the prefix.
51
+
52
+ File suffixes are added automatically: `.liquid` for partials, `.graphql` for graphql. Assets have no extension filtering.
53
+
54
+ ### `TranslationProvider` (`translation-provider/TranslationProvider.ts`)
55
+
56
+ Loads and searches platformOS YAML translation files.
57
+
58
+ Two file layouts are supported for each locale and translation base directory:
59
+ - **Single file**: `{base}/{locale}.yml`
60
+ - **Split files**: `{base}/{locale}/*.yml`
61
+
62
+ Both are checked in every method. `loadAllTranslationsForBase` deep-merges all files for a locale and accepts an optional `contentOverride` callback (used by editor integrations to honour unsaved buffer content). `findTranslationFile` returns the URI + stripped key for a given translation key. `translate` resolves a key to its string value.
63
+
64
+ Module translation keys use the prefix `modules/{name}/...`; these are routed to the module translation directories (`app/modules/{name}/public/translations`, etc.).
65
+
66
+ ## Key Invariants
67
+
68
+ - **URIs, not filesystem paths**: all public APIs use `UriString` (a `vscode-uri`-compatible `file://...` string), never raw OS paths.
69
+ - **Do not add environment-specific imports** (`fs`, `path`, etc.) — this package must remain browser-safe.
70
+ - `FILE_TYPE_DIRS` drives both classification and search path generation. Keep it in sync with the server's `converters_config.rb`.
@@ -8,57 +8,96 @@
8
8
  * - getFileType() classifies any URI to a PlatformOSFileType
9
9
  * - isPage(), isLayout(), isPartial() etc. are convenience wrappers around getFileType()
10
10
  *
11
- * Pattern precision: each type uses exact path segment patterns (/app/{dir}/ or
12
- * /(public|private)/{dir}/) so that nested paths don't produce false positives.
13
- * For example, app/lib/smses/file.liquid is correctly identified as Partial
14
- * (matches /app/lib/), not Sms (does not match /app/smses/).
11
+ * Source of truth: app/services/app_builder/services/converters_config.rb and
12
+ * app/models/concerns/deployable.rb in the platformOS server codebase.
13
+ *
14
+ * DIR_PREFIX (Ruby): ^/?((marketplace_builder|app)/|modules/(.+)(private|public)/)?
15
+ * This means files can live under:
16
+ * - app/{dir}/
17
+ * - marketplace_builder/{dir}/ (legacy alias for app/)
18
+ * - modules/{name}/(public|private)/{dir}/
19
+ * - app/modules/{name}/(public|private)/{dir}/
15
20
  */
16
21
  import { UriString } from './AbstractFileSystem';
17
22
  /**
18
- * File types that exist in a platformOS app, each mapping to one or more
19
- * canonical directory names relative to the app root or module access level.
23
+ * File types that exist in a platformOS app, each corresponding to a server-side
24
+ * converter that processes the file on deploy.
25
+ *
26
+ * Liquid types: Page, Layout, Partial, Authorization, Email, ApiCall, Sms, Migration, FormConfiguration
27
+ * YAML types: CustomModelType, InstanceProfileType, TransactableType, Translation
28
+ * GraphQL types: GraphQL
29
+ * Binary/other: Asset
20
30
  */
21
31
  export declare enum PlatformOSFileType {
32
+ /** views/pages/ or pages/ → PageConverter */
22
33
  Page = "Page",
34
+ /** views/layouts/ → LiquidViewConverter (layouts) */
23
35
  Layout = "Layout",
36
+ /** views/partials/ or lib/ → LiquidViewConverter (partials) */
24
37
  Partial = "Partial",
38
+ /** authorization_policies/ → AuthorizationPolicyConverter */
25
39
  Authorization = "Authorization",
40
+ /** emails/ or notifications/email_notifications/ → EmailNotificationConverter */
26
41
  Email = "Email",
42
+ /** api_calls/ or notifications/api_call_notifications/ → ApiCallNotificationConverter */
27
43
  ApiCall = "ApiCall",
44
+ /** smses/ or notifications/sms_notifications/ → SmsNotificationConverter */
28
45
  Sms = "Sms",
46
+ /** migrations/ → MigrationConverter */
29
47
  Migration = "Migration",
48
+ /** form_configurations/ or forms/ → FormConfigurationConverter */
49
+ FormConfiguration = "FormConfiguration",
50
+ /** custom_model_types/, model_schemas/, or schema/ → CustomModelTypeConverter */
51
+ CustomModelType = "CustomModelType",
52
+ /** instance_profile_types/, user_profile_types/, or user_profile_schemas/ → InstanceProfileTypeConverter */
53
+ InstanceProfileType = "InstanceProfileType",
54
+ /** transactable_types/ → TransactableTypeConverter */
55
+ TransactableType = "TransactableType",
56
+ /** translations/ → TranslationConverter */
57
+ Translation = "Translation",
58
+ /** graphql/ or graph_queries/ → GraphQueryConverter */
30
59
  GraphQL = "GraphQL",
60
+ /** assets/ → AssetConverter */
31
61
  Asset = "Asset"
32
62
  }
33
63
  /**
34
64
  * The single source of truth for the platformOS directory structure.
35
65
  *
36
66
  * Maps each file type to its canonical directory name(s) relative to:
37
- * - the app root: app/{dir}/
67
+ * - the app root: (app|marketplace_builder)/{dir}/
38
68
  * - a module access level: modules/{name}/(public|private)/{dir}/
39
69
  * - a nested module access level: app/modules/{name}/(public|private)/{dir}/
40
70
  *
71
+ * Multiple dirs per type represent canonical + legacy aliases from the server
72
+ * converters_config.rb FULL_PHYSICAL_PATH regexes.
73
+ *
41
74
  * Types with multiple dirs (e.g. Partial) will match any of their dirs.
42
- * The first matching type wins, so order of evaluation matters for overlapping
43
- * paths — but exact segment matching means dirs don't overlap in practice.
75
+ * Order within each array doesn't matter for matching. Across types,
76
+ * exact segment matching prevents false positives between overlapping paths
77
+ * (e.g. app/lib/smses/ → Partial, not Sms).
44
78
  */
45
79
  export declare const FILE_TYPE_DIRS: Readonly<Record<PlatformOSFileType, readonly string[]>>;
46
80
  /**
47
81
  * Returns the PlatformOSFileType for the given URI, or undefined if the URI
48
82
  * does not belong to any recognized platformOS directory.
49
83
  *
84
+ * Supports both modern (app/) and legacy (marketplace_builder/) app roots,
85
+ * as well as module paths (modules/{name}/public|private/).
86
+ *
50
87
  * @example
51
- * getFileType('file:///root/app/lib/smses/notify.liquid') // → PlatformOSFileType.Partial
52
- * getFileType('file:///root/app/smses/notify.liquid') // → PlatformOSFileType.Sms
88
+ * getFileType('file:///root/app/lib/smses/notify.liquid') // → Partial
89
+ * getFileType('file:///root/app/smses/notify.liquid') // → Sms
90
+ * getFileType('file:///root/marketplace_builder/views/pages/home.liquid') // → Page
53
91
  * getFileType('file:///root/modules/core/generators/templates/lib/create.liquid') // → undefined
54
92
  */
55
93
  export declare function getFileType(uri: UriString): PlatformOSFileType | undefined;
56
94
  /**
57
95
  * Returns app-level search paths for a file type (relative to project root).
96
+ * Uses the modern `app/` root (not the legacy `marketplace_builder/` alias).
58
97
  *
59
98
  * @example
60
99
  * getAppPaths(PlatformOSFileType.Partial) // → ['app/views/partials', 'app/lib']
61
- * getAppPaths(PlatformOSFileType.GraphQL) // → ['app/graphql']
100
+ * getAppPaths(PlatformOSFileType.GraphQL) // → ['app/graphql', 'app/graph_queries']
62
101
  */
63
102
  export declare function getAppPaths(type: PlatformOSFileType): string[];
64
103
  /**
@@ -73,9 +112,7 @@ export declare function getAppPaths(type: PlatformOSFileType): string[];
73
112
  * 'modules/core/public/views/partials',
74
113
  * 'modules/core/private/views/partials',
75
114
  * 'app/modules/core/public/lib',
76
- * 'app/modules/core/private/lib',
77
- * 'modules/core/public/lib',
78
- * 'modules/core/private/lib',
115
+ * ...
79
116
  * ]
80
117
  */
81
118
  export declare function getModulePaths(type: PlatformOSFileType, moduleName: string): string[];
@@ -85,6 +122,12 @@ export declare function getModulePaths(type: PlatformOSFileType, moduleName: str
85
122
  * templates, build artifacts) return false and are excluded from linting.
86
123
  */
87
124
  export declare function isKnownLiquidFile(uri: UriString): boolean;
125
+ /**
126
+ * Returns true if the URI belongs to a recognized platformOS GraphQL directory
127
+ * and should be linted. Files outside known directories (e.g. generator
128
+ * templates, schema files, ERB templates) return false and are excluded.
129
+ */
130
+ export declare function isKnownGraphQLFile(uri: UriString): boolean;
88
131
  export declare function isPartial(uri: UriString): boolean;
89
132
  export declare function isPage(uri: UriString): boolean;
90
133
  export declare function isLayout(uri: UriString): boolean;
@@ -93,5 +136,4 @@ export declare function isEmail(uri: UriString): boolean;
93
136
  export declare function isApiCall(uri: UriString): boolean;
94
137
  export declare function isSms(uri: UriString): boolean;
95
138
  export declare function isMigration(uri: UriString): boolean;
96
- /** @deprecated Use isPartial instead */
97
- export declare const isSnippet: typeof isPartial;
139
+ export declare function isFormConfiguration(uri: UriString): boolean;
@@ -9,17 +9,23 @@
9
9
  * - getFileType() classifies any URI to a PlatformOSFileType
10
10
  * - isPage(), isLayout(), isPartial() etc. are convenience wrappers around getFileType()
11
11
  *
12
- * Pattern precision: each type uses exact path segment patterns (/app/{dir}/ or
13
- * /(public|private)/{dir}/) so that nested paths don't produce false positives.
14
- * For example, app/lib/smses/file.liquid is correctly identified as Partial
15
- * (matches /app/lib/), not Sms (does not match /app/smses/).
12
+ * Source of truth: app/services/app_builder/services/converters_config.rb and
13
+ * app/models/concerns/deployable.rb in the platformOS server codebase.
14
+ *
15
+ * DIR_PREFIX (Ruby): ^/?((marketplace_builder|app)/|modules/(.+)(private|public)/)?
16
+ * This means files can live under:
17
+ * - app/{dir}/
18
+ * - marketplace_builder/{dir}/ (legacy alias for app/)
19
+ * - modules/{name}/(public|private)/{dir}/
20
+ * - app/modules/{name}/(public|private)/{dir}/
16
21
  */
17
22
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.isSnippet = exports.FILE_TYPE_DIRS = exports.PlatformOSFileType = void 0;
23
+ exports.FILE_TYPE_DIRS = exports.PlatformOSFileType = void 0;
19
24
  exports.getFileType = getFileType;
20
25
  exports.getAppPaths = getAppPaths;
21
26
  exports.getModulePaths = getModulePaths;
22
27
  exports.isKnownLiquidFile = isKnownLiquidFile;
28
+ exports.isKnownGraphQLFile = isKnownGraphQLFile;
23
29
  exports.isPartial = isPartial;
24
30
  exports.isPage = isPage;
25
31
  exports.isLayout = isLayout;
@@ -28,50 +34,98 @@ exports.isEmail = isEmail;
28
34
  exports.isApiCall = isApiCall;
29
35
  exports.isSms = isSms;
30
36
  exports.isMigration = isMigration;
37
+ exports.isFormConfiguration = isFormConfiguration;
31
38
  /**
32
- * File types that exist in a platformOS app, each mapping to one or more
33
- * canonical directory names relative to the app root or module access level.
39
+ * File types that exist in a platformOS app, each corresponding to a server-side
40
+ * converter that processes the file on deploy.
41
+ *
42
+ * Liquid types: Page, Layout, Partial, Authorization, Email, ApiCall, Sms, Migration, FormConfiguration
43
+ * YAML types: CustomModelType, InstanceProfileType, TransactableType, Translation
44
+ * GraphQL types: GraphQL
45
+ * Binary/other: Asset
34
46
  */
35
47
  var PlatformOSFileType;
36
48
  (function (PlatformOSFileType) {
49
+ // ── Liquid ──────────────────────────────────────────────────────────────────
50
+ /** views/pages/ or pages/ → PageConverter */
37
51
  PlatformOSFileType["Page"] = "Page";
52
+ /** views/layouts/ → LiquidViewConverter (layouts) */
38
53
  PlatformOSFileType["Layout"] = "Layout";
54
+ /** views/partials/ or lib/ → LiquidViewConverter (partials) */
39
55
  PlatformOSFileType["Partial"] = "Partial";
56
+ /** authorization_policies/ → AuthorizationPolicyConverter */
40
57
  PlatformOSFileType["Authorization"] = "Authorization";
58
+ /** emails/ or notifications/email_notifications/ → EmailNotificationConverter */
41
59
  PlatformOSFileType["Email"] = "Email";
60
+ /** api_calls/ or notifications/api_call_notifications/ → ApiCallNotificationConverter */
42
61
  PlatformOSFileType["ApiCall"] = "ApiCall";
62
+ /** smses/ or notifications/sms_notifications/ → SmsNotificationConverter */
43
63
  PlatformOSFileType["Sms"] = "Sms";
64
+ /** migrations/ → MigrationConverter */
44
65
  PlatformOSFileType["Migration"] = "Migration";
66
+ /** form_configurations/ or forms/ → FormConfigurationConverter */
67
+ PlatformOSFileType["FormConfiguration"] = "FormConfiguration";
68
+ // ── YAML ────────────────────────────────────────────────────────────────────
69
+ /** custom_model_types/, model_schemas/, or schema/ → CustomModelTypeConverter */
70
+ PlatformOSFileType["CustomModelType"] = "CustomModelType";
71
+ /** instance_profile_types/, user_profile_types/, or user_profile_schemas/ → InstanceProfileTypeConverter */
72
+ PlatformOSFileType["InstanceProfileType"] = "InstanceProfileType";
73
+ /** transactable_types/ → TransactableTypeConverter */
74
+ PlatformOSFileType["TransactableType"] = "TransactableType";
75
+ /** translations/ → TranslationConverter */
76
+ PlatformOSFileType["Translation"] = "Translation";
77
+ // ── GraphQL ─────────────────────────────────────────────────────────────────
78
+ /** graphql/ or graph_queries/ → GraphQueryConverter */
45
79
  PlatformOSFileType["GraphQL"] = "GraphQL";
80
+ // ── Binary/other ────────────────────────────────────────────────────────────
81
+ /** assets/ → AssetConverter */
46
82
  PlatformOSFileType["Asset"] = "Asset";
47
83
  })(PlatformOSFileType || (exports.PlatformOSFileType = PlatformOSFileType = {}));
48
84
  /**
49
85
  * The single source of truth for the platformOS directory structure.
50
86
  *
51
87
  * Maps each file type to its canonical directory name(s) relative to:
52
- * - the app root: app/{dir}/
88
+ * - the app root: (app|marketplace_builder)/{dir}/
53
89
  * - a module access level: modules/{name}/(public|private)/{dir}/
54
90
  * - a nested module access level: app/modules/{name}/(public|private)/{dir}/
55
91
  *
92
+ * Multiple dirs per type represent canonical + legacy aliases from the server
93
+ * converters_config.rb FULL_PHYSICAL_PATH regexes.
94
+ *
56
95
  * Types with multiple dirs (e.g. Partial) will match any of their dirs.
57
- * The first matching type wins, so order of evaluation matters for overlapping
58
- * paths — but exact segment matching means dirs don't overlap in practice.
96
+ * Order within each array doesn't matter for matching. Across types,
97
+ * exact segment matching prevents false positives between overlapping paths
98
+ * (e.g. app/lib/smses/ → Partial, not Sms).
59
99
  */
60
100
  exports.FILE_TYPE_DIRS = {
61
- [PlatformOSFileType.Page]: ['views/pages'],
101
+ // Liquid
102
+ [PlatformOSFileType.Page]: ['views/pages', 'pages'],
62
103
  [PlatformOSFileType.Layout]: ['views/layouts'],
63
104
  [PlatformOSFileType.Partial]: ['views/partials', 'lib'],
64
105
  [PlatformOSFileType.Authorization]: ['authorization_policies'],
65
- [PlatformOSFileType.Email]: ['emails'],
66
- [PlatformOSFileType.ApiCall]: ['api_calls'],
67
- [PlatformOSFileType.Sms]: ['smses'],
106
+ [PlatformOSFileType.Email]: ['emails', 'notifications/email_notifications'],
107
+ [PlatformOSFileType.ApiCall]: ['api_calls', 'notifications/api_call_notifications'],
108
+ [PlatformOSFileType.Sms]: ['smses', 'notifications/sms_notifications'],
68
109
  [PlatformOSFileType.Migration]: ['migrations'],
69
- [PlatformOSFileType.GraphQL]: ['graphql'],
110
+ [PlatformOSFileType.FormConfiguration]: ['form_configurations', 'forms'],
111
+ // YAML
112
+ [PlatformOSFileType.CustomModelType]: ['custom_model_types', 'model_schemas', 'schema'],
113
+ [PlatformOSFileType.InstanceProfileType]: [
114
+ 'instance_profile_types',
115
+ 'user_profile_types',
116
+ 'user_profile_schemas',
117
+ ],
118
+ [PlatformOSFileType.TransactableType]: ['transactable_types'],
119
+ [PlatformOSFileType.Translation]: ['translations'],
120
+ // GraphQL
121
+ [PlatformOSFileType.GraphQL]: ['graphql', 'graph_queries'],
122
+ // Asset
70
123
  [PlatformOSFileType.Asset]: ['assets'],
71
124
  };
72
125
  /**
73
- * Liquid-containing file types. GraphQL and Asset are excluded because they
74
- * don't contain Liquid code and should not be passed to the Liquid linter.
126
+ * Liquid-containing file types. GraphQL, Asset, and YAML types are excluded
127
+ * because they don't contain Liquid code and should not be passed to the
128
+ * Liquid linter.
75
129
  */
76
130
  const LIQUID_FILE_TYPES = new Set([
77
131
  PlatformOSFileType.Page,
@@ -82,31 +136,39 @@ const LIQUID_FILE_TYPES = new Set([
82
136
  PlatformOSFileType.ApiCall,
83
137
  PlatformOSFileType.Sms,
84
138
  PlatformOSFileType.Migration,
139
+ PlatformOSFileType.FormConfiguration,
85
140
  ]);
86
141
  /**
87
142
  * Pre-compiled regex per file type, derived entirely from FILE_TYPE_DIRS.
88
143
  *
89
- * For each canonical dir, two pattern alternatives are generated:
90
- * /app/{dir}/ — direct app-level path (e.g. /app/lib/)
91
- * /(public|private)/{dir}/ — module path, covers both:
92
- * modules/{name}/(public|private)/{dir}/
93
- * app/modules/{name}/(public|private)/{dir}/
144
+ * For each canonical dir, three pattern alternatives are generated:
145
+ * /(app|marketplace_builder)/{dir}/ — direct app-level path (modern + legacy root)
146
+ * /(public|private)/{dir}/ — module path, covers both:
147
+ * modules/{name}/(public|private)/{dir}/
148
+ * app/modules/{name}/(public|private)/{dir}/
94
149
  *
95
150
  * Exact path segment matching prevents false positives:
96
151
  * /app/lib/smses/file.liquid → matches /app/lib/ → Partial (NOT Sms)
97
152
  * /app/smses/file.liquid → matches /app/smses/ → Sms (NOT Partial)
98
153
  */
99
154
  const TYPE_MATCHERS = new Map(Object.entries(exports.FILE_TYPE_DIRS).map(([type, dirs]) => {
100
- const alternatives = dirs.flatMap((dir) => [`/app/${dir}/`, `/(public|private)/${dir}/`]);
155
+ const alternatives = dirs.flatMap((dir) => [
156
+ `/(app|marketplace_builder)/${dir}/`,
157
+ `/(public|private)/${dir}/`,
158
+ ]);
101
159
  return [type, new RegExp(alternatives.join('|'))];
102
160
  }));
103
161
  /**
104
162
  * Returns the PlatformOSFileType for the given URI, or undefined if the URI
105
163
  * does not belong to any recognized platformOS directory.
106
164
  *
165
+ * Supports both modern (app/) and legacy (marketplace_builder/) app roots,
166
+ * as well as module paths (modules/{name}/public|private/).
167
+ *
107
168
  * @example
108
- * getFileType('file:///root/app/lib/smses/notify.liquid') // → PlatformOSFileType.Partial
109
- * getFileType('file:///root/app/smses/notify.liquid') // → PlatformOSFileType.Sms
169
+ * getFileType('file:///root/app/lib/smses/notify.liquid') // → Partial
170
+ * getFileType('file:///root/app/smses/notify.liquid') // → Sms
171
+ * getFileType('file:///root/marketplace_builder/views/pages/home.liquid') // → Page
110
172
  * getFileType('file:///root/modules/core/generators/templates/lib/create.liquid') // → undefined
111
173
  */
112
174
  function getFileType(uri) {
@@ -118,10 +180,11 @@ function getFileType(uri) {
118
180
  }
119
181
  /**
120
182
  * Returns app-level search paths for a file type (relative to project root).
183
+ * Uses the modern `app/` root (not the legacy `marketplace_builder/` alias).
121
184
  *
122
185
  * @example
123
186
  * getAppPaths(PlatformOSFileType.Partial) // → ['app/views/partials', 'app/lib']
124
- * getAppPaths(PlatformOSFileType.GraphQL) // → ['app/graphql']
187
+ * getAppPaths(PlatformOSFileType.GraphQL) // → ['app/graphql', 'app/graph_queries']
125
188
  */
126
189
  function getAppPaths(type) {
127
190
  return exports.FILE_TYPE_DIRS[type].map((dir) => `app/${dir}`);
@@ -138,9 +201,7 @@ function getAppPaths(type) {
138
201
  * 'modules/core/public/views/partials',
139
202
  * 'modules/core/private/views/partials',
140
203
  * 'app/modules/core/public/lib',
141
- * 'app/modules/core/private/lib',
142
- * 'modules/core/public/lib',
143
- * 'modules/core/private/lib',
204
+ * ...
144
205
  * ]
145
206
  */
146
207
  function getModulePaths(type, moduleName) {
@@ -160,6 +221,14 @@ function isKnownLiquidFile(uri) {
160
221
  const type = getFileType(uri);
161
222
  return type !== undefined && LIQUID_FILE_TYPES.has(type);
162
223
  }
224
+ /**
225
+ * Returns true if the URI belongs to a recognized platformOS GraphQL directory
226
+ * and should be linted. Files outside known directories (e.g. generator
227
+ * templates, schema files, ERB templates) return false and are excluded.
228
+ */
229
+ function isKnownGraphQLFile(uri) {
230
+ return getFileType(uri) === PlatformOSFileType.GraphQL;
231
+ }
163
232
  function isPartial(uri) {
164
233
  return getFileType(uri) === PlatformOSFileType.Partial;
165
234
  }
@@ -184,6 +253,7 @@ function isSms(uri) {
184
253
  function isMigration(uri) {
185
254
  return getFileType(uri) === PlatformOSFileType.Migration;
186
255
  }
187
- /** @deprecated Use isPartial instead */
188
- exports.isSnippet = isPartial;
256
+ function isFormConfiguration(uri) {
257
+ return getFileType(uri) === PlatformOSFileType.FormConfiguration;
258
+ }
189
259
  //# sourceMappingURL=path-utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"path-utils.js","sourceRoot":"","sources":["../src/path-utils.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AA4FH,kCAKC;AASD,kCAEC;AAmBD,wCAOC;AAOD,8CAGC;AAED,8BAEC;AAED,wBAEC;AAED,4BAEC;AAED,0CAEC;AAED,0BAEC;AAED,8BAEC;AAED,sBAEC;AAED,kCAEC;AA5KD;;;GAGG;AACH,IAAY,kBAWX;AAXD,WAAY,kBAAkB;IAC5B,mCAAa,CAAA;IACb,uCAAiB,CAAA;IACjB,yCAAmB,CAAA;IACnB,qDAA+B,CAAA;IAC/B,qCAAe,CAAA;IACf,yCAAmB,CAAA;IACnB,iCAAW,CAAA;IACX,6CAAuB,CAAA;IACvB,yCAAmB,CAAA;IACnB,qCAAe,CAAA;AACjB,CAAC,EAXW,kBAAkB,kCAAlB,kBAAkB,QAW7B;AAED;;;;;;;;;;;GAWG;AACU,QAAA,cAAc,GAA4D;IACrF,CAAC,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC;IAC1C,CAAC,kBAAkB,CAAC,MAAM,CAAC,EAAE,CAAC,eAAe,CAAC;IAC9C,CAAC,kBAAkB,CAAC,OAAO,CAAC,EAAE,CAAC,gBAAgB,EAAE,KAAK,CAAC;IACvD,CAAC,kBAAkB,CAAC,aAAa,CAAC,EAAE,CAAC,wBAAwB,CAAC;IAC9D,CAAC,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC,QAAQ,CAAC;IACtC,CAAC,kBAAkB,CAAC,OAAO,CAAC,EAAE,CAAC,WAAW,CAAC;IAC3C,CAAC,kBAAkB,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,CAAC;IACnC,CAAC,kBAAkB,CAAC,SAAS,CAAC,EAAE,CAAC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