@syncify/cli 0.3.0-beta → 1.0.0-unstable.0

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 (42) hide show
  1. package/LICENSE +10 -6
  2. package/dist/api.js +32 -12
  3. package/dist/cli.js +610 -6
  4. package/dist/index.d.ts +2264 -0
  5. package/dist/index.js +10 -10
  6. package/dist/syncify.js +24248 -0
  7. package/hot.js.liquid +13 -2
  8. package/package.json +118 -115
  9. package/readme.md +110 -2176
  10. package/scripts/postinstall.js +116 -0
  11. package/scripts/postversion.js +60 -0
  12. package/dist/cjs.js +0 -236
  13. package/pnpm-lock.yaml +0 -5662
  14. package/schema/syncify.config.json +0 -676
  15. package/schema/syncify.env.json +0 -58
  16. package/schema/syncify.package.json +0 -11
  17. package/types/api.d.ts +0 -319
  18. package/types/bundle/cache.d.ts +0 -101
  19. package/types/bundle/commands.d.ts +0 -396
  20. package/types/bundle/errors.d.ts +0 -101
  21. package/types/bundle/file.d.ts +0 -285
  22. package/types/bundle/filters.d.ts +0 -81
  23. package/types/bundle/hot.d.ts +0 -185
  24. package/types/bundle/index.d.ts +0 -603
  25. package/types/bundle/plugin.d.ts +0 -127
  26. package/types/bundle/processors.d.ts +0 -54
  27. package/types/bundle/reports.d.ts +0 -123
  28. package/types/bundle/requests.d.ts +0 -374
  29. package/types/bundle/shared.d.ts +0 -124
  30. package/types/cli.d.ts +0 -547
  31. package/types/config/index.d.ts +0 -550
  32. package/types/config/terser.d.ts +0 -319
  33. package/types/config/views.d.ts +0 -191
  34. package/types/index.d.ts +0 -55
  35. package/types/modules/html-minifier-terser.d.ts +0 -218
  36. package/types/stores.d.ts +0 -11
  37. package/types/transforms/image.d.ts +0 -15
  38. package/types/transforms/json.d.ts +0 -51
  39. package/types/transforms/pages.d.ts +0 -254
  40. package/types/transforms/script.d.ts +0 -308
  41. package/types/transforms/style.d.ts +0 -219
  42. package/types/transforms/svg.d.ts +0 -189
@@ -0,0 +1,2264 @@
1
+ /// <reference path="../node_modules/@types/clean-css/index.d.ts" />
2
+ /// <reference path="../node_modules/svgo/lib/svgo.d.ts" />
3
+ /// <reference path="../node_modules/postcss/lib/postcss.d.ts" />
4
+ /// <reference path="../node_modules/tailwindcss/types/index.d.ts" />
5
+ /// <reference path="../node_modules/esbuild/lib/main.d.ts" />
6
+ /// <reference path="../node_modules/type-fest/index.d.ts" />
7
+
8
+ import { BuildOptions } from 'esbuild';
9
+ export { BuildOptions as ESBuildOptions } from 'esbuild';
10
+ import { OptionsOutput } from 'clean-css';
11
+ import { AcceptedPlugin, Plugin, Transformer, TransformCallback } from 'postcss';
12
+ import { Config as Config$1 } from 'tailwindcss';
13
+ import { Config as Config$2 } from 'svgo';
14
+ export { Config as SVGOConfig } from 'svgo';
15
+ import { Options } from 'markdown-it';
16
+
17
+ /* -------------------------------------------- */
18
+ /* BASE DIRECTORIES */
19
+ /* -------------------------------------------- */
20
+
21
+ type Directories = {
22
+ /**
23
+ * The resolved `input` directory path
24
+ *
25
+ * @default 'source/'
26
+ */
27
+ input?: string;
28
+ /**
29
+ * The resolved `output` directory path
30
+ *
31
+ * @default 'theme/'
32
+ */
33
+ output?: string;
34
+ /**
35
+ * The resolved `config` directory path for build tool files
36
+ *
37
+ * @default '/'
38
+ */
39
+ config?: string;
40
+ }
41
+
42
+ type Git = {
43
+ /**
44
+ * Specifies the default branch where your project exists. This branch will be be used to trigger
45
+ * the auto-merging behaviour when running `git pull`. Your `output` (theme) directory will not
46
+ * exist within this branch unless explicitly excluded from `.gitignore` file.
47
+ *
48
+ * > Please refer to the [Syncify Git Integration](https://syncify.sh/usage/git) for more information.
49
+ *
50
+ * @default 'master'
51
+ */
52
+ default?: string;
53
+ /**
54
+ * Specifies the production branch name, which is primary sync branch. This is the branch
55
+ * that Syncify will auto-publish the flat **output** directory too, and is not to be confused
56
+ * with the branch where your **input** (source) lives. Instead, this is the branch used by the
57
+ * [Shopify Github Integration](https://shopify.dev/docs/storefronts/themes/tools/github).
58
+ *
59
+ * > **PLEASE NOTE**
60
+ * >
61
+ * > Syncify assumes that the default branch of your respository is named `master` (as per the original
62
+ * > and correct naming convention for Git). The `main` branch is **NOT** considered the "main" branch
63
+ * > but instead it is used as the distributed flat-structure point of your theme as per the `role` name
64
+ * > used for live themes published in your store.
65
+ * >
66
+ * > Please refer to the [Syncify Git Integration](https://syncify.sh/usage/git) for more information.
67
+ *
68
+ * @default 'main'
69
+ */
70
+ branch?: string;
71
+ /**
72
+ * A glob pattern of files (or directories) which apply conflict-free merging. These entires force-merge
73
+ * into **input** (source) upon `git pull` operations. You'd use the option for `.json` configuration
74
+ * specific files such as templates that auto-write settings from the editor.
75
+ *
76
+ * ```js
77
+ * {
78
+ * // all templates will overwrite source.
79
+ * force: ['templates/*.json' ]
80
+ * }
81
+ * ```
82
+ *
83
+ * @default []
84
+ */
85
+ force?: string[];
86
+ /**
87
+ * Defines branch relationships for mirroring. Each key is a branch name, and the value is an
88
+ * array of branches that will mirror content changes published via the Shopify Github Integration.
89
+ *
90
+ * Mirrors allow developers to define dynamic branch reflections, for example:
91
+ *
92
+ * ```js
93
+ * {
94
+ * stage: ['pre'] // ensures the stage branch mirrors the pre branch.
95
+ * dev: ['main','pre'] // ensures the dev branch mirrors both main and pre branches.
96
+ * }
97
+ * ```
98
+ *
99
+ * @default {}
100
+ */
101
+ mirror?: { [branch: string]: string[] }
102
+ }
103
+
104
+ /**
105
+ Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
106
+
107
+ @category Type
108
+ */
109
+ type Primitive =
110
+ | null
111
+ | undefined
112
+ | string
113
+ | number
114
+ | boolean
115
+ | symbol
116
+ | bigint;
117
+
118
+ declare global {
119
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
120
+ interface SymbolConstructor {
121
+ readonly observable: symbol;
122
+ }
123
+ }
124
+
125
+ /**
126
+ Useful to flatten the type output to improve type hints shown in editors. And also to transform an interface into a type to aide with assignability.
127
+
128
+ @example
129
+ ```
130
+ import type {Simplify} from 'type-fest';
131
+
132
+ type PositionProps = {
133
+ top: number;
134
+ left: number;
135
+ };
136
+
137
+ type SizeProps = {
138
+ width: number;
139
+ height: number;
140
+ };
141
+
142
+ // In your editor, hovering over `Props` will show a flattened object with all the properties.
143
+ type Props = Simplify<PositionProps & SizeProps>;
144
+ ```
145
+
146
+ Sometimes it is desired to pass a value as a function argument that has a different type. At first inspection it may seem assignable, and then you discover it is not because the `value`'s type definition was defined as an interface. In the following example, `fn` requires an argument of type `Record<string, unknown>`. If the value is defined as a literal, then it is assignable. And if the `value` is defined as type using the `Simplify` utility the value is assignable. But if the `value` is defined as an interface, it is not assignable because the interface is not sealed and elsewhere a non-string property could be added to the interface.
147
+
148
+ If the type definition must be an interface (perhaps it was defined in a third-party npm package), then the `value` can be defined as `const value: Simplify<SomeInterface> = ...`. Then `value` will be assignable to the `fn` argument. Or the `value` can be cast as `Simplify<SomeInterface>` if you can't re-declare the `value`.
149
+
150
+ @example
151
+ ```
152
+ import type {Simplify} from 'type-fest';
153
+
154
+ interface SomeInterface {
155
+ foo: number;
156
+ bar?: string;
157
+ baz: number | undefined;
158
+ }
159
+
160
+ type SomeType = {
161
+ foo: number;
162
+ bar?: string;
163
+ baz: number | undefined;
164
+ };
165
+
166
+ const literal = {foo: 123, bar: 'hello', baz: 456};
167
+ const someType: SomeType = literal;
168
+ const someInterface: SomeInterface = literal;
169
+
170
+ function fn(object: Record<string, unknown>): void {}
171
+
172
+ fn(literal); // Good: literal object type is sealed
173
+ fn(someType); // Good: type is sealed
174
+ fn(someInterface); // Error: Index signature for type 'string' is missing in type 'someInterface'. Because `interface` can be re-opened
175
+ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface` into a `type`
176
+ ```
177
+
178
+ @link https://github.com/microsoft/TypeScript/issues/15300
179
+ @see SimplifyDeep
180
+ @category Object
181
+ */
182
+ type Simplify<T> = {[KeyType in keyof T]: T[KeyType]} & {};
183
+
184
+ /**
185
+ Omit any index signatures from the given object type, leaving only explicitly defined properties.
186
+
187
+ This is the counterpart of `PickIndexSignature`.
188
+
189
+ Use-cases:
190
+ - Remove overly permissive signatures from third-party types.
191
+
192
+ This type was taken from this [StackOverflow answer](https://stackoverflow.com/a/68261113/420747).
193
+
194
+ It relies on the fact that an empty object (`{}`) is assignable to an object with just an index signature, like `Record<string, unknown>`, but not to an object with explicitly defined keys, like `Record<'foo' | 'bar', unknown>`.
195
+
196
+ (The actual value type, `unknown`, is irrelevant and could be any type. Only the key type matters.)
197
+
198
+ ```
199
+ const indexed: Record<string, unknown> = {}; // Allowed
200
+
201
+ const keyed: Record<'foo', unknown> = {}; // Error
202
+ // => TS2739: Type '{}' is missing the following properties from type 'Record<"foo" | "bar", unknown>': foo, bar
203
+ ```
204
+
205
+ Instead of causing a type error like the above, you can also use a [conditional type](https://www.typescriptlang.org/docs/handbook/2/conditional-types.html) to test whether a type is assignable to another:
206
+
207
+ ```
208
+ type Indexed = {} extends Record<string, unknown>
209
+ ? '✅ `{}` is assignable to `Record<string, unknown>`'
210
+ : '❌ `{}` is NOT assignable to `Record<string, unknown>`';
211
+ // => '✅ `{}` is assignable to `Record<string, unknown>`'
212
+
213
+ type Keyed = {} extends Record<'foo' | 'bar', unknown>
214
+ ? "✅ `{}` is assignable to `Record<'foo' | 'bar', unknown>`"
215
+ : "❌ `{}` is NOT assignable to `Record<'foo' | 'bar', unknown>`";
216
+ // => "❌ `{}` is NOT assignable to `Record<'foo' | 'bar', unknown>`"
217
+ ```
218
+
219
+ Using a [mapped type](https://www.typescriptlang.org/docs/handbook/2/mapped-types.html#further-exploration), you can then check for each `KeyType` of `ObjectType`...
220
+
221
+ ```
222
+ import type {OmitIndexSignature} from 'type-fest';
223
+
224
+ type OmitIndexSignature<ObjectType> = {
225
+ [KeyType in keyof ObjectType // Map each key of `ObjectType`...
226
+ ]: ObjectType[KeyType]; // ...to its original value, i.e. `OmitIndexSignature<Foo> == Foo`.
227
+ };
228
+ ```
229
+
230
+ ...whether an empty object (`{}`) would be assignable to an object with that `KeyType` (`Record<KeyType, unknown>`)...
231
+
232
+ ```
233
+ import type {OmitIndexSignature} from 'type-fest';
234
+
235
+ type OmitIndexSignature<ObjectType> = {
236
+ [KeyType in keyof ObjectType
237
+ // Is `{}` assignable to `Record<KeyType, unknown>`?
238
+ as {} extends Record<KeyType, unknown>
239
+ ? ... // ✅ `{}` is assignable to `Record<KeyType, unknown>`
240
+ : ... // ❌ `{}` is NOT assignable to `Record<KeyType, unknown>`
241
+ ]: ObjectType[KeyType];
242
+ };
243
+ ```
244
+
245
+ If `{}` is assignable, it means that `KeyType` is an index signature and we want to remove it. If it is not assignable, `KeyType` is a "real" key and we want to keep it.
246
+
247
+ @example
248
+ ```
249
+ import type {OmitIndexSignature} from 'type-fest';
250
+
251
+ interface Example {
252
+ // These index signatures will be removed.
253
+ [x: string]: any
254
+ [x: number]: any
255
+ [x: symbol]: any
256
+ [x: `head-${string}`]: string
257
+ [x: `${string}-tail`]: string
258
+ [x: `head-${string}-tail`]: string
259
+ [x: `${bigint}`]: string
260
+ [x: `embedded-${number}`]: string
261
+
262
+ // These explicitly defined keys will remain.
263
+ foo: 'bar';
264
+ qux?: 'baz';
265
+ }
266
+
267
+ type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
268
+ // => { foo: 'bar'; qux?: 'baz' | undefined; }
269
+ ```
270
+
271
+ @see PickIndexSignature
272
+ @category Object
273
+ */
274
+ type OmitIndexSignature<ObjectType> = {
275
+ [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown>
276
+ ? never
277
+ : KeyType]: ObjectType[KeyType];
278
+ };
279
+
280
+ /**
281
+ Pick only index signatures from the given object type, leaving out all explicitly defined properties.
282
+
283
+ This is the counterpart of `OmitIndexSignature`.
284
+
285
+ @example
286
+ ```
287
+ import type {PickIndexSignature} from 'type-fest';
288
+
289
+ declare const symbolKey: unique symbol;
290
+
291
+ type Example = {
292
+ // These index signatures will remain.
293
+ [x: string]: unknown;
294
+ [x: number]: unknown;
295
+ [x: symbol]: unknown;
296
+ [x: `head-${string}`]: string;
297
+ [x: `${string}-tail`]: string;
298
+ [x: `head-${string}-tail`]: string;
299
+ [x: `${bigint}`]: string;
300
+ [x: `embedded-${number}`]: string;
301
+
302
+ // These explicitly defined keys will be removed.
303
+ ['kebab-case-key']: string;
304
+ [symbolKey]: string;
305
+ foo: 'bar';
306
+ qux?: 'baz';
307
+ };
308
+
309
+ type ExampleIndexSignature = PickIndexSignature<Example>;
310
+ // {
311
+ // [x: string]: unknown;
312
+ // [x: number]: unknown;
313
+ // [x: symbol]: unknown;
314
+ // [x: `head-${string}`]: string;
315
+ // [x: `${string}-tail`]: string;
316
+ // [x: `head-${string}-tail`]: string;
317
+ // [x: `${bigint}`]: string;
318
+ // [x: `embedded-${number}`]: string;
319
+ // }
320
+ ```
321
+
322
+ @see OmitIndexSignature
323
+ @category Object
324
+ */
325
+ type PickIndexSignature<ObjectType> = {
326
+ [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown>
327
+ ? KeyType
328
+ : never]: ObjectType[KeyType];
329
+ };
330
+
331
+ // Merges two objects without worrying about index signatures.
332
+ type SimpleMerge<Destination, Source> = {
333
+ [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key];
334
+ } & Source;
335
+
336
+ /**
337
+ Merge two types into a new type. Keys of the second type overrides keys of the first type.
338
+
339
+ @example
340
+ ```
341
+ import type {Merge} from 'type-fest';
342
+
343
+ interface Foo {
344
+ [x: string]: unknown;
345
+ [x: number]: unknown;
346
+ foo: string;
347
+ bar: symbol;
348
+ }
349
+
350
+ type Bar = {
351
+ [x: number]: number;
352
+ [x: symbol]: unknown;
353
+ bar: Date;
354
+ baz: boolean;
355
+ };
356
+
357
+ export type FooBar = Merge<Foo, Bar>;
358
+ // => {
359
+ // [x: string]: unknown;
360
+ // [x: number]: number;
361
+ // [x: symbol]: unknown;
362
+ // foo: string;
363
+ // bar: Date;
364
+ // baz: boolean;
365
+ // }
366
+ ```
367
+
368
+ @category Object
369
+ */
370
+ type Merge<Destination, Source> =
371
+ Simplify<
372
+ SimpleMerge<PickIndexSignature<Destination>, PickIndexSignature<Source>>
373
+ & SimpleMerge<OmitIndexSignature<Destination>, OmitIndexSignature<Source>>
374
+ >;
375
+
376
+ /**
377
+ Allows creating a union type by combining primitive types and literal types without sacrificing auto-completion in IDEs for the literal type part of the union.
378
+
379
+ Currently, when a union type of a primitive type is combined with literal types, TypeScript loses all information about the combined literals. Thus, when such type is used in an IDE with autocompletion, no suggestions are made for the declared literals.
380
+
381
+ This type is a workaround for [Microsoft/TypeScript#29729](https://github.com/Microsoft/TypeScript/issues/29729). It will be removed as soon as it's not needed anymore.
382
+
383
+ @example
384
+ ```
385
+ import type {LiteralUnion} from 'type-fest';
386
+
387
+ // Before
388
+
389
+ type Pet = 'dog' | 'cat' | string;
390
+
391
+ const pet: Pet = '';
392
+ // Start typing in your TypeScript-enabled IDE.
393
+ // You **will not** get auto-completion for `dog` and `cat` literals.
394
+
395
+ // After
396
+
397
+ type Pet2 = LiteralUnion<'dog' | 'cat', string>;
398
+
399
+ const pet: Pet2 = '';
400
+ // You **will** get auto-completion for `dog` and `cat` literals.
401
+ ```
402
+
403
+ @category Type
404
+ */
405
+ type LiteralUnion<
406
+ LiteralType,
407
+ BaseType extends Primitive,
408
+ > = LiteralType | (BaseType & Record<never, never>);
409
+
410
+ type HOTShared = {
411
+ /**
412
+ * Specify the static server port. By default, Syncify uses port `41001` to
413
+ * avoid any conflicts with other running hosts of tools.
414
+ *
415
+ * @default 41001
416
+ * @example 'http://localhost:41001/some-asset.js'
417
+ */
418
+ server?: number;
419
+ /**
420
+ * Specify the websocket port. By default, Syncify uses port `51001` to
421
+ * avoid any conflicts with other running hosts of tools.
422
+ *
423
+ * @default w
424
+ * @example 'ws://localhost:51001/ws'
425
+ */
426
+ socket?: number;
427
+ /**
428
+ * Determines the reload method Syncify should use. Syncify provides 3
429
+ * reload tactics and defaults to using `hot`.
430
+ *
431
+ * > `hot`
432
+ * >
433
+ * > Performs real HMR and partial swaps (recommended)
434
+ *
435
+ * > `live`
436
+ * >
437
+ * > Similar to `hot` but each change will swap the entire `<body>`
438
+ *
439
+ * > `refresh`
440
+ * >
441
+ * > Replicates the Shopify CLI behaviour (fake reloading). Hard refreshes on every change.
442
+ *
443
+ * @default 'hot'
444
+ */
445
+ method?: LiteralUnion<'hot' | 'live' | 'refresh', string>;
446
+ /**
447
+ * Whether or not the Syncify UI status label should render.
448
+ *
449
+ * @default true
450
+ */
451
+ label?: boolean;
452
+ /**
453
+ * Controls whether ot the HOT Snippet injection is auto-removed from layout/s.
454
+ * When set to `false`, the HOT render snippet is persisted on process exit whereas
455
+ * the default behaviour is to remove it from layouts.
456
+ *
457
+ * Setting this `false` will improve start-up runtime in `--hot` mode by a few hundred ms.
458
+ *
459
+ * @default true
460
+ */
461
+ eject?: boolean
462
+ /**
463
+ * Accepts a string list of flags that enable Syncify to
464
+ * wrangle CFH slop in development mode along with normalisation.
465
+ *
466
+ * > `--no-preview-bar`
467
+ * >
468
+ * > Automatically hides the preview bar
469
+ *
470
+ * > `--no-web-pixels-manager`
471
+ * >
472
+ * > Prevents the WPM evaluation from ocurring and blocks the CFH injection scripting
473
+ *
474
+ * > `--no-checkout-preloads`
475
+ * >
476
+ * > Prevents the checkout preload tags from injecting. In development, you don't need them.
477
+ *
478
+ * > `--no-shopify-features`
479
+ * >
480
+ * > Prevents the Shopify Features scripting from evaluating and blocks the CFH injections.
481
+ *
482
+ * > `--no-trekkie`
483
+ * >
484
+ * > Prevents Trekkie from evaluating, helping per-page navigation performance in development.
485
+ *
486
+ * > `--no-perfkit`
487
+ * >
488
+ * > Prevents Perfkit scripting from evaluating and the CFH injections.
489
+ *
490
+ * @default
491
+ * [
492
+ * '--no-preview-bar',
493
+ * ]
494
+ */
495
+ flags?: [
496
+ '--no-preview-bar'?,
497
+ '--no-web-pixels-manager'?,
498
+ '--no-checkout-preloads'?,
499
+ '--no-shopify-features'?,
500
+ '--no-trekkie'?,
501
+ '--no-perfkit'?
502
+ ];
503
+ }
504
+
505
+ type HOTExtension = HOTShared & {
506
+ /**
507
+ * > **!! NOT YET AVAILABLE !!**
508
+ * >
509
+ * > **This feature is planned and not yet available for usage**
510
+ *
511
+ * The type of client-side scripting method being used. If you are using the Syncify browser
512
+ * extension then set this value to `extension`, otherwise use `inject`.
513
+ *
514
+ * @default 'injection'
515
+ */
516
+ client?: 'extension'
517
+ }
518
+
519
+ type HOTInject = HOTShared & {
520
+ /**
521
+ * The type of client-side scripting method being used. If you are using the Syncify browser
522
+ * extension then set this value to `extension`, otherwise use `inject`.
523
+ *
524
+ * @default 'injection'
525
+ */
526
+ client?: 'inject'
527
+ /**
528
+ * Set a list of theme layout files for snippet injection. This option is only applicable
529
+ * when `client` is set to `inject`.
530
+ *
531
+ * > **NOTE**
532
+ * >
533
+ * > Option does not accept path structures, only file names are to be provided
534
+ * >
535
+ * > ```js
536
+ * > // 𐄂 DO NOT DO THIS
537
+ * > ['source/layout/theme.liquid']
538
+ * >
539
+ * > // ✓ THIS IS GOOD
540
+ * > ['theme.liquid']
541
+ * > ```
542
+ *
543
+ * @default
544
+ * [
545
+ * 'theme.liquid'
546
+ * ]
547
+ */
548
+ layouts?: string[];
549
+ }
550
+
551
+ type HOT = HOTInject | HOTExtension
552
+
553
+ /* -------------------------------------------- */
554
+ /* LOGGER */
555
+ /* -------------------------------------------- */
556
+
557
+ interface Logger {
558
+ /**
559
+ * Whether or not file stats should print
560
+ *
561
+ * > Helpful when building for production (`--prod`)
562
+ *
563
+ * @default true
564
+ */
565
+ stats?: boolean;
566
+ /**
567
+ * Whether or not to print warnings
568
+ *
569
+ * @default true
570
+ */
571
+ warnings?: boolean;
572
+ /**
573
+ * Suppress CLI logs
574
+ *
575
+ * @default false
576
+ */
577
+ silent?: boolean;
578
+ /**
579
+ * Whether or not to clear the screen between changes.
580
+ *
581
+ * @default true
582
+ */
583
+ clear?: boolean;
584
+ }
585
+
586
+ type StashType = string | number;
587
+
588
+ /**
589
+ * Stash Reference
590
+ */
591
+ type Stash = {
592
+ /**
593
+ * Set a stash import location for remote `pull` operations. Files which cannot
594
+ * be mapped to an existing project-level path location (relative to your `input`)
595
+ * will be written the provided stash destination defined here.
596
+ *
597
+ * > `*`
598
+ * >
599
+ * > asterisk value signals for stashes to be written within directory at index `0`
600
+ *
601
+ * > `number`
602
+ * >
603
+ * > number value will default to `*` and write within directories at that index.
604
+ *
605
+ * > `true`
606
+ * >
607
+ * > boolean `true` value signals for stashed to be written in `stash/` directory at index `0`
608
+ *
609
+ * ---
610
+ *
611
+ * You can optionally provide a sub-directory path.
612
+ *
613
+ */
614
+ stash: StashType;
615
+ }
616
+
617
+ /**
618
+ * String or Array of strings
619
+ */
620
+ type Path = string | string[];
621
+
622
+ /**
623
+ * Union join of accepted Path patterns
624
+ */
625
+ type Pattern = Path | [ ...globs: string[], stash: Stash ];
626
+
627
+ /**
628
+ * Section and Snippet Rename Paths
629
+ */
630
+ type Rename = {
631
+ /**
632
+ * Uses the filename as per the source, idenitical behaviour as that of `[name]`.
633
+ *
634
+ * @example
635
+ * {
636
+ * sections: {
637
+ * '[dir]-[name]': [
638
+ * 'sections/foo/*', // sections in this directory will prefix foo-
639
+ * 'sections/bar/*' // sections in this directory will prefix bar-
640
+ * ],
641
+ * '*': [
642
+ * './sections/**', // all other sections will use source name
643
+ * { stash: 'files' } // stashes imports within sections/files
644
+ * ],
645
+ * },
646
+ * snippets: {
647
+ * '[dir]-[name]': [
648
+ * 'snippets/foo/*', // snippets in this directory will prefix foo-
649
+ * 'snippets/bar/*' // snippets in this directory will prefix bar-
650
+ * ],
651
+ * '*': [
652
+ * './snippets/**', // all other snippets will use source name
653
+ * { stash: true } // stashes will be written
654
+ * ]
655
+ * }
656
+ * }
657
+ */
658
+ '*'?: Pattern;
659
+ /**
660
+ * Use the filename as per the source. Passing `[name]` only will result in fallback
661
+ * behaviour, as that of `'*'`.
662
+ *
663
+ * @example
664
+ * @example
665
+ * {
666
+ * sections: {
667
+ * '[dir]-[name]': [
668
+ * 'sections/foo/*', // sections in this directory will prefix foo-
669
+ * ],
670
+ * 'xxx-[name]': [
671
+ * 'sections/bar/*', // sections in this directory will prefix xxx-
672
+ * ],
673
+ * '[name]': [
674
+ * './sections/**' // all other sections will use source filename
675
+ * ]
676
+ * },
677
+ * snippets: {
678
+ * '[dir]-[name]': [
679
+ * 'snippets/foo/*', // snippets in this directory will prefix foo-
680
+ * ],
681
+ * 'xxx-[name]': [
682
+ * 'snippets/bar/*', // snippets in this directory will prefix xxx-
683
+ * ],
684
+ * '[name]': [
685
+ * './snippets/**' // all other sections will use source filename
686
+ * ]
687
+ * }
688
+ * }
689
+ */
690
+ '[name]'?: Pattern;
691
+ /**
692
+ * Prefix directory name and suffix filename in **kebab-case** format.
693
+ *
694
+ * @example
695
+ * 'layout/header.liquid' > 'layout-header.liquid'
696
+ */
697
+ '[dir]-[name]'?: Pattern;
698
+ /**
699
+ * Prefix directory name and suffix filename in **snake_case** format.
700
+ *
701
+ * @example
702
+ * 'layout/header.liquid' > 'layout_header.liquid'
703
+ */
704
+ '[dir]_[name]'?: Pattern;
705
+ /**
706
+ * Prefix filename and suffix directory in **kebab-case** format.
707
+ *
708
+ * @example
709
+ * 'layout/header.liquid' > 'header-layout.liquid'
710
+ */
711
+ '[name]-[dir]'?: Pattern;
712
+ /**
713
+ * Prefix filename and suffix directory in **snake_case** format.
714
+ *
715
+ * @example
716
+ * 'layout/header.liquid' > 'header_layout.liquid'
717
+ */
718
+ '[name]_[dir]'?: Pattern;
719
+ }
720
+
721
+ /**
722
+ * Snippet Renames accept `.` separated values
723
+ */
724
+ type RenameSnippets = Rename & {
725
+ /**
726
+ * Prefix filename and suffix directory with `.` dot separator.
727
+ *
728
+ * @example
729
+ * 'layout/header.liquid' > 'header.layout.liquid'
730
+ */
731
+ '[name].[dir]'?: Pattern;
732
+ /**
733
+ * Prefix directory and suffix filename with `.` dot separator.
734
+ *
735
+ * @example
736
+ * 'layout/header.liquid' > 'layout.header.liquid'
737
+ */
738
+ '[dir].[name]'?: Pattern;
739
+ }
740
+
741
+ type Paths = {
742
+ /**
743
+ * A glob string, glob array or rename `output → input` key/value object of files to be uploaded as snippets.
744
+ *
745
+ * @default 'source/snippets/*.{liquid}'
746
+ * @example
747
+ *
748
+ * //OPTION 1 - Globs
749
+ * {
750
+ * snippets: 'source/snippets/*.liquid'
751
+ * }
752
+ *
753
+ * //OPTION 2 - Globs Array
754
+ * {
755
+ * snippets: [
756
+ * 'source/snippets/*.liquid',
757
+ * 'source/snippets/xxx/*'
758
+ * ]
759
+ * }
760
+ *
761
+ * //OPTION 3 - Rename Object
762
+ * {
763
+ * snippets: {
764
+ * // Output will be: snippets/foo.bar.liquid
765
+ * '[dir].[name]': 'source/snippets/foo/bar.liquid',
766
+ * // Output will be: snippets/quz-baz.liquid
767
+ * '[name]-[dir]': 'source/snippets/baz/qux.liquid'
768
+ * }
769
+ * }
770
+ *
771
+ *
772
+ * //OPTION 4 - Rename Object Glob Array
773
+ * {
774
+ * snippets: {
775
+ * // Output will be: snippets/foo.bar.liquid
776
+ * // Output will be: snippets/baz.qux.liquid
777
+ * '[dir].[name]': [
778
+ * 'source/snippets/foo/bar.liquid',
779
+ * 'source/snippets/baz/qux.liquid'
780
+ * ]
781
+ * }
782
+ * }
783
+ */
784
+ snippets?: Pattern | RenameSnippets
785
+ /**
786
+ * A glob string, glob array or rename `output → input` key/value object of files to be uploaded as sections.
787
+ *
788
+ * > **NOTE**
789
+ * > This path reference will also sync section group files.
790
+ *
791
+ * @default 'source/sections/*.{liquid,json}'
792
+ * @example
793
+ *
794
+ * //OPTION 1 - Globs
795
+ * {
796
+ * sections: 'source/sections/*.liquid'
797
+ * }
798
+ *
799
+ * //OPTION 2 - Globs Array
800
+ * {
801
+ * sections: [
802
+ * 'source/sections/*.liquid',
803
+ * 'source/sections/xxx/*'
804
+ * ]
805
+ * }
806
+ *
807
+ * //OPTION 3 - Rename Object Glob
808
+ * {
809
+ * sections: {
810
+ * // Output will be: sections/foo.bar.liquid
811
+ * '[dir].[name]': 'source/sections/foo/bar.liquid',
812
+ * // Output will be: sections/quz-baz.liquid
813
+ * '[name]-[dir]': 'source/sections/baz/qux.liquid'
814
+ * }
815
+ * }
816
+ *
817
+ * //OPTION 4 - Rename Object Glob Array
818
+ * {
819
+ * sections: {
820
+ * // Output will be: sections/foo.bar.liquid
821
+ * // Output will be: sections/baz.qux.liquid
822
+ * '[dir].[name]': [
823
+ * 'source/sections/foo/bar.liquid',
824
+ * 'source/sections/baz/qux.liquid'
825
+ * ]
826
+ * }
827
+ * }
828
+ *
829
+ * //OPTION 5 - Define a custom stash
830
+ * {
831
+ * sections: [
832
+ * 'source/sections/*.liquid',
833
+ * 'source/sections/xxx/*',
834
+ * { stash: '*' } // pull stashes will write to source/sections/*
835
+ * ]
836
+ * }
837
+ */
838
+ sections?: Pattern | Rename;
839
+ /**
840
+ * A glob string or glob array of files to be uploaded as blocks
841
+ *
842
+ * @default 'source/blocks/*.{liquid}'
843
+ */
844
+ blocks?: Pattern;
845
+ /**
846
+ * A glob string or glob array of files to be uploaded as templates.
847
+ *
848
+ * @default 'source/templates/*.{liquid,json}'
849
+ */
850
+ templates?: Pattern;
851
+ /**
852
+ * A glob string or glob array of files to be uploaded asas metaobject templates
853
+ *
854
+ * @default 'source/templates/metaobject/*.{liquid,json}'
855
+ */
856
+ metaobject?: Pattern;
857
+ /**
858
+ * A glob string or glob array of files to be uploaded as template/customers
859
+ *
860
+ * @default 'source/templates/customers/*.{liquid,json}'
861
+ */
862
+ customers?: Pattern;
863
+ /**
864
+ * A glob string or glob array of files to be uploaded as assets
865
+ *
866
+ * @default 'source/assets/*'
867
+ */
868
+ assets?: Pattern;
869
+ /**
870
+ * A glob string or glob array of files to be uploaded as layouts
871
+ *
872
+ * @default 'source/layout/*.liquid'
873
+ */
874
+ layout?: Pattern;
875
+ /**
876
+ * A glob string or glob array of files to be uploaded as configs, i.e, `settings_schema.json`
877
+ *
878
+ * @default 'source/config/.json'
879
+ */
880
+ config?: Pattern;
881
+ /**
882
+ * A glob string or glob array of files to be uploaded as config, i.e, `en.default.json`
883
+ *
884
+ * @default 'source/locales/*.json'
885
+ */
886
+ locales?: Pattern;
887
+ /**
888
+ * A glob string or glob array of files to be uploaded as **shared schema** `.json` or `.schema` files.
889
+ *
890
+ * @default 'source/+/schema/*.{json,schema}'
891
+ */
892
+ schema?: Path;
893
+ /**
894
+ * **NOT YET AVAILABLE**
895
+ *
896
+ * **This option will be available in later versions**
897
+ *
898
+ * ---
899
+ *
900
+ * The resolved `metafields` directory path
901
+ *
902
+ * @default 'source/+/metafields/**'
903
+ */
904
+ metafields?: Path;
905
+ /**
906
+ * **NOT YET AVAILABLE**
907
+ *
908
+ * **This option will be available in later versions**
909
+ *
910
+ * A glob string or glob array string to be uploaded, published and controlled as `pages`
911
+ *
912
+ * @default 'source/+/pages/*.{md,html}'
913
+ */
914
+ pages?: Path;
915
+ /**
916
+ * **NOT YET AVAILABLE**
917
+ *
918
+ * **This option will be available in later versions**
919
+ *
920
+ * @default 'source/+/blogs/*'
921
+ */
922
+ blogs?: Path;
923
+ /**
924
+ * **NOT YET AVAILABLE**
925
+ *
926
+ * **This option will be available in later versions**
927
+ *
928
+ * @default 'source/+/menus/*.json'
929
+ */
930
+ navigation?: Path;
931
+ /**
932
+ * **NOT YET AVAILABLE**
933
+ *
934
+ * **This option will be available in later versions**
935
+ *
936
+ * @default 'source/+/policies/*.{html,md}'
937
+ */
938
+ policies?: Path;
939
+ /**
940
+ * **NOT YET AVAILABLE**
941
+ *
942
+ * **This option will be available in later versions**
943
+ *
944
+ * @default 'source/+/files/**'
945
+ */
946
+ files?: Path;
947
+ }
948
+
949
+ type ScriptRename = `${'assets' | 'snippets'}/${string}`
950
+
951
+ type TargetBrowser = (
952
+ | 'chrome'
953
+ | 'deno'
954
+ | 'edge'
955
+ | 'firefox'
956
+ | 'hermes'
957
+ | 'ie'
958
+ | 'ios'
959
+ | 'node'
960
+ | 'opera'
961
+ | 'rhino'
962
+ | 'safari'
963
+ );
964
+
965
+ type TargetBrowserVersion = (
966
+ | `${TargetBrowser}${number}`
967
+ | `${TargetBrowser}${number}.${number}`
968
+ | `${TargetBrowser}${number}.${number}.${number}`
969
+ );
970
+
971
+ type TargetESVersion = (
972
+ | 'es3'
973
+ | 'es5'
974
+ | 'es6'
975
+ | 'es2015'
976
+ | 'es2016'
977
+ | 'es2017'
978
+ | 'es2018'
979
+ | 'es2019'
980
+ | 'es2020'
981
+ | 'es2021'
982
+ | 'es2022'
983
+ | 'esnext'
984
+ );
985
+
986
+ type ESBuildAllowedOptions = Pick<BuildOptions, (
987
+ | 'alias'
988
+ | 'assetNames'
989
+ | 'banner'
990
+ | 'bundle'
991
+ | 'charset'
992
+ | 'chunkNames'
993
+ | 'entryNames'
994
+ | 'conditions'
995
+ | 'define'
996
+ | 'external'
997
+ | 'footer'
998
+ | 'format'
999
+ | 'globalName'
1000
+ | 'inject'
1001
+ | 'ignoreAnnotations'
1002
+ | 'tsconfigRaw'
1003
+ | 'tsconfig'
1004
+ | 'treeShaking'
1005
+ | 'target'
1006
+ | 'jsx'
1007
+ | 'keepNames'
1008
+ | 'jsxDev'
1009
+ | 'jsxFactory'
1010
+ | 'jsxFragment'
1011
+ | 'jsxImportSource'
1012
+ | 'jsxSideEffects'
1013
+ | 'loader'
1014
+ | 'minify'
1015
+ | 'mangleCache'
1016
+ | 'mangleQuoted'
1017
+ | 'mangleProps'
1018
+ | 'minifyIdentifiers'
1019
+ | 'minifySyntax'
1020
+ | 'minifyWhitespace'
1021
+ | 'mangleQuoted'
1022
+ | 'metafile'
1023
+ | 'drop'
1024
+ | 'splitting'
1025
+ | 'supported'
1026
+ | 'sourcesContent'
1027
+ | 'sourceRoot'
1028
+ | 'sourcemap'
1029
+ | 'pure'
1030
+ | 'plugins'
1031
+ | 'publicPath'
1032
+ )>
1033
+
1034
+
1035
+ type ESBuildTarget = (
1036
+ | TargetBrowser
1037
+ | TargetBrowserVersion
1038
+ | TargetESVersion
1039
+ );
1040
+
1041
+ /**
1042
+ * Public exposed configurations
1043
+ */
1044
+ type ESBuildConfig = Merge<ESBuildAllowedOptions, {
1045
+ /**
1046
+ * The format to be generated. Because we are targeting
1047
+ * browser environments, Syncify does not allow for CJS (commonjs)
1048
+ * bundles to be produced.
1049
+ *
1050
+ * @default 'esm'
1051
+ */
1052
+ format?: 'esm' | 'iife';
1053
+ /**
1054
+ * Whether or not sourcemaps should be generated.
1055
+ * Syncify will process sourcemap generation internally,
1056
+ * so this option only accepts a boolean value.
1057
+ *
1058
+ * @default true
1059
+ */
1060
+ sourcemap?: boolean;
1061
+ }
1062
+ >;
1063
+
1064
+ /* -------------------------------------------- */
1065
+ /* TRANSFORM */
1066
+ /* -------------------------------------------- */
1067
+
1068
+ type ScriptSharedConfig = {
1069
+ /**
1070
+ * JS/TS input source paths. Accepts `string` or `string[]` glob patterns.
1071
+ * Resolution is relative to your defined `input` directory.
1072
+ *
1073
+ * ---
1074
+ *
1075
+ * @default undefined
1076
+ */
1077
+ input: string | string[];
1078
+ /**
1079
+ * This sets the target environment for the generated JavaScript. It
1080
+ * tells esbuild to transform JavaScript syntax which is too new for
1081
+ * these environments into older JavaScript syntax that works in this
1082
+ * environment\s.
1083
+ *
1084
+ * ---
1085
+ *
1086
+ * @default 'es2016'
1087
+ */
1088
+ target?: ESBuildTarget | ESBuildTarget[];
1089
+ /**
1090
+ * Instructs ESBuild to treat these modules as external. The import/s
1091
+ * will be preserved and evaluated at run time instead.
1092
+ *
1093
+ * ---
1094
+ *
1095
+ * @see
1096
+ * https://esbuild.github.io/api/#external
1097
+ *
1098
+ * @default
1099
+ * []
1100
+ */
1101
+ external?: string[];
1102
+ /**
1103
+ * Rename the JavaScript file/s. The same name as source file will be used
1104
+ * when undefined. Accepts namespaces, `[file]` or `[name]`, `[dir]` and/or `[ext]`.
1105
+ *
1106
+ * ---
1107
+ *
1108
+ * @default undefined
1109
+ */
1110
+ rename?: string;
1111
+ /**
1112
+ * Optionally write the javascript file inline as a snippet. This will transform
1113
+ * the JS and contained code will be output within `<script></script>` tags as a
1114
+ * `snippet.liquid` file.
1115
+ *
1116
+ * @default false
1117
+ */
1118
+ snippet?: boolean;
1119
+ /**
1120
+ * When `snippet` is `true` you can provide an additional list of attributes to
1121
+ * be applied to inlined `<script>` tag which code will be output within. This only applies
1122
+ * to snippet generation and entries will be ignored if snippet is `false`.
1123
+ *
1124
+ * **Example Definition**
1125
+ *
1126
+ * ```js
1127
+ * // Attribute definitions
1128
+ * {
1129
+ * attrs: [
1130
+ * ['id', 'foo']
1131
+ * ['data-attr', 'bar'],
1132
+ * ['{{ object.prop }}'],
1133
+ * ['{% if xxx %}', 'data-xxx', '{% endif %}']
1134
+ * ]
1135
+ * }
1136
+ * ```
1137
+ *
1138
+ * **Example Output**
1139
+ *
1140
+ * ```liquid
1141
+ * <script
1142
+ * id="foo"
1143
+ * data-attr="bar"
1144
+ * {{ object.prop }}
1145
+ * {% if xxx %}data-xxx{% endif %}></script>
1146
+ * ```
1147
+ *
1148
+ * // Output
1149
+ * @default []
1150
+ */
1151
+ attrs?: Array<string[]>;
1152
+ /**
1153
+ * Entry points (paths/files) to watch that will trigger a rebuilds of
1154
+ * the defined _input_ file. By default, Syncify will watch all import entries
1155
+ * imported by the _input_.
1156
+ *
1157
+ * @default []
1158
+ */
1159
+ watch?: string[]
1160
+ /**
1161
+ * [ESBuild](https://esbuild.github.io/) Override
1162
+ *
1163
+ * ESBuild file transforms will use the options provided to `processor.esbuild`
1164
+ * but you can optionally override those defaults on a per-transform
1165
+ * basis. Any configuration options defined here will be merged with
1166
+ * the options defined in `processor.esbuild`.
1167
+ *
1168
+ * You can also skip pre-processing with esbuild by passing a _boolean_
1169
+ * `false` which will inform Syncify to skip processing scripts with ESBuild.
1170
+ *
1171
+ * @default true // if esbuild is not installed this is false
1172
+ */
1173
+ esbuild?: boolean | ESBuildConfig;
1174
+ }
1175
+
1176
+ type ScriptFormatESM = ScriptSharedConfig & {
1177
+
1178
+ /**
1179
+ * The format to be generated. Because we are targeting
1180
+ * browser environments, Syncify does not allow for CJS (commonjs)
1181
+ * bundles to be produced.
1182
+ *
1183
+ * @default 'esm'
1184
+ */
1185
+ format?: 'esm';
1186
+ }
1187
+
1188
+ type ScriptFormatIIFE = ScriptSharedConfig & {
1189
+ /**
1190
+ * The format to be generated. Because we are targeting
1191
+ * browser environments, Syncify does not allow for CJS (commonjs)
1192
+ * bundles to be produced.
1193
+ *
1194
+ * @see https://esbuild.github.io/api/#format
1195
+ * @default 'esm'
1196
+ */
1197
+ format?: 'iife';
1198
+ /**
1199
+ * Sets the name of the global variable which is used to store the
1200
+ * exports from the entry point.
1201
+ *
1202
+ * @see https://esbuild.github.io/api/#global-name
1203
+ * @default undefined
1204
+ */
1205
+ globalName?: string;
1206
+ }
1207
+
1208
+ type ScriptTransform = ScriptFormatESM | ScriptFormatIIFE;
1209
+
1210
+ /* -------------------------------------------- */
1211
+ /* TRANSFORMER */
1212
+ /* -------------------------------------------- */
1213
+
1214
+ type ScriptTransformer = (
1215
+ | string
1216
+ | string[]
1217
+ | ScriptTransform
1218
+ | ScriptTransform[]
1219
+ | Record<ScriptRename, string>
1220
+ | Record<ScriptRename, string[]>
1221
+ | Record<ScriptRename, Omit<ScriptTransform, 'rename'>>
1222
+ )
1223
+
1224
+ /* -------------------------------------------- */
1225
+ /* PROCESSOR CONFIGS */
1226
+ /* -------------------------------------------- */
1227
+
1228
+ type StyleRename = `${'assets' | 'snippets'}/${string}`
1229
+
1230
+ type PostCSSConfig = (
1231
+ | AcceptedPlugin
1232
+ | Plugin
1233
+ | Transformer
1234
+ | TransformCallback
1235
+ | any
1236
+ );
1237
+
1238
+ /**
1239
+ * Style Minification
1240
+ */
1241
+ type StyleTerse = OptionsOutput & {
1242
+ /**
1243
+ * Whether or not to purge unused CSS class names
1244
+ *
1245
+ * @default false
1246
+ */
1247
+ purgeUnusedCSS?: boolean;
1248
+ /**
1249
+ * Whether or not to obfuscate CSS class names
1250
+ *
1251
+ * @default false
1252
+ */
1253
+ obfuscateClassNames?: boolean;
1254
+ /**
1255
+ * List of class names that should be excluded from
1256
+ * obfuscation and shortnaming.
1257
+ */
1258
+ obfuscateWhitelist?: string[];
1259
+ /**
1260
+ * The alphabet used to generate the new class names.
1261
+ *
1262
+ * > **NOTE**
1263
+ * >
1264
+ * > There is no `d` in the default alphabet to avoid adblock issues.
1265
+ *
1266
+ * @default 'abcefghijklmnopqrstuvwxyz0123456789'
1267
+ */
1268
+ obfuscateAlphabet?: string;
1269
+ /**
1270
+ * Excluded files from terser minification
1271
+ *
1272
+ * @default []
1273
+ */
1274
+ exclude?: string[]
1275
+ }
1276
+
1277
+ type TailwindConfig = Config$1 & {
1278
+ config: string[]
1279
+ }
1280
+
1281
+ type SASSConfig = {
1282
+ /**
1283
+ * Whether or not to generate sourcemaps
1284
+ *
1285
+ * @default true
1286
+ */
1287
+ sourcemap?: boolean;
1288
+ /**
1289
+ * The style compiled CSS should be output.
1290
+ *
1291
+ * @default 'compressed'
1292
+ */
1293
+ style?: 'expanded' | 'compressed';
1294
+ /**
1295
+ * Whether or not to print warnings to CLI - Warnings will require
1296
+ * an `stdin` invocation to view. Setting this to `false` will hide
1297
+ * warnings all together.
1298
+ *
1299
+ * @default true
1300
+ */
1301
+ warnings?: boolean;
1302
+ /**
1303
+ * This option is passed to SASS Dart compile instance. If this option is set to `true`,
1304
+ * Sass won’t print warnings that are caused by dependencies. A "dependency" is defined
1305
+ * as any file that’s loaded through external sources.
1306
+ *
1307
+ * This is useful for silencing deprecation warnings that you can’t fix on your own.
1308
+ * However, please also notify your dependencies of the deprecations so that they can get
1309
+ * fixed as soon as possible!
1310
+ *
1311
+ * @default false
1312
+ */
1313
+ quietDeps?: boolean;
1314
+ /**
1315
+ * A list of paths to include, ie: node_modules.
1316
+ *
1317
+ * @default ['node_modules']
1318
+ */
1319
+ include?: string[];
1320
+ }
1321
+
1322
+ /* -------------------------------------------- */
1323
+ /* TRANSFORM */
1324
+ /* -------------------------------------------- */
1325
+
1326
+ type StyleTransform<T = string | string[]> = {
1327
+ /**
1328
+ * SVG input source paths. Accepts `string` or `string[]` glob patterns.
1329
+ * Resolution is relative to your defined `input` directory.
1330
+ *
1331
+ * @default undefined
1332
+ */
1333
+ input: T;
1334
+ /**
1335
+ * Glob stylesheet paths/files to watch. When changes
1336
+ * are applied to matched files, then the defined `input`
1337
+ * will be compiled.
1338
+ *
1339
+ * @default []
1340
+ */
1341
+ watch?: string[];
1342
+ /**
1343
+ * Rename the stylesheet file/s. The same name as source file will be used
1344
+ * when undefined. Accepts namespaces, `[file]`, `[dir]` and `[ext]`.
1345
+ *
1346
+ * ---
1347
+ *
1348
+ * @default undefined
1349
+ */
1350
+ rename?: string;
1351
+ /**
1352
+ * Optionally output the CSS as a snippet. This will transform
1353
+ * the stylesheet inline, wrap output within `<style></style>`
1354
+ * tags and write it to `snippets`.
1355
+ *
1356
+ * @default false
1357
+ */
1358
+ snippet?: boolean;
1359
+ /**
1360
+ * When `snippet` is `true` you can provide an additional list of attributes to
1361
+ * be applied to `<style>` tag which code will be output within. This only applies
1362
+ * to snippet generation and entries will be ignored if snippet is `false`.
1363
+ *
1364
+ * **Example Definition**
1365
+ *
1366
+ * ```js
1367
+ * // Attribute definitions
1368
+ * {
1369
+ * attrs: [
1370
+ * ['id', 'foo']
1371
+ * ['data-attr', 'bar'],
1372
+ * ['{{ object.prop }}'],
1373
+ * ['{% if xxx %}', 'data-xxx', '{% endif %}']
1374
+ * ]
1375
+ * }
1376
+ * ```
1377
+ *
1378
+ * **Example Output**
1379
+ *
1380
+ * ```liquid
1381
+ * <style
1382
+ * id="foo"
1383
+ * data-attr="bar"
1384
+ * {{ object.prop }}
1385
+ * {% if xxx %}data-xxx{% endif %}></style>
1386
+ * ```
1387
+ *
1388
+ * // Output
1389
+ * @default []
1390
+ */
1391
+ attrs?: string[][];
1392
+ /**
1393
+ *
1394
+ * [TailwindCSS](https://tailwindcss.com/) Override
1395
+ *
1396
+ * Tailwind transforms will use the `tailwind.config.js` configuration
1397
+ * file in your projects root (or defined `config` path). If you have not
1398
+ * provided a tailwind config file, then syncify will use options defined
1399
+ * via `processor.tailwind`. You can optionally override configuration
1400
+ * on a per-transform basis and any options defined here will be merged with
1401
+ * those defined in your `tailwind.config.js` or `processor.tailwind`.
1402
+ *
1403
+ * @default true // if tailwind is not installed this is false
1404
+ */
1405
+ tailwind?: boolean | Partial<TailwindConfig>;
1406
+ /**
1407
+ * [PostCSS](https://postcss.org/) Override
1408
+ *
1409
+ * CSS File transforms will use the options provided to `processor.postcss`
1410
+ * but you can optionally override those defaults on a per-transform
1411
+ * basis. Any configuration options defined here will be merged with
1412
+ * the options defined in `processor.postcss`.
1413
+ *
1414
+ * You can also skip pre-processing with postcss by passing a _boolean_
1415
+ * `false` which will inform Syncify to not pass output to PostCSS. By
1416
+ * default, Syncify will pass all compiled SASS and files with `.css`
1417
+ * extensions to PostCSS.
1418
+ *
1419
+ * @default true // if postcss is not installed this is false
1420
+ */
1421
+ postcss?: boolean | PostCSSConfig[];
1422
+ /**
1423
+ * [SASS Dart](https://sass-lang.com/documentation/js-api/) Override
1424
+ *
1425
+ * SASS File transforms will use the options provided to `processor.sass`
1426
+ * but you can optionally override those defaults on a per-transform
1427
+ * basis. Any configuration options defined here will be merged with
1428
+ * the options defined in `processor.sass`.
1429
+ *
1430
+ * You can also skip SASS transfroms by passing a _boolean_ `false` which will
1431
+ * inform Syncify to not pass output to SASS, which is the default if SASS is not
1432
+ * installed.
1433
+ *
1434
+ * By default, Syncify will forward all input files using `.scss` or `.sass`
1435
+ * or extension to SASS Dart. If you have PostCSS installed then Syncify will
1436
+ * automatically pass SASS files to PostCSS in the post-process.
1437
+ *
1438
+ * @default true // if sass is not installed this is false
1439
+ */
1440
+ sass?: boolean | SASSConfig;
1441
+ /**
1442
+ * **NOTE YET AVAILABLE**
1443
+ *
1444
+ * Terse Style (CSS) Minification
1445
+ *
1446
+ * > Uses [clean-css](https://github.com/clean-css/clean-css) minification
1447
+ * > Uses [purge-css](https://github.com/FullHuman/purgecss)
1448
+ */
1449
+ terse?: boolean | SASSConfig;
1450
+ }
1451
+
1452
+ /* -------------------------------------------- */
1453
+ /* TRANSFORMER */
1454
+ /* -------------------------------------------- */
1455
+
1456
+ type StyleTransformer = (
1457
+ | string
1458
+ | string[]
1459
+ | StyleTransform
1460
+ | StyleTransform[]
1461
+ | Record<StyleRename, string>
1462
+ | Record<StyleRename, string[]>
1463
+ | Record<StyleRename, Pick<StyleTransform, 'postcss' | 'sass' | 'tailwind' | 'snippet' | 'watch' | 'input'>>
1464
+ )
1465
+
1466
+ /* -------------------------------------------- */
1467
+ /* SHARED */
1468
+ /* -------------------------------------------- */
1469
+
1470
+ type RenamePaths = `${'assets' | 'snippets'}/${string}`
1471
+
1472
+ type SVGFile = {
1473
+ /**
1474
+ * SVG input source paths. Accepts `string` or `string[]` glob patterns.
1475
+ * Resolution is relative to your defined `input` directory.
1476
+ *
1477
+ * @default ''
1478
+ */
1479
+ input: string | string[];
1480
+ /**
1481
+ * The SVG export format. Syncify can produce 2 different SVG formats.
1482
+ * All SVG file types will pre-process and transform using [SVGO](https://github.com/svg/svgo).
1483
+ * This option cannot be undefined and is required.
1484
+ *
1485
+ * ---
1486
+ *
1487
+ * > `file`
1488
+ * >
1489
+ * > SVG transforms using a `file` format will produce individual `.svg` files from
1490
+ * that can be output as an`asset` or inlined into a `snippet`
1491
+ *
1492
+ * > `sprite`
1493
+ * >
1494
+ * > SVG transforms using a `sprite` format will produce an SVG Sprite that can be
1495
+ * output as an `asset` or inlined into a `snippet`
1496
+ */
1497
+ format: 'file';
1498
+ /**
1499
+ * Rename the svg file/s. The same name as source file will be used
1500
+ * when undefined. Accepts namespaces, `[file]`, `[dir]` and `[ext]`.
1501
+ * ---
1502
+ *
1503
+ * @default undefined
1504
+ *
1505
+ * @example
1506
+ * 'source/svgs/arrow.svg' > 'arrow.svg' // if snippet is false
1507
+ * 'source/svgs/checkmark.svg' > 'checkmark.liquid' // if snippet is true
1508
+ */
1509
+ rename?: string;
1510
+ /**
1511
+ * Whether to generate svg as snippet or asset. When `true` the
1512
+ * svg source will be written as a snippet
1513
+ *
1514
+ * @default false
1515
+ */
1516
+ snippet?: boolean;
1517
+ /**
1518
+ * [SVGO](https://github.com/svg/svgo) Override
1519
+ *
1520
+ * SVG File transforms will use the options provided to `processor.svgo`
1521
+ * but you can optionally override those defaults on a per-transform
1522
+ * basis. Any configuration options defined here will be merged with
1523
+ * the options defined in `processor.svgo`.
1524
+ *
1525
+ * @default
1526
+ * processor.svgo // When processor configuration is defined
1527
+ */
1528
+ svgo?: Config$2;
1529
+ }
1530
+
1531
+ type SVGSprite = Omit<SVGFile, 'format'> & {
1532
+ /**
1533
+ * The SVG export format. Syncify can produce 2 different SVG formats.
1534
+ * All SVG file types will pre-process and transform using [SVGO](https://github.com/svg/svgo).
1535
+ * This option cannot be undefined and is required.
1536
+ *
1537
+ * ---
1538
+ *
1539
+ * > `file`
1540
+ * >
1541
+ * > SVG transforms using a `file` format will produce individual `.svg` files from
1542
+ * that can be output as an`asset` or inlined into a `snippet`
1543
+ *
1544
+ * > `sprite`
1545
+ * >
1546
+ * > SVG transforms using a `sprite` format will produce an SVG Sprite that can be
1547
+ * output as an `asset` or inlined into a `snippet`
1548
+ */
1549
+ format: 'sprite';
1550
+ /**
1551
+ * Add a DOCTYPE declaration to SVG documents
1552
+ *
1553
+ * @type {boolean}
1554
+ */
1555
+ sprite?: {
1556
+ /**
1557
+ * Apply a custome set of sprite attributes on the
1558
+ * parent `<svg>` element containing the `<symbol>` reference.
1559
+ *
1560
+ * **Example Definition**
1561
+ *
1562
+ * ```js
1563
+ * // Attribute definitions
1564
+ * {
1565
+ * attrs: [
1566
+ * ['id', 'foo']
1567
+ * ['data-attr', 'bar'],
1568
+ * ['{{ object.prop }}'],
1569
+ * ['{% if xxx %}', 'data-xxx', '{% endif %}']
1570
+ * ]
1571
+ * }
1572
+ * ```
1573
+ *
1574
+ * **Example Output**
1575
+ *
1576
+ * ```liquid
1577
+ * <svg
1578
+ * id="foo"
1579
+ * data-attr="bar"
1580
+ * {{ object.prop }}
1581
+ * {% if xxx %}data-xxx{% endif %}>
1582
+ * <symbol id="a">....</symbol>
1583
+ * <symbol id="b">....</symbol>
1584
+ * <symbol id="c">....</symbol>
1585
+ * </svg>
1586
+ * ```
1587
+ *
1588
+ * // Output
1589
+ * @default []
1590
+ */
1591
+ attrs?: Array<string[]>;
1592
+ /**
1593
+ * Additional optional to be applied on containing `<symbol>`
1594
+ * elements in the sprite.
1595
+ */
1596
+ symbols?: {
1597
+ /**
1598
+ * The identifier applied to `<symbol>` elements. This
1599
+ * value will be the `<use>` referenced via `xlink:href`.
1600
+ * By default, Syncify prefixes `svg-` followed by SVG filename.
1601
+ *
1602
+ * > `[id]`
1603
+ * >
1604
+ * > Passing a value of `[id]` will instruct syncify to use the `id=""` value
1605
+ * > already applied and when missing fallback to the default `svg-`
1606
+ *
1607
+ *
1608
+ * **Example**
1609
+ *
1610
+ * ```liquid
1611
+ * <!-- REFERENCING -->
1612
+ * <svg><use xlink:href="#svg-a"></use></svg>
1613
+ * <svg><use xlink:href="#svg-b"></use></svg>
1614
+ * <svg><use xlink:href="#svg-c"></use></svg>
1615
+ *
1616
+ * <!-- EXAMPLE SPRITE -->
1617
+ * <svg>
1618
+ * <symbol id="a">...</symbol>
1619
+ * <symbol id="b">...</symbol>
1620
+ * <symbol id="c">...</symbol>
1621
+ * </svg>
1622
+ * ```
1623
+ */
1624
+ id?: LiteralUnion<`${string}-[name]` | `[name]-${string}` | '[id]', string>;
1625
+ /**
1626
+ * Whether or not containing `<symbol>` elements should be annotated
1627
+ * with `xmlns` attributes. Defaults to `false`.
1628
+ *
1629
+ * **Example Output**
1630
+ *
1631
+ * ```liquid
1632
+ * <svg>
1633
+ * <symbol id="a" xmlns="http://www.w3.org/2000/svg">...</symbol>
1634
+ * <symbol id="b" xmlns="http://www.w3.org/2000/svg">...</symbol>
1635
+ * <symbol id="c" xmlns="http://www.w3.org/2000/svg">...</symbol>
1636
+ * </svg>
1637
+ * ```
1638
+ *
1639
+ * @default false
1640
+ */
1641
+ xmlns?: boolean;
1642
+ }
1643
+ }
1644
+ }
1645
+
1646
+ type SVGTransform = SVGFile | SVGSprite
1647
+
1648
+ /* -------------------------------------------- */
1649
+ /* TRANSFORMER */
1650
+ /* -------------------------------------------- */
1651
+
1652
+ type SVGTransformer = (
1653
+ | string
1654
+ | string[]
1655
+ | SVGTransform
1656
+ | SVGTransform[]
1657
+ | Record<RenamePaths, string>
1658
+ | Record<RenamePaths, string[]>
1659
+ | Record<RenamePaths, SVGTransform>
1660
+ )
1661
+
1662
+ /**
1663
+ * Processor Default Configurations
1664
+ *
1665
+ * Holds reference to default config options for each supported processor.
1666
+ */
1667
+ type Processors = {
1668
+ /**
1669
+ * [ESBuild](https://esbuild.github.io/) Config
1670
+ */
1671
+ esbuild?: ESBuildConfig;
1672
+ /**
1673
+ * [PostCSS](https://postcss.org/) Plugins
1674
+ */
1675
+ postcss?: PostCSSConfig[];
1676
+ /**
1677
+ * [TailwindCSS](https://tailwindcss.com/) Config
1678
+ */
1679
+ tailwind?: TailwindConfig[];
1680
+ /**
1681
+ * [SASS Dart](https://sass-lang.com/documentation/js-api/) Config
1682
+ */
1683
+ sass?: SASSConfig;
1684
+ /**
1685
+ * [SVGO](https://github.com/svg/svgo) Config
1686
+ */
1687
+ svgo?: Config$2;
1688
+ /**
1689
+ * [Markdown](https://github.com/markdown-it/markdown-it) Config
1690
+ */
1691
+ markdown?: Options;
1692
+ }
1693
+
1694
+ interface Publishing {
1695
+ /**
1696
+ * Git publish
1697
+ */
1698
+ git: Git;
1699
+ }
1700
+
1701
+ /**
1702
+ * JSON File Minification
1703
+ */
1704
+ type JSONTerse = {
1705
+ /**
1706
+ * Minify `.json` files writing to `theme/assets`
1707
+ *
1708
+ * @default true
1709
+ */
1710
+ assets?: boolean;
1711
+ /**
1712
+ * Minify `settings_schema.json` and `settings_data.json` config files.
1713
+ *
1714
+ * @default true
1715
+ */
1716
+ config?: boolean;
1717
+ /**
1718
+ * Minify `locale` and `.json` files.
1719
+ *
1720
+ * @default true
1721
+ */
1722
+ locales?: boolean;
1723
+ /**
1724
+ * Minify `metafield` and `.json` files.
1725
+ *
1726
+ * @default true
1727
+ */
1728
+ metafields?: boolean;
1729
+ /**
1730
+ * Minify `metaobject` and `.json` files.
1731
+ *
1732
+ * @default true
1733
+ */
1734
+ metaobject?: boolean;
1735
+ /**
1736
+ * Minify section group `.json` files
1737
+ *
1738
+ * @default true
1739
+ */
1740
+ groups?: boolean;
1741
+ /**
1742
+ * Minify `template` and `.json` files.
1743
+ *
1744
+ * @default true
1745
+ */
1746
+ templates?: boolean;
1747
+ /**
1748
+ * An optional list of paths/files to exclude from minification.
1749
+ *
1750
+ * @default []
1751
+ */
1752
+ exclude?: string[]
1753
+ }
1754
+
1755
+ type JSONTransform = {
1756
+ /**
1757
+ * If line termination should be Windows (CRLF) format.
1758
+ * Unix (LF) format is the default.
1759
+ *
1760
+ * @default false
1761
+ */
1762
+ crlf?: boolean;
1763
+ /**
1764
+ * The indentation level
1765
+ *
1766
+ * @default 2
1767
+ */
1768
+ indent?: number;
1769
+ /**
1770
+ * Whether to use tabbed `\t` identation characters. When `true`, tabs will apply
1771
+ * at the division of `2` relative to the `indent` option value.
1772
+ *
1773
+ * @default false
1774
+ */
1775
+ useTab?: boolean;
1776
+ /**
1777
+ * Whether or not comments should be stripped or preserved.
1778
+ * This effects how Syncify handles both local and remote sources.
1779
+ *
1780
+ * @default false
1781
+ */
1782
+ stripComments?: boolean;
1783
+ /**
1784
+ * Whether or not Syncify should apply alpha-numeric sorting to object properties
1785
+ * or not. This will apply deep sorting, so all objects within a structure will adhere.
1786
+ *
1787
+ * Apply object sorting on a specific list of entries in the JSON structure. Target deeply nested
1788
+ * property objects and their values using dot `.` separated expressions by passing sting list.
1789
+ *
1790
+ * ```js
1791
+ * { sortObjects: ['a.b'] } // sort only these objects
1792
+ *
1793
+ * // BEFORE
1794
+ * { a: { b: { z: '2', x: '1' } }, c: { b: '2', a: '1' } }
1795
+ *
1796
+ * // AFTER
1797
+ * { a: { b: { x: '1', z: '2', } }, c: { b: '2', a: '1' } }
1798
+ * ```
1799
+ *
1800
+ * @default false
1801
+ */
1802
+ sortObjects?: boolean | string[];
1803
+ /**
1804
+ * Whether or not Syncify should apply alpha-numeric sorting to arrays in JSON.
1805
+ * You should avoid setting this to `true` and use with caution.
1806
+ *
1807
+ * Apply array sorting on a specific list of entries in the JSON structure. Target deeply nested
1808
+ * properties and their values using dot `.` separated expressions by passing sting list.
1809
+ *
1810
+ * @default false
1811
+ */
1812
+ sortArrays?: boolean | string[];
1813
+ /**
1814
+ * Define a list of property names with object values that should be excluded and skipped
1815
+ * from sorting. This option only applies when `sortObjects` and/or `sortArrays` is set to
1816
+ * `true` and will have no effect if `sortObjects` and/or `sortArrays` is not enabled.
1817
+ *
1818
+ * @default []
1819
+ */
1820
+ noSortList?: string[];
1821
+ /**
1822
+ * An optional string list of paths/filenames to exclude
1823
+ * from processing, ie: pass through
1824
+ *
1825
+ * @default false
1826
+ */
1827
+ exclude?: string[];
1828
+ /**
1829
+ * JSON minification options. By default, this option is set to `false`
1830
+ * which disables minification being applied to `.json` file types. Setting
1831
+ * this to `true` will enabled JSON minification to apply.
1832
+ *
1833
+ * > **NOTE**
1834
+ * >
1835
+ * > Terse operations require the explicit `--prod` OR `--terse` flags be provided.
1836
+ * > Failure to pass such flags will result in minification being skipped.
1837
+ */
1838
+ terse?: boolean | JSONTerse;
1839
+ }
1840
+
1841
+ type LiquidTerse = {
1842
+ /**
1843
+ * Removes redundant whitespace Liquid dash trims from Liquid tags and objects.
1844
+ *
1845
+ * @default false
1846
+ */
1847
+ stripTrims?: boolean;
1848
+ /**
1849
+ * Minifies inner contents of `<script>` and `{% javascript %}` tags
1850
+ *
1851
+ * @default true
1852
+ */
1853
+ minifyJS?: boolean;
1854
+ /**
1855
+ * Minifies inner contents of `<style>`, `{% style %}` and `{% stylesheet %}` tags
1856
+ *
1857
+ * @default true
1858
+ */
1859
+ minifyCSS?: boolean;
1860
+ /**
1861
+ * Minifies inner contents of `{% schema %}` tags
1862
+ *
1863
+ * @default true
1864
+ */
1865
+ minifySchema?: boolean;
1866
+ /**
1867
+ * Remove all occurances of HTML and Liquid comments
1868
+ *
1869
+ * @default true
1870
+ */
1871
+ removeComments?: boolean;
1872
+ /**
1873
+ * Collapse all whitespace and newlines
1874
+ *
1875
+ * @default true
1876
+ */
1877
+ collapseWhitespace?: boolean;
1878
+ /**
1879
+ * Excluded files from minification
1880
+ *
1881
+ * @default []
1882
+ */
1883
+ exclude?: string[]
1884
+ }
1885
+
1886
+ /**
1887
+ * Liquid Minification
1888
+ */
1889
+ type LiquidTransform = {
1890
+ /**
1891
+ * Liquid and HTML minification options. By default, the option is set to `false`
1892
+ * which disables minification being applied to `.liquid` file types. Setting
1893
+ * this to `true` will enabled minification.
1894
+ *
1895
+ * > **NOTE**
1896
+ * >
1897
+ * > Terse operations require explicit `--prod` OR `--terse` flags be provided.
1898
+ * > Failure to pass such flags will result in minification being skipped.
1899
+ */
1900
+ terse?: boolean | LiquidTerse;
1901
+ }
1902
+
1903
+ /* -------------------------------------------- */
1904
+ /* TRANSFORMS */
1905
+ /* -------------------------------------------- */
1906
+
1907
+ type Transforms = {
1908
+ /**
1909
+ * ###### [DOCUMENTATION](https://syncify.sh/options/transform/style/)
1910
+ *
1911
+ * **Style File transforms**
1912
+ *
1913
+ * @example
1914
+ *
1915
+ * // OPTION 1 - Rename with single input
1916
+ * {
1917
+ * style: {
1918
+ * 'assets/stylesheet.css': 'path/to/file.scss', // write to assets dir and compile with sass
1919
+ * 'snippets/style.liquid': 'path/to/foo.css' // write as snippet
1920
+ * }
1921
+ * }
1922
+ *
1923
+ * // OPTION 2 - Rename with multiple inputs
1924
+ * {
1925
+ * style: {
1926
+ * 'assets/stylesheet.css': [
1927
+ * 'path/to/source/file-1.scss',
1928
+ * 'path/to/source/file-2.scss',
1929
+ * ]
1930
+ * }
1931
+ * }
1932
+ *
1933
+ * // OPTION 3 - Rename with overrides
1934
+ * {
1935
+ * style: {
1936
+ * 'assets/filename.min.css': {
1937
+ * input: 'path/to/source/file.scss',
1938
+ * includePaths: ['node_modules'],
1939
+ * watch: []
1940
+ * }
1941
+ * }
1942
+ * }
1943
+ *
1944
+ * // OPTION 4 - Single config
1945
+ * {
1946
+ * style: {
1947
+ * input: 'path/to/source/file.scss',
1948
+ * rename: 'filename.min.css',
1949
+ * postcss: [ plugin() ] // use some postcss plugin with this file
1950
+ * sass: {
1951
+ * includePaths: [
1952
+ * 'node_modules/bootstrap' // include this path
1953
+ * ]
1954
+ * }
1955
+ * }
1956
+ * }
1957
+ *
1958
+ * // OPTION 5 - Multiple configs
1959
+ * {
1960
+ * style: [
1961
+ * {
1962
+ * input: 'path/to/source/file-1.css',
1963
+ * snippet: true,
1964
+ * rename: 'some-name.liquid',
1965
+ * postcss: [ plugin() ], // use some plugin with this file
1966
+ * sass: false // do not process with sass
1967
+ * },
1968
+ * {
1969
+ * input: 'path/to/source/file-2.scss',
1970
+ * postcss: false, // do not process with postcss
1971
+ * sass: true, // use processor defined settings
1972
+ * watch: [
1973
+ * 'path/to/files/*.scss'
1974
+ * ]
1975
+ * }
1976
+ * ]
1977
+ * }
1978
+ */
1979
+ style?: StyleTransformer;
1980
+
1981
+ /**
1982
+ * ###### [DOCUMENTATION](https://syncify.sh/options/transform/script/)
1983
+ *
1984
+ * **JavaScript/TypeScript Transforms**
1985
+ *
1986
+ * Script inputs can be defined a few different ways depending on your preference.
1987
+ * You can also override ESBuild `processor` defined options on a per-file basis.
1988
+ * Options 1, 2 and 3 are typically the preferred structures.
1989
+ *
1990
+ *
1991
+ * @example
1992
+ *
1993
+ * // OPTION 1 - Rename with single input
1994
+ * {
1995
+ * script: {
1996
+ * 'assets/filename.min.js': 'path/to/source/file.ts', // write to assets dir
1997
+ * 'snippets/js-file.liquid': 'path/to/source/foo.ts' // write as snippet
1998
+ * }
1999
+ * }
2000
+ *
2001
+ * // OPTION 2 - Rename with multiple inputs
2002
+ * {
2003
+ * script: {
2004
+ * 'assets/[file].min.[ext]': [
2005
+ * 'path/to/source/file-1.ts', // outputs assets/file-1.min.js
2006
+ * 'path/to/source/file-2.ts', // outputs assets/file-2.min.js
2007
+ * ]
2008
+ * }
2009
+ * }
2010
+ *
2011
+ * // OPTION 3 - Rename with overrides
2012
+ * {
2013
+ * script: {
2014
+ * 'assets/filename.min.js': {
2015
+ * input: 'path/to/source/file.ts',
2016
+ * splitting: true,
2017
+ * treeShaking: false
2018
+ * }
2019
+ * }
2020
+ * }
2021
+ *
2022
+ * // OPTION 4 - Single config
2023
+ * {
2024
+ * script: {
2025
+ * input: 'path/to/source/file.ts',
2026
+ * rename: 'filename.min.js',
2027
+ * esbuild: {}
2028
+ * }
2029
+ * }
2030
+ *
2031
+ * // OPTION 5 - Multiple configs
2032
+ * {
2033
+ * script: [
2034
+ * {
2035
+ * input: 'path/to/source/file-1.ts',
2036
+ * rename: 'filename.min.js',
2037
+ * esbuild: {}
2038
+ * },
2039
+ * {
2040
+ * input: 'path/to/source/file-2.ts',
2041
+ * snippet: true
2042
+ * }
2043
+ * ]
2044
+ * }
2045
+ */
2046
+ script?: false | ScriptTransformer
2047
+ /**
2048
+ * ###### [DOCUMENTATION](https://syncify.sh/options/transform/svg/)
2049
+ *
2050
+ * **SVG File Transforms**
2051
+ *
2052
+ * Inline SVG files and Sprites generation. Uses SVGO under the hood
2053
+ * and can export as assets (or snippets).
2054
+ */
2055
+ svg?: SVGTransformer;
2056
+ /**
2057
+ * ###### [DOCUMENTATION](https://syncify.sh/options/transform/json/)
2058
+ *
2059
+ * **JSON File Transforms**
2060
+ *
2061
+ * Options defined here are used when writing to the file system and
2062
+ * uploading `.json` files to themes. When running sync operations that
2063
+ * import from remote sources will also use these options, they include:
2064
+ *
2065
+ * - `--merge`
2066
+ * - `--pull`
2067
+ * - `--download`
2068
+ */
2069
+ json?: JSONTransform;
2070
+ /**
2071
+ * ###### [DOCUMENTATION](https://syncify.sh/options/transform/liquid/)
2072
+ *
2073
+ * **Liquid File Transforms**
2074
+ *
2075
+ * Liquid transform options are terse-specific and related to minification operations.
2076
+ * Syncify uses HTML Minifier Terser under the hood, it has been configured to work with
2077
+ * Liquid files.
2078
+ *
2079
+ * > **NOTE**
2080
+ *
2081
+ * > Liquid transforms will only be carried out under the `--prod` or `--terse` flag.
2082
+ * > If this option is set to `false` then no minification will be applied to `.liquid` files.
2083
+ */
2084
+ liquid?: LiquidTransform;
2085
+ /**
2086
+ * ###### [DOCUMENTATION](https://syncify.sh/options/transform/svg/)
2087
+ *
2088
+ * **Markdown File Transforms**
2089
+ *
2090
+ * Supported markdown transforms accepted for resource specific operations.
2091
+ */
2092
+ markdown?: SVGTransformer;
2093
+
2094
+ }
2095
+
2096
+ /**
2097
+ * Version Control
2098
+ */
2099
+ type VC = {
2100
+ /**
2101
+ * Sets the maximum patch number before incrementing the minor version. Passing a value of `0` will
2102
+ * result in **minor** version increments only.
2103
+ *
2104
+ * @default 10
2105
+ */
2106
+ patchLimit?: number;
2107
+ /**
2108
+ * Sets the maximum minor version before incrementing the major version. Passing a value of 0 will
2109
+ * result in **major** version increments only.
2110
+ *
2111
+ * @default 10
2112
+ */
2113
+ minorLimit?: number;
2114
+ /**
2115
+ * Sets the version source references that will increment. By default, Syncify will ensure both
2116
+ * the `package.json` (if present) and `settings_schema.json` version numbers match, but you may
2117
+ * prefer to use a single source.
2118
+ *
2119
+ * @default
2120
+ * [
2121
+ * 'package.json'
2122
+ * 'settings_schema.json'
2123
+ * ]
2124
+ */
2125
+ references?: [
2126
+ 'package.json'?,
2127
+ 'settings_schema.json'?
2128
+ ]
2129
+ }
2130
+
2131
+ /* -------------------------------------------- */
2132
+ /* IMPORTS */
2133
+ /* -------------------------------------------- */
2134
+
2135
+
2136
+
2137
+ /* -------------------------------------------- */
2138
+ /* EXPORTS */
2139
+ /* -------------------------------------------- */
2140
+
2141
+ /**
2142
+ * **Syncify Configuration**
2143
+ *
2144
+ * The `defineConfig` named export used within `syncify.config.js` (or `.ts`) configuration files.
2145
+ */
2146
+ interface Config extends Directories {
2147
+ /**
2148
+ * Specify the text-editor you use for development. This is optional and when
2149
+ * left undefined, Syncify will attempt guess your preferred editor.
2150
+ */
2151
+ editor?: LiteralUnion<
2152
+ | 'vscode'
2153
+ | 'sublime'
2154
+ | 'cursor'
2155
+ | 'atom'
2156
+ | 'webstorm'
2157
+ | 'intellij'
2158
+ | 'textmate'
2159
+ | 'xcode'
2160
+ | 'nano'
2161
+ | 'notepad++'
2162
+ | 'gedit'
2163
+ | 'vim'
2164
+ , string>;
2165
+ /**
2166
+ * Define customize input structures. Paths will automatically resolve
2167
+ * the `input` directory you provide.
2168
+ */
2169
+ paths?: Paths;
2170
+ /**
2171
+ * **NOT YET AVAILABLE**
2172
+ *
2173
+ * > Syncify plugins are planned in future releases!
2174
+ */
2175
+ plugins?: never;
2176
+ /**
2177
+ * **Clean**
2178
+ *
2179
+ * Whether of not Syncify should clean output before building.
2180
+ */
2181
+ clean?: boolean;
2182
+ /**
2183
+ * **HOT**
2184
+ *
2185
+ * Hot reloading options. Pass the `--hot` flag to enable.
2186
+ *
2187
+ * > Passing `--hot` will enable **watch** mode. You do not need to pass `-w`
2188
+ * > or `--watch` when `--hot` is provided as it will be assumed.
2189
+ */
2190
+ hot?: HOT;
2191
+ /**
2192
+ * **Log**
2193
+ *
2194
+ * Console log options
2195
+ */
2196
+ log?: Logger;
2197
+ /**
2198
+ * **Publish**
2199
+ *
2200
+ * Provide publish configuration
2201
+ */
2202
+ publish?: Publishing;
2203
+ /**
2204
+ * **Git**
2205
+ *
2206
+ * Git automation and workflow configuration for controlling the integration pipline. Settings
2207
+ * defined here will be used to provide a streamlines tactic for theme publishing, version
2208
+ * control and source control.
2209
+ */
2210
+ git?: false | Git
2211
+ /**
2212
+ * **Version Control**
2213
+ *
2214
+ * Syncify introduces a strategic version control system based on the Modular Arithmetic Model (**MaM**),
2215
+ * a unique approach inspired by, but distinct from, [SemVer](https://semver.org/). The MaM tactic in
2216
+ * its appropriation by Syncify to Theme development is designed around the idea that progression should
2217
+ * be predictive and controlled. The [Version Control](https://syncify.sh/usage/version-control/) documentation
2218
+ * guide provides a strong overview for how Syncify applies versioning to themes.
2219
+ */
2220
+ vc?: false | VC
2221
+ /**
2222
+ * **Transform**
2223
+ *
2224
+ * The asset transform pipeline configurations
2225
+ */
2226
+ transform?: Transforms;
2227
+ /**
2228
+ * **Processor**
2229
+ *
2230
+ * Configurations for the `transform` processors. Define options for a transform to inherit.
2231
+ * You can override these on a per-transform basis. Optionally, you can use the default presets
2232
+ * which syncify has pre-configured for optimal output.
2233
+ */
2234
+ processor?: Processors;
2235
+ }
2236
+
2237
+ /**
2238
+ * ENV Utilities
2239
+ *
2240
+ * Helper utility for checking environment variables and returning some other data references
2241
+ */
2242
+ declare const env: {
2243
+ /**
2244
+ * Whether or not `--dev` mode is running
2245
+ */
2246
+ readonly dev: boolean;
2247
+ /**
2248
+ * Whether or not `--prod` mode is running
2249
+ */
2250
+ readonly prod: boolean;
2251
+ /**
2252
+ * Whether or not `--watch` mode is running
2253
+ */
2254
+ readonly watch: boolean;
2255
+ };
2256
+
2257
+ /**
2258
+ * Define Config (named export)
2259
+ *
2260
+ * Used in `syncify.config.js` or `syncify.config.ts` files and provides type completions to the export.
2261
+ */
2262
+ declare const defineConfig: (config: Config) => Config;
2263
+
2264
+ export { type Config, type Directories, type ESBuildConfig, type ESBuildTarget, type Git, type HOT, type JSONTerse, type JSONTransform, type LiquidTerse, type LiquidTransform, type Logger, type Paths, type Pattern, type PostCSSConfig, type Processors, type Publishing, type Rename, type SASSConfig, type SVGFile, type SVGSprite, type SVGTransform, type SVGTransformer, type ScriptTransform, type ScriptTransformer, type Stash, type StyleTerse, type StyleTransform, type StyleTransformer, type TailwindConfig, type Transforms, type VC, defineConfig, env };