@syncify/cli 0.2.4-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 (40) 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 -101
  5. package/pnpm-lock.yaml +16526 -4200
  6. package/readme.md +77 -2017
  7. package/scripts/hot.js.liquid +25 -0
  8. package/dist/api.js +0 -16
  9. package/dist/cjs.js +0 -221
  10. package/dist/cli.js +0 -12
  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/cli.d.ts +0 -541
  18. package/types/config/index.d.ts +0 -530
  19. package/types/config/terser.d.ts +0 -267
  20. package/types/config/views.d.ts +0 -234
  21. package/types/index.d.ts +0 -55
  22. package/types/internal/cache.d.ts +0 -97
  23. package/types/internal/commands.d.ts +0 -396
  24. package/types/internal/errors.d.ts +0 -101
  25. package/types/internal/file.d.ts +0 -285
  26. package/types/internal/filters.d.ts +0 -81
  27. package/types/internal/hot.d.ts +0 -161
  28. package/types/internal/index.d.ts +0 -513
  29. package/types/internal/markdown.d.ts +0 -104
  30. package/types/internal/plugin.d.ts +0 -127
  31. package/types/internal/processors.d.ts +0 -54
  32. package/types/internal/reports.d.ts +0 -123
  33. package/types/internal/requests.d.ts +0 -288
  34. package/types/internal/shared.d.ts +0 -124
  35. package/types/modules/html-minifier-terser.d.ts +0 -211
  36. package/types/transforms/image.d.ts +0 -15
  37. package/types/transforms/json.d.ts +0 -42
  38. package/types/transforms/script.d.ts +0 -308
  39. package/types/transforms/style.d.ts +0 -219
  40. package/types/transforms/svg.d.ts +0 -189
@@ -1,127 +0,0 @@
1
- import { File } from './file';
2
- import { Transforms, Config } from '../config';
3
- import { WebSocketServer } from 'ws';
4
-
5
- /* -------------------------------------------- */
6
- /* PLUGIN SCOPE */
7
- /* -------------------------------------------- */
8
-
9
- export type PluginScope = {
10
- log: {
11
- info: (...message: string[]) => void;
12
- warn: (...message: string[]) => void;
13
- error: (...message: string[]) => void;
14
- }
15
- }
16
-
17
- /* -------------------------------------------- */
18
- /* PLUGIN HOOKS */
19
- /* -------------------------------------------- */
20
-
21
- export interface PluginHooks {
22
- /**
23
- * The plugin name
24
- */
25
- name: Lowercase<string>;
26
- /**
27
- * A list of file extension the plugin handles
28
- */
29
- extensions?: string[];
30
- /**
31
- * Optionally infer the required transformer
32
- */
33
- transforms?: Array<keyof Transforms>
34
- /**
35
- * Executes at runtime in the final cycle
36
- * and before modes are invoked (like _watch_).
37
- */
38
- onInit?: (this: PluginScope, config: Config) => void;
39
- /**
40
- * Executes before a transform begins when running
41
- * _build_ mode. The function only fires in build mode.
42
- */
43
- onBuild?: (this: PluginScope, file: File) => void;
44
- /**
45
- * Executes before the chokidar watch process
46
- * has began. Allows you add additional files
47
- * to be watched and monitored for changes.
48
- */
49
- onWatch?:(this: PluginScope, wss: WebSocketServer) => void | string[];
50
- /**
51
- * Executes before transform begins and after file
52
- * context has been created.
53
- *
54
- * **NOTE**
55
- *
56
- * _File context might augment during transform._
57
- */
58
- onChange?: (this: PluginScope, file: File) => void;
59
- /**
60
- * Executes before hooks and after transform.
61
- * File content can be transformed and request
62
- * can be re-routed.
63
- */
64
- onTransform?:(this: PluginScope, file: File) => void | {
65
- /**
66
- * Change the Shopify output key
67
- */
68
- key?: Pick<File, 'key'>;
69
- /**
70
- * Sourcemap (optional)
71
- */
72
- map?: Buffer | object | string;
73
- /**
74
- * Return the file content.
75
- */
76
- value: Buffer;
77
- };
78
- /**
79
- * Executes on a HOT reload and before
80
- * the theme preview is updated. You can augment
81
- * the dom before reload.
82
- */
83
- onReload?: (dom: Document) => void | Document
84
-
85
- }
86
-
87
- /* -------------------------------------------- */
88
- /* BUNDLE REFERENCE */
89
- /* -------------------------------------------- */
90
-
91
- export interface Plugins {
92
- /**
93
- * Plugins executing onBuild
94
- */
95
- onBuild: [
96
- pluginName: string,
97
- pluginHook: PluginHooks['onBuild']
98
- ][]
99
- /**
100
- * Plugins executing onWatch
101
- */
102
- onWatch: [
103
- pluginName: string,
104
- pluginHook: PluginHooks['onWatch']
105
- ][]
106
- /**
107
- * Plugins executing onChange
108
- */
109
- onChange: [
110
- pluginName: string,
111
- pluginHook: PluginHooks['onChange']
112
- ][]
113
- /**
114
- * Plugins executing onTransform
115
- */
116
- onTransform: [
117
- pluginName: string,
118
- pluginHook: PluginHooks['onTransform']
119
- ][]
120
- /**
121
- * Plugins executing onReload
122
- */
123
- onReload: [
124
- pluginName: string,
125
- pluginHook: PluginHooks['onReload']
126
- ][]
127
- }
@@ -1,54 +0,0 @@
1
- import type { JSONConfig } from '../transforms/json';
2
- import type { SharpConfig } from '../transforms/image';
3
- import type { BuildOptions } from 'esbuild';
4
- import type { SASSConfig, PostCSSConfig } from '../transforms/style';
5
- import type { SVGOConfig, SVGSpriteConfig } from '../transforms/svg';
6
-
7
- /**
8
- * **Internal Use**
9
- *
10
- * Processor Default Configurations
11
- *
12
- * Holds reference to default config options for
13
- * each supported processor.
14
- */
15
- export interface ProcessorsBundle {
16
- /**
17
- * JSON File processing - Options defined here are used when
18
- * writing to the file system. Typically in operations like
19
- * `--merge`, `--pull` and `--download`.
20
- *
21
- * > The options will also be used in **development** (`dev`)
22
- * mode when uploading `.json` files to stores/themes.
23
- */
24
- json?: JSONConfig;
25
- /**
26
- * [ESBuild](https://esbuild.github.io/) Config
27
- *
28
- * Syncify uses ESBuild under the hood for JS/TS transpilation.
29
- * Some native ESBuild options are omitted from processing and
30
- * handled internally by Syncify.
31
- */
32
- esbuild?: BuildOptions;
33
- /**
34
- * [PostCSS](https://postcss.org/) Plugins
35
- */
36
- postcss?: PostCSSConfig[]
37
- /**
38
- * [SASS Dart](https://sass-lang.com/documentation/js-api/) Config
39
- */
40
- sass?: SASSConfig
41
- /**
42
- * [Sharp](https://sharp.pixelplumbing.com) Config
43
- */
44
- sharp?: SharpConfig;
45
- /**
46
- * [SVGO](https://github.com/svg/svgo) Config
47
- *
48
- */
49
- svgo?: SVGOConfig;
50
- /**
51
- * [SVG Sprite](https://github.com/svg-sprite) Config
52
- */
53
- sprite?: SVGSpriteConfig
54
- }
@@ -1,123 +0,0 @@
1
- import { File } from './file';
2
-
3
- export interface UploadModeReport {
4
- /**
5
- * The file name that was build (including extension)
6
- *
7
- * @example
8
- * 'index.liquid'
9
- */
10
- name: string;
11
- /**
12
- * The upload time for this specific file
13
- *
14
- * @example
15
- * '1ms'
16
- */
17
- time: string;
18
- /**
19
- * The upload error (if occurred)
20
- *
21
- * @default
22
- * null
23
- */
24
- error: any;
25
- }
26
-
27
- export interface UploadReport {
28
- /**
29
- * List of files in the upload group
30
- */
31
- files: File[];
32
- /**
33
- * The amount of time the group took to upload
34
- */
35
- time: string;
36
- /**
37
- * The upload report for each file handled
38
- */
39
- report: UploadModeReport[]
40
- }
41
-
42
- /* -------------------------------------------- */
43
- /* BUILD MODE REPORTING */
44
- /* -------------------------------------------- */
45
-
46
- export interface BuildModeReport {
47
- /**
48
- * The file name that was build (including extension)
49
- *
50
- * @example
51
- * 'index.liquid'
52
- */
53
- name: string;
54
- /**
55
- * The relative input path of the file
56
- *
57
- * @example
58
- * 'src/template/index.liquid'
59
- */
60
- input: string;
61
- /**
62
- * The relative output directory path of the file
63
- *
64
- * @example
65
- * 'templates/index.liquid'
66
- */
67
- output: string;
68
- /**
69
- * The processing time it took to build
70
- *
71
- * @example
72
- * '1ms'
73
- */
74
- time: string;
75
- /**
76
- * A readable error string inferring any issues which may have occured.
77
- *
78
- * @example
79
- * 'skipped file'
80
- *
81
- * @default
82
- * null
83
- */
84
- error: string;
85
- /**
86
- * Output size stack
87
- *
88
- * _Undefined if `error` exists._
89
- */
90
- size?: {
91
- /**
92
- * Before transformation, returns ansi string
93
- */
94
- before: string;
95
- /**
96
- * After transformation, returns ansi string
97
- */
98
- after: string;
99
- /**
100
- * The saving amount, returns ansi string
101
- */
102
- saved: string;
103
- /**
104
- * The gzipped size, returns ansi string
105
- */
106
- gzip: string;
107
- }
108
- }
109
-
110
- export interface BuildReport {
111
- /**
112
- * List of files in the transform group
113
- */
114
- files: File[]
115
- /**
116
- * The amount of time the transform group took to process.
117
- */
118
- time: string;
119
- /**
120
- * The build report of each file transform
121
- */
122
- report: BuildModeReport[]
123
- }
@@ -1,288 +0,0 @@
1
- import { AxiosRequestConfig } from 'axios';
2
- import { File, FileKeys } from './file';
3
-
4
- /**
5
- * Axios Request Methods
6
- */
7
- export type Methods = 'get' | 'post' | 'put' | 'delete'
8
-
9
- /**
10
- * Client Request
11
- */
12
- export type Client = (method: Methods, file: File, content?: string) => Promise<void>
13
-
14
- /**
15
- * Client Request as parameter
16
- */
17
- export type ClientParam<T = any> = (method: Methods, file: File<T>, content?: string) => Promise<void>
18
-
19
- /**
20
- * Resources
21
- */
22
- export type Resource = 'build' | 'watch' | 'upload' |'download'
23
-
24
- /**
25
- * Chokidor Event Names
26
- */
27
- export type ChokidorEvents = 'add' | 'addDir' | 'change' | 'unlink' | 'unlinkDir'
28
-
29
- /**
30
- * Shopify theme asset paths, we use this to when re-pathing
31
- * custom directories.
32
- */
33
- export type GetAsset = (
34
- `templates/${string}${'.liquid' | '.json'}` |
35
- `templates/customer/${string}${'.liquid' | '.json'}` |
36
- `assets/${string}` |
37
- `sections/${string}${'-group.json' | '.liquid'}` |
38
- `snippets/${string}${'.liquid'}` |
39
- `layout/${string}${'.liquid'}` |
40
- `locales/${string}${'.json'}` |
41
- `config/settings_${'data' | 'schema'}${'.json'}`
42
- )
43
-
44
- /* -------------------------------------------- */
45
- /* ASSETS */
46
- /* -------------------------------------------- */
47
-
48
- /**
49
- * Return response for Shopify theme assets
50
- */
51
- export interface AssetResource {
52
- /**
53
- * The asset path
54
- */
55
- key: string;
56
- /**
57
- * The public-facing URL of the asset.
58
- */
59
- public_url: string;
60
- /**
61
- * The date and time (ISO 8601 format) when the
62
- * asset was created.
63
- */
64
- created_at: string;
65
- /**
66
- * The date and time (ISO 8601 format) when an
67
- * asset was last updated.
68
- */
69
- updated_at: string;
70
- /**
71
- * The MIME representation of the content, consisting
72
- * of the type and subtype of the asset.
73
- */
74
- content_type: string;
75
- /**
76
- * The asset size in bytes.
77
- */
78
- size: number;
79
- /**
80
- * The MD5 representation of the content, consisting
81
- * of a string of 32 hexadecimal digits. May be null
82
- * if an asset has not been updated recently.
83
- */
84
- checksum: string;
85
- /**
86
- * The ID for the theme that an asset belongs to.
87
- */
88
- theme_id: number;
89
- /**
90
- * The text content of the asset, such as the HTML
91
- * and Liquid markup of a template file.
92
- */
93
- value?: string;
94
- }
95
-
96
- export interface Asset {
97
- /**
98
- * The asset path
99
- */
100
- key?: string;
101
- /**
102
- * Base64 Encoded File
103
- */
104
- attachment?: string;
105
- /**
106
- * Value file string
107
- */
108
- value?: string;
109
- /**
110
- * The date and time (ISO 8601 format) when the
111
- * asset was created.
112
- */
113
- created_at?: string;
114
- /**
115
- * The date and time (ISO 8601 format) when an
116
- * asset was last updated.
117
- */
118
- updated_at?: string;
119
- /**
120
- * The MIME representation of the content, consisting
121
- * of the type and subtype of the asset.
122
- */
123
- content_type?: string;
124
- /**
125
- * The asset size in bytes.
126
- */
127
- size?: number;
128
- /**
129
- * The MD5 representation of the content, consisting of a
130
- * string of 32 hexadecimal digits. May be null if an asset
131
- * has not been updated recently.
132
- */
133
- checksum?: string;
134
- /**
135
- * The ID for the theme that an asset belongs to.
136
- */
137
- theme_id?: number;
138
- }
139
-
140
- export namespace Requests {
141
-
142
- /**
143
- * Return response for Shopify theme asset resources
144
- */
145
- export interface Assets {
146
- /**
147
- * The assets resource
148
- */
149
- assets: AssetResource[]
150
- }
151
-
152
- /**
153
- * The request body for Shopify theme assets
154
- */
155
- export interface Asset {
156
- /**
157
- * The theme asset
158
- */
159
- asset: {
160
- key: FileKeys,
161
- value: string,
162
- attachment?: string;
163
- }
164
- }
165
-
166
- /* -------------------------------------------- */
167
- /* PAGES */
168
- /* -------------------------------------------- */
169
-
170
- export interface Page {
171
- author?: string;
172
- body_html?: string;
173
- created_at?: string;
174
- handle?: string;
175
- id?: number;
176
- metafield?: {
177
- key: string;
178
- type: string;
179
- value: string;
180
- namespace:string;
181
- },
182
- published_at?:string;
183
- shop_id?: number
184
- template_suffix?: string;
185
- title?: string;
186
- updated_at?: string;
187
-
188
- }
189
- /* -------------------------------------------- */
190
- /* METAFIELDS */
191
- /* -------------------------------------------- */
192
-
193
- /**
194
- * The request body for Shopify metafields
195
- */
196
- export interface Metafield {
197
- /**
198
- * The metafield ID
199
- */
200
- id?: number;
201
- /**
202
- * The parent directory name
203
- */
204
- namespace?: string;
205
- /**
206
- * The JSON file name with extension
207
- */
208
- key?: string;
209
- /**
210
- * The stringified JSON value
211
- */
212
- value?: string;
213
- /**
214
- * Type is JSON
215
- */
216
- type?: 'json';
217
- /**
218
- * Value Type (this is legacy but we assert it anyway)
219
- */
220
- value_type?: 'json_string';
221
- /**
222
- * Last updated date
223
- */
224
- updated_at?: string;
225
- }
226
-
227
- /* -------------------------------------------- */
228
- /* REDIRECTS */
229
- /* -------------------------------------------- */
230
-
231
- export interface Redirect {
232
- /**
233
- * Redirect ID
234
- */
235
- id?: number;
236
- /**
237
- * The redirect from path
238
- */
239
- path?: string;
240
- /**
241
- * The redirect to path
242
- */
243
- target?: string;
244
- }
245
-
246
- export interface File {
247
- /**
248
- * File ID
249
- */
250
- id?: number;
251
- /**
252
- * The filename
253
- */
254
- filename?: string;
255
- /**
256
- * The mimeType of the file
257
- */
258
- mimeType?: string;
259
- /**
260
- * The file content type.
261
- */
262
- contentType?: string;
263
- /**
264
- * An external URL or a signed upload URL of the file object.
265
- */
266
- originalSource?: string;
267
- }
268
- }
269
-
270
- /**
271
- * Extended request options passed to axios when
272
- * uploading, downloading or interfacing with the Shopify
273
- * API themes, metafields or other endpoints.
274
- */
275
- export interface Request extends AxiosRequestConfig {
276
- url?: string;
277
- method?: Methods;
278
- responseType?: 'json',
279
- data?: (
280
- Requests.Asset |
281
- { metafield?: Requests.Metafield } |
282
- { redirect?: Requests.Redirect }
283
- )
284
- params?: {
285
- 'asset[key]'?: string;
286
- fields?: string
287
- }
288
- }
@@ -1,124 +0,0 @@
1
- import { Config } from '../config';
2
-
3
- export type Namespacing = (
4
- | '[dir]'
5
- | '[file]'
6
- | '[ext]'
7
- )
8
-
9
- /**
10
- * Namespaced Paths
11
- */
12
- export type NamespacePaths = `${'assets' | 'snippets'}/${string}`
13
-
14
- /**
15
- * Directory Paths
16
- */
17
- export type DirPaths = `${'assets' | 'snippets'}/${string}`
18
-
19
- /**
20
- * Rename Paths
21
- */
22
- export type RenamePaths = NamespacePaths;
23
-
24
- /**
25
- * Rename input type
26
- */
27
- export type RenameInput = {
28
- [filename: string]: string | string[]
29
- }
30
-
31
- /**
32
- * Rename input paths type
33
- */
34
- export type RenameInputPaths = { [filename: RenamePaths]: string | string[] }
35
-
36
- /**
37
- * Rename config type
38
- */
39
- export type RenameConfig<T> = { [filename: RenamePaths]: string | string[] | T}
40
-
41
- /**
42
- * Processor Configuration
43
- */
44
- export type GetProcessorConfigs<T> = {
45
- /**
46
- * Whether or not the processor is installed
47
- */
48
- installed: boolean;
49
- /**
50
- * Whether or not the module was loaded, ie: imported.
51
- * This will be `false` until the the import was loaded.
52
- */
53
- loaded: boolean;
54
- /**
55
- * Whether or not a config file exists for the processor,
56
- * When one exists the URI path location to the file will
57
- * be applied as the value.
58
- */
59
- file: boolean | string;
60
- /**
61
- * Configuration of the processor, Initialized with defaults
62
- */
63
- config: T;
64
- }
65
-
66
- /**
67
- * Picked `package.json` fields
68
- */
69
- export interface Package {
70
- version?: string;
71
- syncify?: Config;
72
- dependencies?: { [module: string]: string; };
73
- devDependencies?: { [module: string]: string };
74
- peerDependencies?: { [module: string]: string };
75
- optionalDependencies?: { [module: string]: string };
76
- }
77
-
78
- export namespace ENV {
79
-
80
- /**
81
- * Auth using `key` and `secret` in `.syncifyrc` file
82
- *
83
- * > _Single store_
84
- */
85
- export interface RCSecret {
86
- domain: string,
87
- key: string,
88
- secret: string
89
- }
90
-
91
- /**
92
- * Auth using `key` and `secret` in `.syncifyrc` File
93
- *
94
- * > _Array of stores_
95
- */
96
- export type RCSecrets = RCSecret[]
97
-
98
- /**
99
- * Auth using `token` in `.syncifyrc` file
100
- *
101
- * > _Single store_
102
- */
103
- export interface RCToken {
104
- domain: string,
105
- token: string
106
- }
107
-
108
- /**
109
- * Auth using `token` in `.syncifyrc` file
110
- *
111
- * > _Array of stores_
112
- */
113
- export type RCTokens = RCToken[]
114
-
115
- /**
116
- * Using a `.syncifyrc` file for authorizations
117
- */
118
- export type RCFile =
119
- | RCSecret
120
- | RCSecret[]
121
- | RCToken
122
- | RCToken[]
123
-
124
- }