@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,211 +0,0 @@
1
- // Type definitions for html-minifier-terser 7.0
2
- // Project: https://github.com/terser/html-minifier-terser#readme
3
- // Definitions by: Piotr Błażejewicz <https://github.com/peterblazejewicz>
4
- // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
5
-
6
- /**
7
- * Most of the options are disabled by default
8
- */
9
- export interface HTMLMinifierTerserOptions {
10
- /**
11
- * Treat attributes in case sensitive manner (useful for custom HTML tags)
12
- * @default false
13
- */
14
- caseSensitive?: boolean | undefined;
15
- /**
16
- * Omit attribute values from boolean attributes
17
- * @default false
18
- */
19
- collapseBooleanAttributes?: boolean | undefined;
20
- /**
21
- * Don't leave any spaces between display:inline;
22
- * elements when collapsing. Must be used in conjunction with collapseWhitespace=true
23
- * @default false
24
- */
25
- collapseInlineTagWhitespace?: boolean | undefined;
26
- /**
27
- * Collapse white space that contributes to text nodes in a document tree
28
- * @default false
29
- */
30
- collapseWhitespace?: boolean | undefined;
31
- /**
32
- * Always collapse to 1 space (never remove it entirely). Must be used in conjunction with `collapseWhitespace=true`
33
- * @default false
34
- */
35
- conservativeCollapse?: boolean | undefined;
36
- /**
37
- * Handle parse errors
38
- * @default false
39
- */
40
- continueOnParseError?: boolean | undefined;
41
- /**
42
- * Arrays of regex'es that allow to support custom attribute assign expressions (e.g. `'<div flex?="{{mode != cover}}"></div>'`)
43
- * @default []
44
- */
45
- customAttrAssign?: RegExp[] | undefined;
46
- /**
47
- * Regex that specifies custom attribute to strip newlines from (e.g. `/ng-class/`
48
- */
49
- customAttrCollapse?: RegExp | undefined;
50
- /**
51
- * Arrays of regex'es that allow to support custom attribute surround expressions (e.g. `<input {{#if value}}checked="checked"{{/if}}>`)
52
- * @default []
53
- */
54
- customAttrSurround?: RegExp[] | undefined;
55
- /**
56
- * Arrays of regex'es that allow to support custom event attributes for `minifyJS` (e.g. `ng-click`)
57
- * @default [/^on[a-z]{3,}$/]
58
- */
59
- customEventAttributes?: RegExp[] | undefined;
60
- /**
61
- * Use direct Unicode characters whenever possible
62
- * @default false
63
- */
64
- decodeEntities?: boolean | undefined;
65
- /**
66
- * Parse input according to HTML5 specifications
67
- * @default true
68
- */
69
- html5?: boolean | undefined;
70
- /**
71
- * Array of regex'es that allow to ignore certain comments, when matched
72
- * @default [ /^!/, /^\s*#/ ]
73
- */
74
- ignoreCustomComments?: RegExp[] | undefined;
75
- /**
76
- * Array of regex'es that allow to ignore certain fragments, when matched (e.g. `<?php ... ?>`, `{{ ... }}`, etc.)
77
- * @default [/<%[\s\S]*?%>/, /<\?[\s\S]\*?\?>/]
78
- */
79
- ignoreCustomFragments?: RegExp[] | undefined;
80
- /**
81
- * Insert tags generated by HTML parser
82
- * @default true
83
- */
84
- includeAutoGeneratedTags?: boolean | undefined;
85
- /**
86
- * Keep the trailing slash on singleton elements
87
- * @default false
88
- */
89
- keepClosingSlash?: boolean | undefined;
90
- /**
91
- * Specify a maximum line length. Compressed output will be split by newlines at valid HTML split-points
92
- */
93
- maxLineLength?: number | undefined;
94
- /**
95
- * Minify CSS in style elements and style attributes
96
- * @default false
97
- */
98
- minifyCSS?: boolean | object | ((text: string, type?: string) => string) | undefined;
99
- /**
100
- * Minify JavaScript in script elements and event attributes
101
- * @default false
102
- */
103
- minifyJS?: boolean | object | ((text: string, inline?: boolean) => string) | undefined;
104
- /**
105
- * Minify URLs in various attributes
106
- * @default false
107
- */
108
- minifyURLs?: boolean | string | object | ((text: string) => string) | undefined;
109
- /**
110
- * Never add a newline before a tag that closes an element
111
- * @default false
112
- */
113
- noNewlinesBeforeTagClose?: boolean | undefined;
114
- /**
115
- * Always collapse to 1 line break (never remove it entirely) when whitespace between tags include a line break.
116
- * Must be used in conjunction with `collapseWhitespace=true`
117
- * @default false
118
- */
119
- preserveLineBreaks?: boolean | undefined;
120
- /**
121
- * Prevents the escaping of the values of attributes
122
- * @default false
123
- */
124
- preventAttributesEscaping?: boolean | undefined;
125
- /**
126
- * Process contents of conditional comments through minifier
127
- * @default false
128
- */
129
- processConditionalComments?: boolean | undefined;
130
- /**
131
- * Array of strings corresponding to types of script elements to process through minifier
132
- * (e.g. `text/ng-template`, `text/x-handlebars-template`, etc.)
133
- * @default []
134
- */
135
- processScripts?: string[] | undefined;
136
- /**
137
- * Type of quote to use for attribute values (' or ")
138
- */
139
- quoteCharacter?: string | undefined;
140
- /**
141
- * Remove quotes around attributes when possible
142
- * @default false
143
- */
144
- removeAttributeQuotes?: boolean | undefined;
145
- /**
146
- * Strip HTML comments
147
- * @default false
148
- */
149
- removeComments?: boolean | undefined;
150
- /**
151
- * Remove all attributes with whitespace-only values
152
- * @default false
153
- */
154
- removeEmptyAttributes?: boolean | ((attrName: string, tag: string) => boolean) | undefined;
155
- /**
156
- * Remove all elements with empty contents
157
- * @default false
158
- */
159
- removeEmptyElements?: boolean | undefined;
160
- /**
161
- * Remove optional tags
162
- * @default false
163
- */
164
- removeOptionalTags?: boolean | undefined;
165
- /**
166
- * Remove attributes when value matches default
167
- * @default false
168
- */
169
- removeRedundantAttributes?: boolean | undefined;
170
- /**
171
- * Remove `type="text/javascript"` from `script` tags. Other `type` attribute values are left intact
172
- * @default false
173
- */
174
- removeScriptTypeAttributes?: boolean | undefined;
175
- /**
176
- * Remove `type="text/css"` from `style` and `link` tags. Other `type` attribute values are left intact
177
- * @default false
178
- */
179
- removeStyleLinkTypeAttributes?: boolean | undefined;
180
- /**
181
- * Remove space between attributes whenever possible. **Note that this will result in invalid HTML!**
182
- * @default false
183
- */
184
- removeTagWhitespace?: boolean | undefined;
185
- /**
186
- * Sort attributes by frequency
187
- * @default false
188
- */
189
- sortAttributes?: boolean | undefined;
190
- /**
191
- * Sort style classes by frequency
192
- * @default false
193
- */
194
- sortClassName?: boolean | undefined;
195
- /**
196
- * Trim white space around `ignoreCustomFragments`
197
- * @default false
198
- */
199
- trimCustomFragments?: boolean | undefined;
200
- /**
201
- * Replaces the `doctype` with the short (HTML5) doctype
202
- * @default false
203
- */
204
- useShortDoctype?: boolean | undefined;
205
- }
206
-
207
- /**
208
- * HTMLMinifier is a highly configurable, well-tested, JavaScript-based HTML minifier.
209
- * @async
210
- */
211
- export function minify(value: string, options?: HTMLMinifierTerserOptions): Promise<string>;
@@ -1,15 +0,0 @@
1
- import type { SharpOptions as SharpConfig } from 'sharp';
2
- import type { GetProcessorConfigs } from '../internal/shared';
3
-
4
- export type { SharpConfig };
5
-
6
- /* -------------------------------------------- */
7
- /* INTERNAL USE */
8
- /* -------------------------------------------- */
9
-
10
- /**
11
- * **INTERNAL USE**
12
- *
13
- * Processor Configuration
14
- */
15
- export type SharpProcesser = GetProcessorConfigs<SharpConfig>
@@ -1,42 +0,0 @@
1
- import type { Tester } from 'anymatch';
2
- import type { Merge } from 'type-fest';
3
-
4
- export interface JSONConfig {
5
- /**
6
- * The indentation level
7
- *
8
- * @default 2
9
- */
10
- indent?: number;
11
- /**
12
- * Whether to use `\t` identation characters.
13
- *
14
- * @default false
15
- */
16
- useTab?: boolean;
17
- /**
18
- * If line termination should be Windows (CRLF) format.
19
- * Unix (LF) format is the default.
20
- *
21
- * @default false
22
- */
23
- crlf?: boolean;
24
- /**
25
- * An optional string list of paths/filenames to exclude
26
- * from processing, ie: pass through
27
- *
28
- * @default false
29
- */
30
- exclude?: string[]
31
- }
32
-
33
- /* -------------------------------------------- */
34
- /* INTERAL USE */
35
- /* -------------------------------------------- */
36
-
37
- /**
38
- * **INTERNAL USE**
39
- *
40
- * Bundling Configuration
41
- */
42
- export type JSONBundle = Merge<JSONConfig, { exclude: Tester }>;
@@ -1,308 +0,0 @@
1
- /* eslint-disable no-unused-vars */
2
- import type { Merge } from 'type-fest';
3
- import type { Tester } from 'anymatch';
4
- import type { Tsconfig } from 'tsconfig-type';
5
- import type { BuildOptions as ESBuildOptions } from 'esbuild';
6
- import type { GetProcessorConfigs, RenamePaths } from '../internal/shared';
7
-
8
- type TargetBrowser = (
9
- | 'chrome'
10
- | 'deno'
11
- | 'edge'
12
- | 'firefox'
13
- | 'hermes'
14
- | 'ie'
15
- | 'ios'
16
- | 'node'
17
- | 'opera'
18
- | 'rhino'
19
- | 'safari'
20
- );
21
-
22
- type TargetBrowserVersion = (
23
- | `${TargetBrowser}${number}`
24
- | `${TargetBrowser}${number}.${number}`
25
- | `${TargetBrowser}${number}.${number}.${number}`
26
- );
27
-
28
- type TargetESVersion = (
29
- | 'es3'
30
- | 'es5'
31
- | 'es6'
32
- | 'es2015'
33
- | 'es2016'
34
- | 'es2017'
35
- | 'es2018'
36
- | 'es2019'
37
- | 'es2020'
38
- | 'es2021'
39
- | 'es2022'
40
- | 'esnext'
41
- );
42
-
43
- type ESBuildAllowedOptions = Pick<ESBuildOptions, (
44
- | 'alias'
45
- | 'assetNames'
46
- | 'banner'
47
- | 'bundle'
48
- | 'charset'
49
- | 'chunkNames'
50
- | 'entryNames'
51
- | 'conditions'
52
- | 'define'
53
- | 'external'
54
- | 'footer'
55
- | 'format'
56
- | 'globalName'
57
- | 'tsconfigRaw'
58
- | 'tsconfig'
59
- | 'treeShaking'
60
- | 'target'
61
- | 'jsx'
62
- | 'jsxDev'
63
- | 'jsxFactory'
64
- | 'jsxFragment'
65
- | 'jsxImportSource'
66
- | 'jsxSideEffects'
67
- | 'inject'
68
- | 'ignoreAnnotations'
69
- | 'drop'
70
- | 'splitting'
71
- | 'supported'
72
- | 'sourcesContent'
73
- | 'sourceRoot'
74
- | 'sourcemap'
75
- | 'pure'
76
- | 'plugins'
77
- | 'metafile'
78
- | 'loader'
79
- | 'publicPath'
80
- )>
81
-
82
- export { ESBuildOptions };
83
-
84
- export type Target = (
85
- | TargetBrowser
86
- | TargetBrowserVersion
87
- | TargetESVersion
88
- );
89
-
90
- /**
91
- * Public exposed configurations
92
- */
93
- export type ESBuildConfig = Merge<ESBuildAllowedOptions, {
94
- /**
95
- * The format to be generated. Because we are targeting
96
- * browser environments, Syncify does not allow for CJS (commonjs)
97
- * bundles to be produced.
98
- *
99
- * @default 'esm'
100
- */
101
- format?: 'esm' | 'iife';
102
- /**
103
- * Whether or not sourcemaps should be generated.
104
- * Syncify will process sourcemap generation internally,
105
- * so this option only accepts a boolean value.
106
- *
107
- * @default true
108
- */
109
- sourcemap?: boolean;
110
- }
111
- >;
112
-
113
- /* -------------------------------------------- */
114
- /* TRANSFORM */
115
- /* -------------------------------------------- */
116
-
117
- interface ScriptSharedConfig {
118
- /**
119
- * JS/TS input source paths. Accepts `string` or `string[]` glob patterns.
120
- * Resolution is relative to your defined `input` directory.
121
- *
122
- * ---
123
- *
124
- * @default undefined
125
- */
126
- input: string | string[];
127
- /**
128
- * This sets the target environment for the generated JavaScript. It
129
- * tells esbuild to transform JavaScript syntax which is too new for
130
- * these environments into older JavaScript syntax that works in this
131
- * environment\s.
132
- *
133
- * ---
134
- *
135
- * @default 'es2016'
136
- */
137
- target?: Target | Target[];
138
- /**
139
- * Instructs ESBuild to treat these modules as external. The import/s
140
- * will be preserved and evaluated at run time instead.
141
- *
142
- * ---
143
- *
144
- * @see
145
- * https://esbuild.github.io/api/#external
146
- *
147
- * @default
148
- * []
149
- */
150
- external?: string[];
151
- /**
152
- * Rename the JavaScript file/s. The same name as source file will be used
153
- * when undefined. Accepts namespaces, `[file]`, `[dir]` and `[ext]`.
154
- *
155
- * ---
156
- *
157
- * @default undefined
158
- */
159
- rename?: string;
160
- /**
161
- * Optionally write the javascript file inline as a snippet. This will transform
162
- * the JS and contained code will be output within `<script></script>` tags as a
163
- * `snippet.liquid` file.
164
- *
165
- * @default false
166
- */
167
- snippet?: boolean;
168
- /**
169
- * Entry points (paths/files) to watch that will trigger a rebuilds of
170
- * the defined _input_ file. By default, Syncify will watch all import entries
171
- * imported by the _input_.
172
- *
173
- * @default []
174
- */
175
- watch?: string[]
176
- /**
177
- * [ESBuild](https://esbuild.github.io/) Override
178
- *
179
- * ESBuild file transforms will use the options provided to `processor.esbuild`
180
- * but you can optionally override those defaults on a per-transform
181
- * basis. Any configuration options defined here will be merged with
182
- * the options defined in `processor.esbuild`.
183
- *
184
- * You can also skip pre-processing with esbuild by passing a _boolean_
185
- * `false` which will inform Syncify to process scripts with ESBuild.
186
- *
187
- * @default true // if esbuild is not installed this is false
188
- */
189
- esbuild?: boolean | ESBuildConfig;
190
- }
191
-
192
- interface ScriptFormatESM extends ScriptSharedConfig {
193
-
194
- /**
195
- * The format to be generated. Because we are targeting
196
- * browser environments, Syncify does not allow for CJS (commonjs)
197
- * bundles to be produced.
198
- *
199
- * @default 'esm'
200
- */
201
- format?: 'esm';
202
- }
203
-
204
- interface ScriptFormatIIFE extends ScriptSharedConfig {
205
- /**
206
- * The format to be generated. Because we are targeting
207
- * browser environments, Syncify does not allow for CJS (commonjs)
208
- * bundles to be produced.
209
- *
210
- * @see https://esbuild.github.io/api/#format
211
- * @default 'esm'
212
- */
213
- format?: 'iife';
214
- /**
215
- * Sets the name of the global variable which is used to store the
216
- * exports from the entry point.
217
- *
218
- * @see https://esbuild.github.io/api/#global-name
219
- * @default undefined
220
- */
221
- globalName?: string;
222
- }
223
-
224
- export type ScriptTransform = ScriptFormatESM | ScriptFormatIIFE;
225
-
226
- /* -------------------------------------------- */
227
- /* TRANSFORMER */
228
- /* -------------------------------------------- */
229
-
230
- export type ScriptTransformer = (
231
- | string
232
- | string[]
233
- | ScriptTransform
234
- | ScriptTransform[]
235
- | { [rename: RenamePaths]: string | string[] | Omit<ScriptTransform, 'rename'> }
236
- )
237
-
238
- /* -------------------------------------------- */
239
- /* INTERAL USE */
240
- /* -------------------------------------------- */
241
-
242
- /**
243
- * **INTERNAL USE**
244
- *
245
- * Processor Configuration
246
- */
247
- export type ESBuildProcesser = Merge<GetProcessorConfigs<ESBuildOptions>, {
248
- /**
249
- * Despite the name, this getter represents both
250
- * `tsconfig.json` or `jsconfig.json` files.
251
- */
252
- get tsconfig(): Tsconfig,
253
- }>
254
-
255
- /**
256
- * **INTERNAL USE**
257
- *
258
- * Bundling Configuration for scripts
259
- */
260
- export interface ScriptBundle {
261
- /**
262
- * A UUID reference for this bundle.
263
- */
264
- uuid: string;
265
- /**
266
- * Resolved input path. Passed to the ESBuild `entryPoint` option.
267
- */
268
- input: string;
269
- /**
270
- * The namespace value, used in CLI logs
271
- */
272
- namespace: string;
273
- /**
274
- * Whether or not to export as a snippet
275
- */
276
- snippet: boolean;
277
- /**
278
- * Resolved key reference, used in the Shopify sync requests
279
- */
280
- key: string;
281
- /**
282
- * Resolved output path where the transformed file should be written.
283
- * This value will have a rename applied in the uri.
284
- */
285
- output: string;
286
- /**
287
- * Imports contained in the input. This is used to trigger a build.
288
- * Matches applied to the anymatch pattern at runtime.
289
- */
290
- watch: Set<string>;
291
- /**
292
- * The size in bytes of the generated file. This metric is obtained
293
- * on the pre-complile at runtime when importer paths are collected.
294
- * The value will be `NaN` unless executing in `--terse` (or `--prod`).
295
- */
296
- size: number;
297
- /**
298
- * Watch extendables - This `Set` accounts for watch paths defined
299
- * by the user. We keep them isolated to ensure they are not removed
300
- * when importers are adjusted during re-builds.
301
- */
302
- watchCustom: Tester;
303
- /**
304
- * ESBuild options which will either use the processor defaults or
305
- * if defined on script bundle, will be merged with processor defaults.
306
- */
307
- esbuild: ESBuildOptions
308
- }