@syncify/cli 0.3.0-beta → 1.0.0-alpha.1

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.
Files changed (41) hide show
  1. package/LICENSE +10 -6
  2. package/dist/index.d.cts +1815 -0
  3. package/dist/index.d.ts +1815 -0
  4. package/package.json +101 -103
  5. package/pnpm-lock.yaml +16312 -4430
  6. package/readme.md +76 -2184
  7. package/scripts/hot.js.liquid +25 -0
  8. package/dist/api.js +0 -16
  9. package/dist/cjs.js +0 -236
  10. package/dist/cli.js +0 -11
  11. package/dist/index.js +0 -18
  12. package/hot.js.liquid +0 -3
  13. package/schema/syncify.config.json +0 -676
  14. package/schema/syncify.env.json +0 -58
  15. package/schema/syncify.package.json +0 -11
  16. package/types/api.d.ts +0 -319
  17. package/types/bundle/cache.d.ts +0 -101
  18. package/types/bundle/commands.d.ts +0 -396
  19. package/types/bundle/errors.d.ts +0 -101
  20. package/types/bundle/file.d.ts +0 -285
  21. package/types/bundle/filters.d.ts +0 -81
  22. package/types/bundle/hot.d.ts +0 -185
  23. package/types/bundle/index.d.ts +0 -603
  24. package/types/bundle/plugin.d.ts +0 -127
  25. package/types/bundle/processors.d.ts +0 -54
  26. package/types/bundle/reports.d.ts +0 -123
  27. package/types/bundle/requests.d.ts +0 -374
  28. package/types/bundle/shared.d.ts +0 -124
  29. package/types/cli.d.ts +0 -547
  30. package/types/config/index.d.ts +0 -550
  31. package/types/config/terser.d.ts +0 -319
  32. package/types/config/views.d.ts +0 -191
  33. package/types/index.d.ts +0 -55
  34. package/types/modules/html-minifier-terser.d.ts +0 -218
  35. package/types/stores.d.ts +0 -11
  36. package/types/transforms/image.d.ts +0 -15
  37. package/types/transforms/json.d.ts +0 -51
  38. package/types/transforms/pages.d.ts +0 -254
  39. package/types/transforms/script.d.ts +0 -308
  40. package/types/transforms/style.d.ts +0 -219
  41. package/types/transforms/svg.d.ts +0 -189
@@ -1,285 +0,0 @@
1
- /* eslint-disable no-unused-vars */
2
-
3
- import { LiteralUnion, Merge } from 'type-fest';
4
-
5
- /**
6
- * File types are represented as numeric values.
7
- * The infer the following:
8
- */
9
- export enum FileTypes {
10
- Template = 1,
11
- Layout,
12
- Snippet,
13
- Section,
14
- Config,
15
- Locale,
16
- Style,
17
- Script,
18
- Svg,
19
- Redirect,
20
- File,
21
- Asset,
22
- Metafield,
23
- Page,
24
- Spawn
25
- }
26
-
27
- /**
28
- * File Kinds
29
- *
30
- * Applied to `file.kind` context. The is a text value
31
- * Used to describe of file being handled.
32
- */
33
- export type FileKinds = LiteralUnion<
34
- | 'style'
35
- | 'script'
36
- | 'liquid'
37
- | 'json'
38
- | 'image'
39
- | 'svg'
40
- | 'markdown'
41
- | 'html'
42
- | 'redirect'
43
- | 'video'
44
- | 'font'
45
- | 'document'
46
- , string
47
- >
48
-
49
- /**
50
- * Shopify Asset Key
51
- *
52
- * Applied to `file.key` context and required in theme asset
53
- * requests. The `key` represents to the file and directory
54
- * structure.
55
- *
56
- * > Used in REST API request payload
57
- *
58
- * @example
59
- *
60
- * 'snippets/filename.liquid'
61
- *
62
- */
63
- export type FileKeys = LiteralUnion<
64
- | `templates/${string}${'.liquid' | '.json'}`
65
- | `templates/customer/${string}${'.liquid' | '.json'}`
66
- | `assets/${string}`
67
- | `sections/${string}${'.liquid' | '-group.json'}`
68
- | `snippets/${string}${'.liquid'}`
69
- | `layout/${string}${'.liquid'}`
70
- | `locales/${string}${'.json'}`
71
- | `config/settings_${'data' | 'schema'}${'.json'}`
72
- , string
73
- >
74
-
75
- /**
76
- * File Namespace
77
- *
78
- * Applied to `file.namespace` context. This value represents the
79
- * the output theme directory where a file should be written, but
80
- * may also represent an endpoint.
81
- *
82
- * > Used in logs, reports and other logic
83
- */
84
- export type FileNamespaces = LiteralUnion<
85
- | 'template'
86
- | 'template/customer'
87
- | 'snippet'
88
- | 'section'
89
- | 'locale'
90
- | 'config'
91
- | 'layout'
92
- | 'asset'
93
- | 'metafield'
94
- | 'page'
95
- | 'redirect'
96
- | 'files'
97
- , string
98
- >
99
-
100
- /**
101
- * File Resource - Applied to `file.resource` context
102
- *
103
- * Applied to `file.resource` context. Infers the REST API endpoint
104
- * excluding `files` which will use the insufferable Shopify GraphQL endpoint.
105
- */
106
- export type FileResources = LiteralUnion<
107
- | 'pages'
108
- | 'redirects'
109
- | 'assets'
110
- | 'themes'
111
- | 'metafields'
112
- | 'files'
113
- , string
114
- >
115
-
116
- /**
117
- * File context generated when passed to a sync resource and used
118
- * to dispatch to correct transform process.
119
- */
120
- interface File<T = any> {
121
- /**
122
- * A unique UUID reference for this file - This option can change
123
- * where required and when dealing with multiple stores at the request level.
124
- *
125
- * @example
126
- *
127
- * 'ABD41WX'
128
- */
129
- uuid: string;
130
- /**
131
- * The file type that was intercepted. This is an enum number value.
132
- * The number value will infer on how the file should be handled and uses
133
- * the `FileType` enum for checks.
134
- *
135
- * @example
136
- *
137
- * file.type === FileType.Template
138
- *
139
- */
140
- type: number;
141
- /**
142
- * The resource API endpoint to which the file will be synced.
143
- * This will be passed to the request client.
144
- *
145
- * @example
146
- *
147
- * 'assets'
148
- * 'redirects'
149
- */
150
- resource: FileResources;
151
- /**
152
- * The root of the file path
153
- *
154
- * > Value is obtained via the native `path.parse()` method
155
- *
156
- * @example
157
- *
158
- * '/' OR 'c:\'
159
- */
160
- root: string;
161
- /**
162
- * The full directory path such.
163
- *
164
- * > Value is obtained via the native `path.parse()` method
165
- *
166
- * @example
167
- *
168
- * '/home/user/dir' OR 'c:\path\dir'
169
- */
170
- dir: string;
171
- /**
172
- * The file name without extension (if any).
173
- *
174
- * > Value is obtained via the native `path.parse()` method
175
- *
176
- * @example
177
- *
178
- * 'filename' // filename.ext
179
- */
180
- name: string;
181
- /**
182
- * The filename extension including the dot, eg: `.liquid`
183
- *
184
- * > Value is obtained via the native `path.parse()` method
185
- *
186
- * @example
187
- *
188
- * '.ext'
189
- */
190
- ext: string;
191
- /**
192
- * The input base filename including file extension.
193
- *
194
- * > Value is obtained via the native `path.parse()` method
195
- *
196
- * @example
197
- *
198
- * 'filename.ext'
199
- */
200
- base: string;
201
- /**
202
- * The input relative path location from current _root_ working directory
203
- *
204
- * @example
205
- *
206
- * 'source/views/sections/dir/file.liquid'
207
- */
208
- relative: string;
209
- /**
210
- * The `key` value will be passed into the sync request. This
211
- * will contain the namespace and base name and is used for
212
- * uploading to Shopify stores.
213
- *
214
- * @example
215
- *
216
- * 'sections/file.liquid'
217
- * 'snippets/file.liquid'
218
- * 'templates/index.liquid'
219
- */
220
- key: FileKeys;
221
- /**
222
- * The `namespace` value will typically refelect the output
223
- * parent directory name reference, but sometimes this might
224
- * be a unique value depending on the file type we are handling.
225
- *
226
- * @example
227
- *
228
- * 'snippets'
229
- * 'sections'
230
- * 'templates'
231
- */
232
- namespace: FileNamespaces;
233
- /**
234
- * The file kind grouping. This is used internally and describes
235
- * the type of file we are working with.
236
- *
237
- * @example
238
- *
239
- * 'json'
240
- * 'liquid'
241
- * 'sass'
242
- * 'css'
243
- *
244
- * // etc etc
245
- */
246
- kind: FileKinds
247
- /**
248
- * The chokidar passed path - this is full URI file path.
249
- *
250
- * @example
251
- *
252
- * 'User/name/project/source/dir/file.liquid'
253
- */
254
- input: string;
255
- /**
256
- * The output path location which files will be written. Only theme specific files
257
- * have an output path location, when a file writes from its source (like a metafield) or
258
- * if the file is handled in an asset pipeline transform then this will have a `null` value.
259
- *
260
- * @example
261
- *
262
- * // When file is theme specific
263
- * 'User/name/project/theme/dir/filename.liquid'
264
- *
265
- * // When file is not theme specific
266
- * null
267
- */
268
- output: string;
269
- /**
270
- * The file size in bytes before any augmentation is applied. This
271
- * value will assigned post-context, typically in a transform.
272
- *
273
- * @example
274
- *
275
- * 1024 // => 1.24kb
276
- */
277
- size?: number;
278
- /**
279
- * Configuration reference. This will hold a reference to additional data.
280
- * Typically, this is used for transforms, wherein it holds the indexed config.
281
- *
282
- * @default undefined // getter when required
283
- */
284
- get data(): T
285
- }
@@ -1,81 +0,0 @@
1
- export interface Filters {
2
- /**
3
- * Theme Asset filters
4
- *
5
- * @example
6
- * '--filter assets/*'
7
- */
8
- assets?: string[];
9
- /**
10
- * Theme Config filters
11
- *
12
- * @example
13
- * '--filter config/*'
14
- */
15
- config?: string[];
16
- /**
17
- * Theme Layout filters
18
- *
19
- * @example
20
- * '--filter layout/*'
21
- */
22
- layout?: string[];
23
- /**
24
- * Theme Locales filters
25
- *
26
- * @example
27
- * '--filter locales/*'
28
- */
29
- locales?: string[];
30
- /**
31
- * Theme Templates filters
32
- *
33
- * @example
34
- * '--filter assets/*'
35
- */
36
- templates?: string[];
37
- /**
38
- * Theme Customers filters
39
- *
40
- * @example
41
- * '--filter assets/*'
42
- */
43
- customers?: string[];
44
- /**
45
- * Theme Snippets filters
46
- *
47
- * @example
48
- * '--filter snippets/*'
49
- */
50
- snippets?: string[];
51
- /**
52
- * Theme sections filters
53
- *
54
- * @example
55
- * '--filter sections/*'
56
- */
57
- sections?: string[];
58
- /**
59
- * Store Metafields filters
60
- *
61
- * @example
62
- * '--filter assets/*'
63
- */
64
- metafields?: string[];
65
- /**
66
- * Store pages filters
67
- *
68
- * @example
69
- * '--filter pages/*'
70
- */
71
- pages?: string[];
72
- /**
73
- * Terse filters
74
- *
75
- * @example
76
- * '--filter terse:script'
77
- * '--filter terse:style'
78
- * '--filter terse:views'
79
- */
80
- terse?: string[];
81
- }
@@ -1,185 +0,0 @@
1
- /* -------------------------------------------- */
2
- /* LIVE RELOADS */
3
- /* -------------------------------------------- */
4
-
5
- import type { Server, WebSocket } from 'ws';
6
- import type { IncomingMessage } from 'http';
7
-
8
- export interface WSS {
9
- /**
10
- * The `wss` instance
11
- */
12
- get http(): Server<typeof WebSocket, typeof IncomingMessage>
13
- /**
14
- * Hot Socket for `<script>` tags
15
- */
16
- script(src: string): boolean;
17
- /**
18
- * Hot Socket for `<link>` stylesheet tags
19
- */
20
- stylesheet(href: string): boolean;
21
- /**
22
- * Hot Socket for theme sections
23
- */
24
- section(id: string): boolean;
25
- /**
26
- * Hot Socket SVG tags or sprites
27
- */
28
- svg(id: string): boolean;
29
- /**
30
- * Hot Socket for other asset files
31
- */
32
- assets(): boolean;
33
- /**
34
- * Hot Socket for `refresh` mode
35
- */
36
- reload(): boolean;
37
- /**
38
- * Hot Socket for view replacement
39
- */
40
- replace(): boolean;
41
- /**
42
- * Connected message
43
- */
44
- connected(): boolean;
45
- /**
46
- * Disconnect message
47
- */
48
- disconnect(): boolean;
49
- }
50
-
51
- /**
52
- * **INTERNAL USE**
53
- */
54
- export interface HOTBundle {
55
- /**
56
- * Whether or not Syncify hot reloads UI labels should render.
57
- *
58
- * @default true
59
- */
60
- label?: 'visible' | 'hidden';
61
- /**
62
- * **NOT YET AVAILABLE**
63
- *
64
- * Whether or not to record changes. When enabled, Syncify
65
- * will keep track of the last 25 changes applied and allow
66
- * you to walk through the stack.
67
- */
68
- history?: boolean;
69
- /**
70
- * Whether or not Syncify should inject the required HOT snippet
71
- * at runtime layout/s. When `false` you will need to manually place
72
- * the `hot.js.liquid` snippet into your theme.
73
- *
74
- * _Please note that by default when running `--hot` Syncify will
75
- * check your layout/s for the hot snippet and if it's not present then
76
- * syncify will inject it and invoke an upload of the layouts._
77
- *
78
- * @default true
79
- */
80
- inject?: boolean;
81
- /**
82
- * A string list of Liquid template layout names used in your theme
83
- * which should have the hot snippet injected.
84
- *
85
- * @default ['theme.liquid']
86
- */
87
- layouts?: string[];
88
- /**
89
- * The static server for assets - This will be written in the HOT snippet
90
- *
91
- * @default 3000
92
- * @example 'http://localhost:3000/some-asset.js'
93
- */
94
- server?: number;
95
- /**
96
- * Websocket port - - This will be written in the HOT snippet
97
- *
98
- * @default 8089
99
- * @example 'ws://localhost:8089/ws'
100
- */
101
- socket?: number;
102
- /**
103
- * Which live reload method should Syncify use?
104
- *
105
- * **hot**
106
- *
107
- * _Hot reloads assets and views with automatic refresh upon changes_
108
- *
109
- * **refresh**
110
- *
111
- * _Invokes a full page refresh after changes have been applied_
112
- *
113
- *
114
- * @default 'hot'
115
- */
116
- method?: 'hot' | 'refresh';
117
- /**
118
- * The HOT strategy to use. Syncify supports 2 different
119
- * replacement strategies and you will need choose which one
120
- * to use depending on your project type.
121
- *
122
- *
123
- * **hydrate**
124
- *
125
- * _The hydrate strategy will execute morph replacements. This is what Syncify
126
- * will default to, however it is not always perfect and in cases where you leverage
127
- * frameworks that use DOM Mutation observers, it probably better to use `replace`_
128
- *
129
- * **replace**
130
- *
131
- * _The replace strategy will execute fragment swaps use `replaceWith` instead of morphs
132
- * when executing HOT reloads. It works almost identical to `hydrate` but respects DOM
133
- * mutations. If you are leveraging a framework like Stimulus or Alpine, then choose this
134
- * strategy._
135
- *
136
- *
137
- * @default 'hydrate'
138
- */
139
- strategy?: 'hydrate' | 'replace';
140
- /**
141
- * Scroll position between reloads
142
- *
143
- * @default 'preserved'
144
- */
145
- scroll?: 'preserved' | 'top';
146
- /**
147
- * The liquid render tag written to Layouts.
148
- *
149
- * @default
150
- * {% render 'hot.js.liquid', server: 3000, socket: 8089 %}
151
- */
152
- renderer?: string;
153
- /**
154
- * The hot reload inline snippet script URI location
155
- *
156
- * @default
157
- * 'node_modules/@syncify/cli/hot.js.liquid'
158
- */
159
- snippet?: string;
160
- /**
161
- * The resolved output uri the snippet will be written.
162
- *
163
- * @default
164
- * 'theme/snippets/hot.js.liquid'
165
- */
166
- output?: string;
167
- /**
168
- * Which templates contain the hot snippet. The `key` value
169
- * will hold the URI output path where to file.
170
- *
171
- * @default true
172
- */
173
- alive?: { [template: string]: boolean; };
174
- }
175
-
176
- export type HOTConfig = Pick<HOTBundle,
177
- | 'inject'
178
- | 'label'
179
- | 'layouts'
180
- | 'method'
181
- | 'strategy'
182
- | 'server'
183
- | 'socket'
184
- | 'scroll'
185
- >