@syncify/cli 0.1.3-beta → 0.2.0-beta

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.
@@ -4,7 +4,7 @@ import type { LiteralUnion, Merge } from 'type-fest';
4
4
  import type { Tester } from 'anymatch';
5
5
  import type { Config as SVGOConfig } from 'svgo';
6
6
  import type { Config as SVGSpriteConfig } from 'svg-sprite';
7
- import type { GetProcessorConfigs, RenamePaths } from '../misc/shared';
7
+ import type { GetProcessorConfigs, RenamePaths } from '../internal/shared';
8
8
 
9
9
  /* -------------------------------------------- */
10
10
  /* PROCESSOR CONFIGS */
@@ -1,479 +0,0 @@
1
- /* eslint-disable no-unused-vars */
2
-
3
- import type { Tester } from 'anymatch';
4
- import type { Options as HTMLTerserOptions } from 'html-minifier-terser';
5
- import type { BuildOptions as ESBuildConfig } from 'esbuild';
6
- import type { Merge, PackageJson } from 'type-fest';
7
- import type { Markdown } from '../misc/markdown';
8
- import type { Paths, Directories, Views, Config, Logger, Processors } from '../config/index';
9
- import type { AxiosRequestConfig } from 'axios';
10
- import type { Plugins } from './plugin';
11
- import type { ScriptBundle, ESBuildProcesser } from '../transforms/script';
12
- import type { StyleBundle, SASSProcesser, PostCSSProcesser } from '../transforms/style';
13
- import type { SVGBundle, SVGOProcesser, SVGSpriteProcesser } from '../transforms/svg';
14
- import type { HOT } from './hot';
15
- import type { JSONMinify, ESBuildMinify, ViewMinify } from '../config/minify';
16
- import type { JSONBundle } from '../transforms/json';
17
-
18
- /* -------------------------------------------- */
19
- /* RE-EXPORT */
20
- /* -------------------------------------------- */
21
-
22
- export { File } from './file';
23
- export { Cache } from './cache';
24
-
25
- /* -------------------------------------------- */
26
- /* PROCESSORS */
27
- /* -------------------------------------------- */
28
-
29
- /**
30
- * **INTERNAL USE**
31
- *
32
- * Processor configuration state. This model infers which
33
- * pre-processors are being used and/or available.
34
- */
35
- export interface ProcessorConfig {
36
- json: JSONBundle
37
- /**
38
- * [PostCSS](https://postcss.org/) Pre-Processor
39
- */
40
- postcss: PostCSSProcesser;
41
- /**
42
- * [SASS Dart](https://sass-lang.com/documentation/js-api/) Pre-Processor
43
- */
44
- sass: SASSProcesser;
45
- /**
46
- * [Sharp](https://sharp.pixelplumbing.com) Pre-Processor
47
- */
48
- sharp: any;
49
- /**
50
- * [SVG Sprite](https://github.com/svg-sprite) Pre-Processor
51
- */
52
- sprite: SVGSpriteProcesser;
53
- /**
54
- * [SVGO](https://github.com/svg/svgo) Pre-Processor
55
- */
56
- svgo: SVGOProcesser
57
- /**
58
- * [ESBuild](https://esbuild.github.io/) Pre-Processor
59
- */
60
- esbuild: ESBuildProcesser
61
- }
62
-
63
- /* -------------------------------------------- */
64
- /* SPAWNED PROCESSES */
65
- /* -------------------------------------------- */
66
-
67
- /**
68
- * **INTERNAL USE**
69
- *
70
- * Spawn configuration state.
71
- */
72
- export interface SpawnBundle {
73
- /**
74
- * Dynamically populated `Set` of file paths
75
- * that were generated from a spawned process.
76
- * Each item in the set will be matched against
77
- * in modes like `watch` from the chokidar instance.
78
- */
79
- paths: Set<string>;
80
- /**
81
- * Whether or not a spawn process ran. This is used
82
- * to determine what action took place in the build
83
- * cycles. When this value is `true` it infers a spawn
84
- * process was fired, when `false` it infers the opposite.
85
- *
86
- * > _Spawned invocation uses the `stdio` stream to determine
87
- * whether or not a change was fired by a child running process_
88
- */
89
- invoked: boolean;
90
- /**
91
- * Commands that were spawned.
92
- */
93
- commands: {
94
- /**
95
- * The name of the process that will run, eg: `esbuild`
96
- */
97
- [name: string]: {
98
- /**
99
- * The base command, For example `esbuild` would be the
100
- * _base_ command in `esbuild src/file.js --watch`. If an
101
- * array command was provided in config then this value would
102
- * represent the first item in that array.
103
- */
104
- cmd: string;
105
- /**
106
- * The command arguments. For example, all commands following
107
- * the base command. The value here will be passed to spawn.
108
- */
109
- args: string[];
110
- /**
111
- * The process id (pid) assigned to the spawn. This is dynamically
112
- * assigned and will be `NaN` until spawn has been invoked.
113
- */
114
- pid: number;
115
- }
116
- }
117
- }
118
-
119
- /* -------------------------------------------- */
120
- /* STORE */
121
- /* -------------------------------------------- */
122
-
123
- /**
124
- * **INTERNAL USE**
125
- *
126
- * Store authorisation client
127
- */
128
- export interface Store {
129
- /**
130
- * The store domain name in Upcase (without `myshopify.com`)
131
- */
132
- store: string;
133
- /**
134
- * The store myshopify domain, eg: `store.myshopify.com`
135
- */
136
- domain: string;
137
- /**
138
- * Client instances
139
- */
140
- client: AxiosRequestConfig
141
- /**
142
- * Queue
143
- */
144
- queue: boolean;
145
- }
146
-
147
- /* -------------------------------------------- */
148
- /* THEME */
149
- /* -------------------------------------------- */
150
-
151
- /**
152
- * **INTERNAL USE**
153
- *
154
- * Theme related model
155
- */
156
- export interface Theme {
157
- /**
158
- * The store index reference
159
- */
160
- sidx: number;
161
- /**
162
- * The store domain name
163
- */
164
- store: string;
165
- /**
166
- * The theme target name
167
- */
168
- target: string;
169
- /**
170
- * The theme id.
171
- */
172
- id: number;
173
- /**
174
- * The authorized assets URL endpoint
175
- */
176
- url: string;
177
- }
178
-
179
- /* -------------------------------------------- */
180
- /* SYNC */
181
- /* -------------------------------------------- */
182
-
183
- /**
184
- * **INTERNAL USE**
185
- *
186
- * Sync clients
187
- */
188
- export interface Sync {
189
- /**
190
- * Theme synchronization options
191
- */
192
- themes: Array<Theme>;
193
- /**
194
- * Store synchronization options
195
- */
196
- stores: Array<Store>;
197
- }
198
-
199
- /* -------------------------------------------- */
200
- /* MINIFY */
201
- /* -------------------------------------------- */
202
-
203
- /**
204
- * **INTERNAL USE**
205
- */
206
- export interface Minify {
207
- /**
208
- * JSON Minification
209
- */
210
- json?: JSONMinify;
211
- /**
212
- * View (Liquid) Minification
213
- */
214
- liquid?: Omit<ViewMinify, 'collapseWhitespace'>;
215
- /**
216
- * View (HTML) Minification
217
- *
218
- * > Uses [html-minifier-terser](https://github.com/terser/html-minifier-terser)
219
- */
220
- html?: HTMLTerserOptions;
221
- /**
222
- * JS/TS Minification
223
- *
224
- * > Uses [esbuild](https://esbuild.github.io/api/#minify) minificiation
225
- */
226
- script?: ESBuildMinify;
227
- }
228
- /* -------------------------------------------- */
229
- /* RESOURCE MODES */
230
- /* -------------------------------------------- */
231
-
232
- /**
233
- * **INTERNAL USE**
234
- */
235
- export interface Modes {
236
- /**
237
- * Run the command prompt
238
- */
239
- prompt: boolean;
240
- /**
241
- * Execute a build, alias: `-b`
242
- */
243
- build: boolean;
244
- /**
245
- * Execute watch, alias: `-w`
246
- */
247
- watch: boolean;
248
- /**
249
- * Execute Upload, alias: `-u`
250
- */
251
- upload: boolean;
252
- /**
253
- * Execute Download, alias: `-d`
254
- */
255
- download: boolean;
256
- /**
257
- * Execute Clean, alias: `-c`
258
- */
259
- clean: boolean;
260
- /**
261
- * Generates VSC Schema spec file
262
- */
263
- vsc: boolean;
264
- /**
265
- * Execute metafields action, `-m`
266
- */
267
- metafields: boolean
268
- /**
269
- * Execute redirects resource, `-r`
270
- */
271
- redirects: boolean;
272
- /**
273
- * Execute page action, `-p`
274
- */
275
- pages: boolean
276
- /**
277
- * Pull data from remote store, `--pull`
278
- */
279
- pull: boolean
280
- /**
281
- * merge data from remote store, `--merge`
282
- */
283
- push: boolean;
284
- /**
285
- * Invoke HOT reloads, `--hot`
286
- */
287
- hot: boolean;
288
- /**
289
- * Run the style transform, `--style`
290
- */
291
- style: boolean;
292
- /**
293
- * Run the script transform, `--script`
294
- */
295
- script: boolean;
296
- /**
297
- * Run the svg transform, `--svg`
298
- */
299
- svg: boolean;
300
- /**
301
- * Run the image transform, `--image`
302
- */
303
- image: boolean;
304
- /**
305
- * Run minification, either `--prod` or `--minify`
306
- */
307
- minify: boolean;
308
- /**
309
- * Trigger export, alias: `-e`
310
- */
311
- export: boolean;
312
- }
313
-
314
- /* -------------------------------------------- */
315
- /* BUNDLE */
316
- /* -------------------------------------------- */
317
-
318
- /**
319
- * **INTERNAL USE**
320
- *
321
- * Bundle Configuration. This is an internally used model
322
- * which maintains a store used for handling. It holds the
323
- * modules path resolutions and execution options.
324
- */
325
- export interface Bundle {
326
- /**
327
- * The version defined in the package.json
328
- */
329
- version: string;
330
- /**
331
- * Logger Options
332
- */
333
- logger: Logger;
334
- /**
335
- * The configuration file name
336
- */
337
- file: string
338
- /**
339
- * Building for development (default)
340
- */
341
- dev: boolean;
342
- /**
343
- * Building for production
344
- */
345
- prod: boolean;
346
- /**
347
- * CLI Initialized, when `false` syncify was called from JavaScript API.
348
- */
349
- cli: boolean;
350
- /**
351
- * Logging should be silent, only show errors or warnings.
352
- */
353
- silent: boolean;
354
- /**
355
- * The current working directory
356
- */
357
- cwd: string;
358
- /**
359
- * Hot reload mode options
360
- */
361
- hot: HOT;
362
- /**
363
- * Directory structure paths.
364
- *
365
- * Includes a special `transforms` Map reference for transform related files
366
- * which may potentially be using an extension which would lead to it being identified
367
- * as a different file type. This occurs when (for example) snippet generated transforms
368
- * are inferred. The `transform` option will point to resolved file names and the values
369
- * for each entry will equal an enum `Type` number. The following transforms are identifiable:
370
- *
371
- * - `7` > `Type.Style`
372
- * - `8` > `Type.Script`
373
- * - `9` > `Type.SVG`
374
- */
375
- paths: Merge<Paths<Tester>, { transforms?: Map<string, 7 | 8 | 9> }>;
376
- /**
377
- * Base directory path references
378
- */
379
- dirs: Merge<Directories, { cache: string }>;
380
- /**
381
- * The sync clients. Multiple stores and themes
382
- * can run concurrently.
383
- */
384
- sync: Sync
385
- /**
386
- * Passed commands that may be of importance in
387
- * the transform or build processes.
388
- */
389
- cmd: {
390
- /**
391
- * An input overwrite was passed
392
- */
393
- input: string;
394
- /**
395
- * An output overwrite was passed
396
- */
397
- output: string;
398
- /**
399
- * Filters were passed in the command
400
- */
401
- filter: string;
402
- /**
403
- * Deletions were passed in the command
404
- */
405
- delete: string;
406
- };
407
- /**
408
- * Spawn related configuration operations
409
- */
410
- spawn: SpawnBundle
411
- /**
412
- * The operation to run
413
- */
414
- mode: Modes;
415
- /**
416
- * List of paths to watch or build from
417
- */
418
- watch: Set<string>
419
- /**
420
- * Snippet handling
421
- */
422
- snippet: Merge<Views['snippets'], { global: RegExp; }>;
423
- /**
424
- * Section handling
425
- */
426
- section: Merge<Views['sections'], { global: RegExp }>;
427
- /**
428
- * Page handling
429
- */
430
- page: Merge<Views['pages'], {
431
- import: Markdown.Import;
432
- export: Markdown.Export
433
- }>
434
- /**
435
- * Script handling
436
- */
437
- script: ScriptBundle[];
438
- /**
439
- * Style handling
440
- */
441
- style: StyleBundle[];
442
- /**
443
- * SVG handling
444
- */
445
- svg: SVGBundle[];
446
- /**
447
- * Image handling
448
- */
449
- image: any
450
- /**
451
- * Minify Options
452
- */
453
- minify: {
454
- json: boolean;
455
- views: boolean;
456
- script: boolean;
457
- get options(): Minify
458
- }
459
- /**
460
- * Processor Configurations
461
- */
462
- get processor(): Processors
463
- /**
464
- * Merge users configuration with default
465
- */
466
- set config(config: Config)
467
- /**
468
- * Returns the merged configuration
469
- */
470
- get config(): Config;
471
- /**
472
- * Returns the `package.json` contents
473
- */
474
- get pkg(): PackageJson;
475
- /**
476
- * Plugins
477
- */
478
- get plugins(): Plugins;
479
- }
@@ -1,115 +0,0 @@
1
- import type { BuildOptions } from 'esbuild';
2
- import { Merge } from 'type-fest';
3
-
4
- /**
5
- * ESBuild minification options
6
- */
7
- export type ESBuildMinify = Merge<Pick<BuildOptions,
8
- | 'keepNames'
9
- | 'legalComments'
10
- | 'mangleProps'
11
- | 'minifyIdentifiers'
12
- | 'minifySyntax'
13
- | 'minifyWhitespace'
14
- | 'mangleQuoted'
15
- >,
16
- {
17
- /**
18
- * List of input file names to exclude from minification
19
- *
20
- * @default []
21
- */
22
- exclude?: []
23
- }
24
- >
25
-
26
- /**
27
- * JSON File Minification
28
- */
29
- export interface JSONMinify {
30
- /**
31
- * Minify `.json` files writing to `theme/assets`
32
- *
33
- * @default true
34
- */
35
- assets: boolean;
36
- /**
37
- * Minify `settings_schema.json` and `settings_data.json` config files.
38
- *
39
- * @default true
40
- */
41
- config: boolean;
42
- /**
43
- * Minify `locale` and `.json` files.
44
- *
45
- * @default true
46
- */
47
- locales: boolean;
48
- /**
49
- * Minify `metafield` and `.json` files.
50
- *
51
- * @default true
52
- */
53
- metafields: boolean;
54
- /**
55
- * Minify `template` and `.json` files.
56
- *
57
- * @default true
58
- */
59
- templates: boolean;
60
- /**
61
- * An optional list of paths/files to exclude from minification.
62
- *
63
- * @default []
64
- */
65
- exclude?: string[]
66
- }
67
-
68
- /**
69
- * Liquid Minification
70
- */
71
- export interface ViewMinify {
72
- /**
73
- * Minifies inner contents of `<script>` tags
74
- *
75
- * @default true
76
- */
77
- minifyScript?: boolean;
78
- /**
79
- * Minifies inner contents of `<style>` tags
80
- *
81
- * @default true
82
- */
83
- minifyStyle?: boolean;
84
- /**
85
- * Minifies JSON contained within schema tags, ie: `{% schema %}`
86
- *
87
- * @default true
88
- */
89
- minifySchema?: boolean;
90
- /**
91
- * Remove all occurances of Liquid/HTML comments
92
- *
93
- * @default true
94
- */
95
- removeComments?: boolean;
96
- /**
97
- * Collpase all whitespace
98
- *
99
- * @default true
100
- */
101
- collapseWhitespace?: boolean;
102
- /**
103
- * Removes redundant whitespace Liquid dash trims from Liquid
104
- * tags and objects.
105
- *
106
- * @default true
107
- */
108
- stripDashes?: boolean;
109
- /**
110
- * Excluded files from minification
111
- *
112
- * @default []
113
- */
114
- exclude?: string[]
115
- }
File without changes
File without changes
File without changes