@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,58 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema",
3
- "$id": "syncify",
4
- "version": 1.1,
5
- "definitions": {
6
- "schema": {
7
- "oneOf": [
8
- {
9
- "type": "object",
10
- "additionalProperties": false,
11
- "properties": {
12
- "domain": {
13
- "description": "The shop domain",
14
- "type": "string",
15
- "default": "your-store.myshopify.com"
16
- },
17
- "key": {
18
- "description": "The shop key",
19
- "type": "string"
20
- },
21
- "secret": {
22
- "description": "The shop secret",
23
- "type": "string"
24
- }
25
- }
26
- },
27
- {
28
- "type": "object",
29
- "additionalProperties": false,
30
- "properties": {
31
- "domain": {
32
- "description": "The shop domain",
33
- "type": "string",
34
- "default": "your-store.myshopify.com"
35
- },
36
- "token": {
37
- "description": "The shop token",
38
- "type": "string"
39
- }
40
- }
41
- }
42
- ]
43
- }
44
- },
45
- "oneOf": [
46
- {
47
- "type": "object",
48
- "$ref": "#/definitions/schema"
49
- },
50
- {
51
- "type": "array",
52
- "items": {
53
- "type": "object",
54
- "$ref": "#/definitions/schema"
55
- }
56
- }
57
- ]
58
- }
@@ -1,11 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema",
3
- "$id": "syncify",
4
- "version": 1.1,
5
- "type": "object",
6
- "properties": {
7
- "syncify": {
8
- "$ref": "./syncify.config.json"
9
- }
10
- }
11
- }
package/types/api.d.ts DELETED
@@ -1,319 +0,0 @@
1
- import { PartialDeep } from 'type-fest';
2
- import { Config } from './config';
3
- import { Asset } from './bundle/requests';
4
- import { File } from './bundle/file';
5
-
6
- type Download = (
7
- this: {
8
- /**
9
- * The Shopify asset resource response
10
- */
11
- asset: Asset
12
- /**
13
- * The destination directory of the asset
14
- */
15
- output: string;
16
- },
17
- /**
18
- * The asset contents as Buffer.
19
- *
20
- * > Convert to a string using `content.toString()`
21
- */
22
- content: Buffer
23
- ) => (
24
- string |
25
- Buffer |
26
- void |
27
- {
28
- /**
29
- * Output the asset file to a new location
30
- */
31
- output: string;
32
- /**
33
- * Updated content of the asset
34
- */
35
- asset?: (
36
- string |
37
- Buffer |
38
- object |
39
- void
40
- )
41
- }
42
- )
43
-
44
- type Upload = (
45
- this: File,
46
- /**
47
- * The file contents as Buffer.
48
- *
49
- * > Convert to a string using `content.toString()`
50
- */
51
- content: Buffer
52
- ) => (
53
- string |
54
- Buffer |
55
- void |
56
- object
57
- )
58
-
59
- type Watch = (
60
- this: File,
61
- /**
62
- * The file contents as Buffer.
63
- *
64
- * > Convert to a string using `content.toString()`
65
- */
66
- content: Buffer
67
- ) => (
68
- string |
69
- Buffer |
70
- void |
71
- object
72
- )
73
-
74
- type Build = (
75
- this: File,
76
- /**
77
- * The file contents as Buffer.
78
- *
79
- * > Convert to a string using `content.toString()`
80
- */
81
- content: Buffer
82
- ) => (
83
- string |
84
- Buffer |
85
- void |
86
- object
87
- )
88
-
89
- export declare interface Resources {
90
- /**
91
- * Download
92
- *
93
- * Invoked for every asset that is downloaded from
94
- * store theme. Use the `this` scope to access file
95
- * information.
96
- */
97
- download(callback: Download): void
98
- /**
99
- * Upload
100
- *
101
- * Invoked before each file is downloaded to the
102
- * specified store theme. Use the `this` scope to
103
- * access file information.
104
- */
105
- upload(callback: Upload): void
106
- /**
107
- * Watch
108
- *
109
- * Invoked each time a file changes, after the transform
110
- * operation has completed but before it uploaded
111
- * to the specified store theme. Use the `this` scope to
112
- * access file information.
113
- */
114
- watch(callback: Watch): void
115
- /**
116
- * Build
117
- *
118
- * Invoked after transform operation has completed in build
119
- * mode. Use the `this` scope to access file information.
120
- */
121
- build(callback: Build): void
122
- }
123
-
124
- /**
125
- * Syncify Utilities
126
- *
127
- * A couple of utilities which are helpful when working
128
- * with external build tools or using Syncify within a script.
129
- */
130
- export namespace utils {
131
-
132
- /**
133
- * Conditional check of the current environment.
134
- */
135
- export function env(env: 'dev' | 'prod'): boolean
136
-
137
- /**
138
- * Condition check of the current running resource.
139
- */
140
- export function resource(resource: 'watch' | 'upload' | 'download'): boolean
141
-
142
- }
143
-
144
- /**
145
- * **Syncify**
146
- *
147
- * The function returns a function with parameter
148
- * Buffer value and a `this` holding file context.
149
- * You can apply modifications to the file in pipeline by
150
- * returning a type `string` or `Buffer`.
151
- *
152
- * If you return a `boolean` value `false` syncify will not
153
- * process the file. An `undefined`, `void` or `true` return value
154
- * will allow the file to pass through without modification.
155
- * If the file extension is `.json` you can return an `object`.
156
- *
157
- * @example
158
- *
159
- * import syncify from '@liquify/syncify'
160
- *
161
- * // USING CURRY
162
- *
163
- * // Returns a function
164
- * const watch = syncify('watch', {})
165
- *
166
- * // Hook into the transform
167
- * watch(function (content){
168
- *
169
- * console.log(this) // Prints the file context to CLI
170
- * console.log(content) // Buffer of the file
171
- * console.log(content.toString()) // Convert the buffer to string
172
- *
173
- * // Update the content of the file
174
- * return 'new value'
175
- *
176
- * })
177
- *
178
- * // USING INSTANCE
179
- *
180
- * // Create an instance
181
- * const sync = syncify({})
182
- *
183
- * // Invoke watch mode
184
- * sync.watch(function(content) {})
185
- *
186
- * // Invoke build mode
187
- * sync.build(function(content) {})
188
- *
189
- * // Invoke download mode
190
- * sync.download(function(content) {})
191
- *
192
- * // Invoke upload mode
193
- * sync.upload(function(content) {})
194
- *
195
- * // ADDITIONAL METHODS
196
- *
197
- * syncify.clean()
198
- * syncify.vsc()
199
- * syncify.metafields()
200
- * syncify.pages()
201
- */
202
- export interface Syncify {
203
- /**
204
- * Download
205
- *
206
- * Invoked for every asset that is downloaded from
207
- * store theme. Use the `this` scope to access file
208
- * information.
209
- */
210
- (resource: 'download', options?: PartialDeep<Config>): (callback: Download) => void
211
- /**
212
- * Upload
213
- *
214
- * Invoked before each file is downloaded to the
215
- * specified store theme. Use the `this` scope to
216
- * access file information.
217
- */
218
- (resource: 'upload', options?: PartialDeep<Config>): (callback: Upload) => void
219
- /**
220
- * Watch
221
- *
222
- * Invoked each time a file changes, after the transform
223
- * operation has completed but before it uploaded
224
- * to the specified store theme. Use the `this` scope to
225
- * access file information.
226
- */
227
- (resource: 'watch', options?: PartialDeep<Config>): (callback: Watch) => void
228
- /**
229
- * Build
230
- *
231
- * Invoked after transform operation has completed in build
232
- * mode. Use the `this` scope to access file information.
233
- */
234
- (resource: 'build', options?: PartialDeep<Config>): (callback: Build) => void
235
- /**
236
- * Usage via instance
237
- *
238
- * **NOT YET AVAILABLE**
239
- */
240
- (options?: PartialDeep<Config>): Resources
241
- /**
242
- * Theme resource
243
- *
244
- * **NOT YET AVAILABLE**
245
- */
246
- themes: {
247
- push(file: string, options?: any): Promise<any>;
248
- pull(file: string, options?: any): Promise<any>;
249
- merge(file: string, options?: any): Promise<any>;
250
- delete(file: string, options?: any): Promise<any>;
251
- query(file: string, options?: any): Promise<any>
252
- };
253
- /**
254
- * Assets resource
255
- *
256
- * **NOT YET AVAILABLE**
257
- */
258
- assets: {
259
- push(file: string, options?: any): Promise<any>;
260
- pull(file: string, options?: any): Promise<any>;
261
- merge(file: string, options?: any): Promise<any>;
262
- delete(file: string, options?: any): Promise<any>;
263
- query(file: string, options?: any): Promise<any>
264
- };
265
- /**
266
- * Files resource
267
- *
268
- * **NOT YET AVAILABLE**
269
- */
270
- files: {
271
- push(file: string, options?: any): Promise<any>;
272
- pull(file: string, options?: any): Promise<any>;
273
- merge(file: string, options?: any): Promise<any>;
274
- delete(file: string, options?: any): Promise<any>;
275
- query(file: string, options?: any): Promise<any>
276
- };
277
- /**
278
- * Metafields resource
279
- *
280
- * **NOT YET AVAILABLE**
281
- */
282
- metafields: {
283
- push(file: string, options?: any): Promise<any>;
284
- pull(file: string, options?: any): Promise<any>;
285
- merge(file: string, options?: any): Promise<any>;
286
- delete(file: string, options?: any): Promise<any>;
287
- query(file: string, options?: any): Promise<any>
288
- };
289
- /**
290
- * Pages resource
291
- *
292
- * **NOT YET AVAILABLE**
293
- */
294
- pages: {
295
- push(file: string, options?: any): Promise<any>;
296
- pull(file: string, options?: any): Promise<any>;
297
- merge(file: string, options?: any): Promise<any>;
298
- delete(file: string, options?: any): Promise<any>;
299
- query(file: string, options?: any): Promise<any>
300
- };
301
- /**
302
- * Update the configuration
303
- *
304
- * **NOT YET AVAILABLE**
305
- */
306
- config(options: Config): void
307
- /**
308
- * Clean the output directory
309
- *
310
- * **NOT YET AVAILABLE**
311
- */
312
- clean(): Promise<void>
313
- /**
314
- * VS Code Schema Store generation
315
- *
316
- * **NOT YET AVAILABLE**
317
- */
318
- vsc(): Promise<void>
319
- }
@@ -1,101 +0,0 @@
1
- import { Requests, Resource } from './requests';
2
-
3
- export interface Cache {
4
- /**
5
- * The Syncify version - cache will be purged and reset when changed
6
- */
7
- version?: string;
8
- /**
9
- * The last time cache was updated at (timestamp)
10
- */
11
- updated?: number;
12
- /**
13
- * The last time a build was executed
14
- */
15
- lastBuild?: number;
16
- /**
17
- * The last time a build was executed
18
- */
19
- lastResource?: Resource;
20
- /**
21
- * Cache Build File
22
- *
23
- * @default 'node_modules/.syncify/build.map'
24
- */
25
- uri?: string;
26
- /**
27
- * Sourcemap directories for transforms
28
- */
29
- sourcemaps?: {
30
- /**
31
- * JavaScript sourcemaps
32
- *
33
- * @default 'node_modules/.syncify/sourcemaps/script/'
34
- */
35
- script: string;
36
- /**
37
- * Stylesheet sourcemaps
38
- *
39
- * @default 'node_modules/.syncify/sourcemaps/script/'
40
- */
41
- style: string;
42
- }
43
- /**
44
- * Output > Input Source Path Mapping
45
- *
46
- * Holds reverse references between input and output
47
- * directories. Used when executing `upload` mode.
48
- *
49
- * > **NOTE**
50
- * >
51
- * > This cache reference will update each time build mode runs.
52
- */
53
- maps?: {
54
- /**
55
- * The output path pointing to input path
56
- *
57
- * `key`
58
- * - _The output path_
59
- *
60
- * `value`
61
- * - _The input path_
62
- */
63
- [outputFileURI: string]: string;
64
- },
65
- /**
66
- * Page related cache records, this reference typically
67
- * holds `path > id` object references. Page ids are
68
- * cached for lookup when changes occur.
69
- */
70
- pages?: {
71
- /**
72
- * The store domain name containing the pages, eg: `syncify` would
73
- * equate to `syncify.myshopify.com`.
74
- */
75
- [myshopifyDomain: string]: {
76
- /**
77
- * The page id, as property and the page payload reference as value.
78
- */
79
- [pageId: number]: Requests.Page
80
- }
81
- },
82
- /**
83
- * Metafields related cache records. Metafield source maps
84
- * are `path > id` object references. Metafield ids are
85
- * cached for lookup when changes occur. The `map` object
86
- * holds the references and applied to model on initialization.
87
- */
88
- metafields?: {
89
- /**
90
- * The store domain name containing the pages, eg: `syncify` would
91
- * equate to `syncify.myshopify.com`.
92
- */
93
- [myshopifyDomain: string]: {
94
- /**
95
- * Metafield pathname > id cache references..
96
- */
97
- [inputFileUri: string]: Requests.Page
98
- }
99
- }
100
-
101
- }