@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,267 +0,0 @@
1
- import type { BuildOptions } from 'esbuild';
2
- import type { LiteralUnion, Merge } from 'type-fest';
3
- import type { OptionsOutput as CleanCSSOptions } from 'clean-css';
4
- import type { HTMLMinifierTerserOptions } from '../modules/html-minifier-terser';
5
-
6
- /**
7
- * ESBuild minification options
8
- */
9
- export type ScriptTerse = Merge<Pick<BuildOptions,
10
- | 'keepNames'
11
- | 'mangleProps'
12
- | 'minifyIdentifiers'
13
- | 'minifySyntax'
14
- | 'minifyWhitespace'
15
- | 'mangleQuoted'
16
- >,
17
- {
18
- /**
19
- * List of input file names to exclude from minification
20
- *
21
- * @default 'none'
22
- */
23
- legalComments?: LiteralUnion<BuildOptions['legalComments'], string>
24
- /**
25
- * List of input file names to exclude from minification
26
- *
27
- * @default []
28
- */
29
- exclude?: string[];
30
- }
31
- >
32
-
33
- /**
34
- * JSON File Minification
35
- */
36
- export interface JSONTerse {
37
- /**
38
- * Minify `.json` files writing to `theme/assets`
39
- *
40
- * @default true
41
- */
42
- assets: boolean;
43
- /**
44
- * Minify `settings_schema.json` and `settings_data.json` config files.
45
- *
46
- * @default true
47
- */
48
- config: boolean;
49
- /**
50
- * Minify `locale` and `.json` files.
51
- *
52
- * @default true
53
- */
54
- locales: boolean;
55
- /**
56
- * Minify `metafield` and `.json` files.
57
- *
58
- * @default true
59
- */
60
- metafields: boolean;
61
- /**
62
- * Minify section group `.json` files
63
- *
64
- * @default true
65
- */
66
- sectionGroups: boolean;
67
- /**
68
- * Minify `template` and `.json` files.
69
- *
70
- * @default true
71
- */
72
- templates: boolean;
73
- /**
74
- * An optional list of paths/files to exclude from minification.
75
- *
76
- * @default []
77
- */
78
- exclude?: string[]
79
- }
80
-
81
- /**
82
- * Liquid Minification
83
- */
84
- export interface ViewTerse {
85
- /**
86
- * Minifies inner contents of `<script>` tags
87
- *
88
- * @default true
89
- */
90
- minifyScript?: boolean;
91
- /**
92
- * Minifies inner contents of `<style>` tags
93
- *
94
- * @default true
95
- */
96
- minifyStyle?: boolean;
97
- /**
98
- * Minifies JSON contained within Liquid `{% schema %}` tags.
99
- *
100
- * > **NOTE**
101
- * >
102
- * > Minifying schema tag contents has no effect on store performance.
103
- *
104
- * @default true
105
- */
106
- minifySchema?: boolean;
107
- /**
108
- * Remove all occurances of Liquid/HTML comments
109
- *
110
- * @default true
111
- */
112
- removeComments?: boolean;
113
- /**
114
- * Collapse all whitespace and newlines
115
- *
116
- * @default true
117
- */
118
- collapseWhitespace?: boolean;
119
- /**
120
- * Removes redundant whitespace Liquid dash trims from Liquid tags and objects.
121
- *
122
- * @default true
123
- */
124
- stripDashes?: boolean;
125
- /**
126
- * **NOT YET AVAILABLE**
127
- *
128
- * Removes all whitespace and newline occurances within Liquid syntax.
129
- *
130
- * > **NOTE**
131
- * >
132
- * > Liquid token minification has no effect on store performance.
133
- *
134
- * @default
135
- * true
136
- *
137
- * @example
138
- *
139
- * // Assuming that collapseWhitespace is set to true.
140
- * // Using this option would result in the following
141
- *
142
- * // BEFORE
143
- *
144
- * {% unless foo == bar %}
145
- * {{ some.object | filter: 'foo' }}
146
- * {% endunless %}
147
- *
148
- * // AFTER
149
- *
150
- * {%unless foo==bar%}{{some.object|filter:'foo'}}{%endunless%}
151
- */
152
- collapseInner?: boolean;
153
- /**
154
- * Excluded files from minification
155
- *
156
- * @default []
157
- */
158
- exclude?: string[]
159
- }
160
-
161
- /**
162
- * Style Minification
163
- */
164
- export interface StyleTerse extends CleanCSSOptions {
165
- /**
166
- * Whether or not to purge unused CSS class names
167
- *
168
- * @default false
169
- */
170
- purgeUnusedCSS?: boolean;
171
- /**
172
- * Whether or not to obfuscate CSS class names
173
- *
174
- * @default false
175
- */
176
- ofuscateClassNames?: boolean;
177
- /**
178
- * List of class names that should be excluded from
179
- * obfuscation and shortnaming.
180
- */
181
- ofuscateWhitelist?: string[];
182
- /**
183
- * The alphabet used to generate the new class names.
184
- *
185
- * > **NOTE**
186
- * >
187
- * > There is no `d` in the default alphabet to avoid adblock issues.
188
- *
189
- * @default 'abcefghijklmnopqrstuvwxyz0123456789'
190
- */
191
- ofuscateAlphabet?: string;
192
- /**
193
- * Excluded files from terser minification
194
- *
195
- * @default []
196
- */
197
- exclude?: string[]
198
- }
199
-
200
- /* -------------------------------------------- */
201
- /* INTERNAL USE */
202
- /* -------------------------------------------- */
203
-
204
- /**
205
- * **INTERNAL USE**
206
- *
207
- * Terser minification configuration
208
- */
209
- export interface TerserConfig {
210
- /**
211
- * Terse JSON Minification
212
- */
213
- json?: JSONTerse;
214
- /**
215
- * Terse View (Liquid) Minification
216
- */
217
- liquid?: Omit<ViewTerse, 'collapseWhitespace'>;
218
- /**
219
- * Terse View (HTML) Minification
220
- *
221
- * > Uses [html-minifier-terser](https://github.com/terser/html-minifier-terser)
222
- */
223
- html?: HTMLMinifierTerserOptions;
224
- /**
225
- * **NOTE YET AVAILABLE**
226
- *
227
- * Terse Style (CSS) Minification
228
- *
229
- * > Uses [clean-css](https://github.com/clean-css/clean-css) minification
230
- * > Uses [purge-css](https://github.com/FullHuman/purgecss)
231
- */
232
- style?: StyleTerse;
233
- /**
234
- * Terse Script (JS/TS) Minification
235
- *
236
- * > Uses [esbuild](https://esbuild.github.io/api/#minify) minificiation
237
- */
238
- script?: ScriptTerse;
239
- }
240
-
241
- /**
242
- * **INTERNAL USE**
243
- *
244
- * Terser minification configuration
245
- */
246
- export interface TerserBundle {
247
- /**
248
- * Terse JSON Minification
249
- *
250
- * @default false
251
- */
252
- json: boolean;
253
- /**
254
- * View minification
255
- */
256
- views: boolean;
257
- /**
258
- * **NOTE YET AVAILABLE**
259
- *
260
- * Terse Style (CSS) Minification
261
- */
262
- style: boolean;
263
- /**
264
- * Terse Script (JS/TS) Minification
265
- */
266
- script: boolean;
267
- }
@@ -1,234 +0,0 @@
1
- import { LiteralUnion } from 'type-fest';
2
-
3
- export interface Icons {
4
- /**
5
- * Whether or not to support icon custom tags. When `true` you can
6
- * reference SVG icons using a HTML tag with a `name=""` property and
7
- * Syncify will replace all occurances with the embedded SVG.
8
- *
9
- * For example:
10
- *
11
- * ```html
12
- * <!-- In your HTML you can reference the SVG -->
13
- * <i name="name-of-icon" from="sprite-id"></i>
14
- *
15
- * <!-- Syncify will replace this with the raw data -->
16
- * <svg id="name-of-icon"><path>...</path></svg>
17
- * ```
18
- *
19
- * This approach will likely improve render times of your webshop.
20
- * Using Snippets to render inline SVGs is costly and a performance
21
- * bottleneck. Just because Shopify does this in Dawn, does not mean
22
- * it is a good idea.
23
- *
24
- * @default false
25
- */
26
- useCustomTag: boolean;
27
- /**
28
- * Replacer HTML tag to look for occurances within
29
- *
30
- * @default 'i' // eg: <i name="svg"></i>
31
- */
32
- tagName?: string;
33
- /**
34
- * Whether or not to treat the custom tag as a void (self-closing)
35
- *
36
- * @default false
37
- */
38
- tagVoid?: boolean
39
- /**
40
- * A vscode user specific option which will auto-generate
41
- * icon name completions for you and link them to your workspace settings.
42
- *
43
- * > Option is only available to vscode users.
44
- *
45
- * @default false
46
- */
47
- vscodeCustomData?: boolean;
48
- }
49
-
50
- /**
51
- * Snippet sub-directory grouping options
52
- */
53
- export interface Snippets {
54
- /**
55
- * Whether snippets allow sub-directory name prefixing
56
- *
57
- * @default false
58
- *
59
- * @example
60
- *
61
- * // Assuming the separator is '_'
62
- * // Take the following structure:
63
- *
64
- * snippets
65
- * │
66
- * ├─ head
67
- * │ └─ foo.liquid
68
- * └─ body
69
- * ├─ bar.liquid
70
- * └─ baz.liquid
71
- *
72
- * // The output result will be:
73
- *
74
- * theme
75
- * └─ snippets
76
- * ├─ head_foo.liquid
77
- * ├─ body_bar.liquid
78
- * └─ body_baz.liquid
79
- */
80
- prefixDir?: boolean;
81
- /**
82
- * Prefix separator character
83
- *
84
- * @default '-'
85
- *
86
- * @example
87
- *
88
- * // Filename will be prefix
89
- * 'dir/file.liquid' => 'dir-file.liquid'
90
- */
91
- separator?: LiteralUnion<
92
- | '-'
93
- | '_'
94
- | '.'
95
- | '@'
96
- | ':'
97
- ,
98
- string
99
- >;
100
- /**
101
- * A list snippet sub-directories or relative files that should
102
- * pass through or snip prefixing
103
- *
104
- * _cannot contain glob (`*`) stars_
105
- *
106
- * @default []
107
- *
108
- * @example
109
- *
110
- * // ✓ This is correct
111
- * { global: ['some-dir/filename.liquid' ] }
112
- *
113
- * // ✗ This is incorrect
114
- * { global: ['some-dir/*.liquid' ] }
115
- */
116
- global?: string[];
117
- }
118
-
119
- /**
120
- * Sections sub-directory grouping options
121
- */
122
- export interface Sections {
123
- /**
124
- * Whether sections allow directory name prefixing
125
- *
126
- * @default false
127
- *
128
- * @example
129
- *
130
- * // Assuming the separator is '_'
131
- * // Take the following structure:
132
- *
133
- * sections
134
- * │
135
- * ├─ index
136
- * │ ├─ slideshow.liquid
137
- * │ └─ banner.liquid
138
- * └─ layouts
139
- * ├─ header.liquid
140
- * └─ footer.liquid
141
- *
142
- * // The output result will be:
143
- *
144
- * theme
145
- * └─ sections
146
- * ├─ index_slideshow.liquid
147
- * ├─ index_banner.liquid
148
- * ├─ layout_header.liquid
149
- * └─ layout_footer.liquid
150
- *
151
- */
152
- prefixDir?: boolean;
153
- /**
154
- * Prefix separator character
155
- *
156
- * @default '-'
157
- *
158
- * @example
159
- *
160
- * // Filename will be prefix
161
- * 'dir/file.liquid' => 'dir-file.liquid'
162
- */
163
- separator?: LiteralUnion<
164
- | '-'
165
- | '_'
166
- | '.'
167
- | '@'
168
- | ':'
169
- ,
170
- string
171
- >;
172
- /**
173
- * A list section sub-directories or relative files that should
174
- * pass through or snip prefixing
175
- *
176
- * **NOTE:**
177
- *
178
- * **Cannot contain glob (`*`) stars**
179
- *
180
- * @default []
181
- *
182
- * @example
183
- *
184
- * // ✓ This is correct
185
- * { global: ['some-dir/filename.liquid' ] }
186
- *
187
- * // ✗ This is incorrect
188
- * { global: ['some-dir/*.liquid' ] }
189
- */
190
- global?: string[];
191
- }
192
-
193
- /**
194
- * Static Page publishing
195
- */
196
- export interface Pages {
197
- /**
198
- * Whether the pulled page content should be written
199
- * as HTML or have the HTML converted to Markdown.
200
- *
201
- * @default 'html'
202
- */
203
- language?: 'markdown' | 'html',
204
- /**
205
- * Fallback author name
206
- *
207
- * @default null
208
- */
209
- author?: string;
210
- /**
211
- * Whether pages contained in sub-directories should
212
- * use the directory name as the `template_suffix`
213
- *
214
- * @default false
215
- */
216
- suffixDir?: boolean;
217
- /**
218
- * A list of page sub-directories or relative files that should
219
- * pass through and not apply the directory name as a `template_suffix`
220
- *
221
- * _cannot contain glob (`*`) stars_
222
- *
223
- * @default []
224
- *
225
- * @example
226
- *
227
- * // ✓ This is correct
228
- * { global: ['some-dir/filename.liquid' ] }
229
- *
230
- * // ✗ This is incorrect
231
- * { global: ['some-dir/*.liquid' ] }
232
- */
233
- global?: string[];
234
- }
package/types/index.d.ts DELETED
@@ -1,55 +0,0 @@
1
- import { Config } from './config';
2
- import { Syncify as syncify } from './api';
3
-
4
- export type { Tsconfig } from 'tsconfig-type';
5
- export type { FileKeys } from './internal/file';
6
-
7
- export * from './api';
8
- export * from './cli';
9
- export * from './config';
10
- export * from './config/views';
11
- export * from './config/terser';
12
- export * from './internal/cache';
13
- export * from './internal/filters';
14
- export * from './internal/markdown';
15
- export * from './internal/requests';
16
- export * from './internal/shared';
17
- export * from './internal/errors';
18
- export * from './internal/reports';
19
- export * from './internal/file';
20
- export * from './internal';
21
- export * from './internal/plugin';
22
- export * from './internal/hot';
23
- export * from './transforms/image';
24
- export * from './transforms/json';
25
- export * from './transforms/script';
26
- export * from './transforms/style';
27
- export * from './transforms/svg';
28
-
29
- /**
30
- * ***Define Config:***
31
- *
32
- * Provide to the default export in your `syncify.config.js` file.
33
- *
34
- * ---
35
- *
36
- * ***Supported Files:***
37
- *
38
- * - syncify.config.ts
39
- * - syncify.config.js
40
- * - syncify.config.mjs
41
- * - syncify.config.cjs
42
- *
43
- * ---
44
- *
45
- * @example
46
- *
47
- * import { defineConfig } from '@syncify/cli';
48
- *
49
- * export default defineConfig({
50
- * //...
51
- * });
52
- *
53
- */
54
- export declare function defineConfig(config: Config): void
55
- export default syncify;
@@ -1,97 +0,0 @@
1
- export interface Cache {
2
- /**
3
- * The last time cache was updated at (timestamp)
4
- */
5
- updated: number;
6
- /**
7
- * When the cache was created (timestamp)
8
- */
9
- created: number;
10
- /**
11
- * Page related cache records, this reference typically
12
- * holds `path > id` object references. Page ids are
13
- * cached for lookup when changes occur. The `map` object
14
- * holds the references and applied to model on initialization.
15
- */
16
- pages: {
17
- /**
18
- * The URI cache map location
19
- *
20
- * @default 'node_modules/.syncify/pages'
21
- */
22
- uri: string;
23
- /**
24
- * Page output name and Buffer
25
- */
26
- data: { [outputName: string]: Buffer }
27
- },
28
- /**
29
- * Section related cache records, this reference typically
30
- * holds output filename reference and used to prevent
31
- * duplicated sections from being written.
32
- */
33
- sections: string[];
34
- /**
35
- * JavaScript related cache records, typically source maps
36
- */
37
- script: {
38
- /**
39
- * The URI cache map location
40
- *
41
- * @default 'node_modules/.syncify/script'
42
- */
43
- uri: string;
44
- /**
45
- * Metafield pathname > id cache references.
46
- */
47
- data: { [outputName: string]: Buffer }
48
- },
49
- /**
50
- * Stylesheet related cache records, typically source maps
51
- */
52
- style: {
53
- /**
54
- * The URI cache map location
55
- *
56
- * @default 'node_modules/.syncify/styles'
57
- */
58
- uri: string;
59
- /**
60
- * Stylesheet output name and Buffer
61
- */
62
- data: { [outputName: string]: Buffer }
63
- },
64
- /**
65
- * Metafields related cache records. Metafield source maps
66
- * are `path > id` object references. Metafield ids are
67
- * cached for lookup when changes occur. The `map` object
68
- * holds the references and applied to model on initialization.
69
- */
70
- metafields: {
71
- /**
72
- * The URI cache reference location
73
- *
74
- * @default 'node_modules/.syncify/metafields'
75
- */
76
- uri: string,
77
- /**
78
- * Metafield pathname > id cache references.
79
- */
80
- data: { [path: string]: number }
81
- },
82
- /**
83
- * Specification JSON for vscode
84
- */
85
- vscode: {
86
- /**
87
- * The URI vscode reference location
88
- *
89
- * @default 'node_modules/.syncify/vscode'
90
- */
91
- uri: string;
92
- /**
93
- * vscode file maps
94
- */
95
- data: { icons?: string; }
96
- }
97
- }