@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.
- package/LICENSE +10 -6
- package/dist/api.js +32 -12
- package/dist/cli.js +610 -6
- package/dist/index.d.ts +2264 -0
- package/dist/index.js +10 -10
- package/dist/syncify.js +24248 -0
- package/hot.js.liquid +13 -2
- package/package.json +118 -115
- package/readme.md +110 -2176
- package/scripts/postinstall.js +116 -0
- package/scripts/postversion.js +60 -0
- package/dist/cjs.js +0 -236
- package/pnpm-lock.yaml +0 -5662
- package/schema/syncify.config.json +0 -676
- package/schema/syncify.env.json +0 -58
- package/schema/syncify.package.json +0 -11
- package/types/api.d.ts +0 -319
- package/types/bundle/cache.d.ts +0 -101
- package/types/bundle/commands.d.ts +0 -396
- package/types/bundle/errors.d.ts +0 -101
- package/types/bundle/file.d.ts +0 -285
- package/types/bundle/filters.d.ts +0 -81
- package/types/bundle/hot.d.ts +0 -185
- package/types/bundle/index.d.ts +0 -603
- package/types/bundle/plugin.d.ts +0 -127
- package/types/bundle/processors.d.ts +0 -54
- package/types/bundle/reports.d.ts +0 -123
- package/types/bundle/requests.d.ts +0 -374
- package/types/bundle/shared.d.ts +0 -124
- package/types/cli.d.ts +0 -547
- package/types/config/index.d.ts +0 -550
- package/types/config/terser.d.ts +0 -319
- package/types/config/views.d.ts +0 -191
- package/types/index.d.ts +0 -55
- package/types/modules/html-minifier-terser.d.ts +0 -218
- package/types/stores.d.ts +0 -11
- package/types/transforms/image.d.ts +0 -15
- package/types/transforms/json.d.ts +0 -51
- package/types/transforms/pages.d.ts +0 -254
- package/types/transforms/script.d.ts +0 -308
- package/types/transforms/style.d.ts +0 -219
- package/types/transforms/svg.d.ts +0 -189
@@ -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 '../bundle/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 $.
|
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 $, will be merged with processor defaults.
|
306
|
-
*/
|
307
|
-
esbuild: ESBuildOptions
|
308
|
-
}
|
@@ -1,219 +0,0 @@
|
|
1
|
-
/* eslint-disable no-unused-vars */
|
2
|
-
|
3
|
-
import type { LiteralUnion, Merge } from 'type-fest';
|
4
|
-
import type { Tester } from 'anymatch';
|
5
|
-
import type { Config as TailwindConfig } from 'tailwindcss';
|
6
|
-
import type { Plugin as PostCSSPlugin, Transformer, TransformCallback } from 'postcss';
|
7
|
-
import type { GetProcessorConfigs, RenamePaths } from '../bundle/shared';
|
8
|
-
|
9
|
-
/* -------------------------------------------- */
|
10
|
-
/* PROCESSOR CONFIGS */
|
11
|
-
/* -------------------------------------------- */
|
12
|
-
|
13
|
-
export type PostCSSConfig = (
|
14
|
-
| PostCSSPlugin
|
15
|
-
| Transformer
|
16
|
-
| TransformCallback
|
17
|
-
);
|
18
|
-
|
19
|
-
export interface TailwindCSSConfig {
|
20
|
-
important: TailwindConfig['important'];
|
21
|
-
prefix: TailwindConfig['PrefixConfig'];
|
22
|
-
separator: TailwindConfig['SeparatorConfig'];
|
23
|
-
safelist: TailwindConfig['SafelistConfig'];
|
24
|
-
blocklist: TailwindConfig['BlocklistConfig'];
|
25
|
-
presets: TailwindConfig['presets'];
|
26
|
-
future: TailwindConfig['future'];
|
27
|
-
experimental: TailwindConfig['experimental'];
|
28
|
-
darkMode: TailwindConfig['darkMode'];
|
29
|
-
theme: TailwindConfig['theme'];
|
30
|
-
corePlugins: TailwindConfig['corePlugins'];
|
31
|
-
plugins: TailwindConfig['plugins'];
|
32
|
-
}
|
33
|
-
|
34
|
-
export interface SASSConfig {
|
35
|
-
/**
|
36
|
-
* Whether or not to generate sourcemaps
|
37
|
-
*
|
38
|
-
* @default true
|
39
|
-
*/
|
40
|
-
sourcemap?: boolean;
|
41
|
-
/**
|
42
|
-
* The style compiled CSS should be output.
|
43
|
-
*
|
44
|
-
* @default 'compressed'
|
45
|
-
*/
|
46
|
-
style?: 'expanded' | 'compressed';
|
47
|
-
/**
|
48
|
-
* Whether or not to print warnings to CLI - Warnings will require
|
49
|
-
* an `stdin` invocation to view. Setting this to `false` will hide
|
50
|
-
* warnings all together.
|
51
|
-
*
|
52
|
-
* @default true
|
53
|
-
*/
|
54
|
-
warnings?: boolean;
|
55
|
-
/**
|
56
|
-
* A list of paths to include, ie: node_modules.
|
57
|
-
*
|
58
|
-
* @default ['node_modules']
|
59
|
-
*/
|
60
|
-
include?: string[];
|
61
|
-
}
|
62
|
-
|
63
|
-
/* -------------------------------------------- */
|
64
|
-
/* TRANSFORM */
|
65
|
-
/* -------------------------------------------- */
|
66
|
-
|
67
|
-
export interface StyleTransform {
|
68
|
-
/**
|
69
|
-
* SVG input source paths. Accepts `string` or `string[]` glob patterns.
|
70
|
-
* Resolution is relative to your defined `input` directory.
|
71
|
-
*
|
72
|
-
* @default undefined
|
73
|
-
*/
|
74
|
-
input: string | string[];
|
75
|
-
/**
|
76
|
-
* Glob stylesheet paths/files to watch. When changes
|
77
|
-
* are applied to matched files, then the defined `input`
|
78
|
-
* will be compiled.
|
79
|
-
*
|
80
|
-
* @default []
|
81
|
-
*/
|
82
|
-
watch?: string[];
|
83
|
-
/**
|
84
|
-
* Rename the stylesheet file/s. The same name as source file will be used
|
85
|
-
* when undefined. Accepts namespaces, `[file]`, `[dir]` and `[ext]`.
|
86
|
-
*
|
87
|
-
* ---
|
88
|
-
*
|
89
|
-
* @default undefined
|
90
|
-
*/
|
91
|
-
rename?: string;
|
92
|
-
/**
|
93
|
-
* Optionally output the CSS as a snippet. This will transform
|
94
|
-
* the stylesheet inline, wrap output within `<style></style>`
|
95
|
-
* tags and write it to `snippets`.
|
96
|
-
*
|
97
|
-
* @default false
|
98
|
-
*/
|
99
|
-
snippet?: boolean;
|
100
|
-
/**
|
101
|
-
* **NOT YET AVAILABLE**
|
102
|
-
*
|
103
|
-
* [TailwindCSS](https://tailwindcss.com/) Override
|
104
|
-
*
|
105
|
-
* Tailwind transforms will use the `tailwind.config.js` configuration
|
106
|
-
* file in your projects root (or defined `config` path). If you have not
|
107
|
-
* provided a tailwind config file, then syncify will use options defined
|
108
|
-
* via `processor.tailwind`. You can optionally override configuration
|
109
|
-
* on a per-transform basis and any options defined here will be merged with
|
110
|
-
* those defined in your `tailwind.config.js` or `processor.tailwind`.
|
111
|
-
*
|
112
|
-
* @default true // if tailwind is not installed this is false
|
113
|
-
*/
|
114
|
-
tailwind?: boolean | TailwindCSSConfig;
|
115
|
-
/**
|
116
|
-
* [PostCSS](https://postcss.org/) Override
|
117
|
-
*
|
118
|
-
* CSS File transforms will use the options provided to `processor.postcss`
|
119
|
-
* but you can optionally override those defaults on a per-transform
|
120
|
-
* basis. Any configuration options defined here will be merged with
|
121
|
-
* the options defined in `processor.postcss`.
|
122
|
-
*
|
123
|
-
* You can also skip pre-processing with postcss by passing a _boolean_
|
124
|
-
* `false` which will inform Syncify to not pass output to PostCSS. By
|
125
|
-
* default, Syncify will pass all compiled SASS and files with `.css`
|
126
|
-
* extensions to PostCSS.
|
127
|
-
*
|
128
|
-
* @default true // if postcss is not installed this is false
|
129
|
-
*/
|
130
|
-
postcss?: boolean | PostCSSConfig[];
|
131
|
-
/**
|
132
|
-
* [SASS Dart](https://sass-lang.com/documentation/js-api/) Override
|
133
|
-
*
|
134
|
-
* SASS File transforms will use the options provided to `processor.sass`
|
135
|
-
* but you can optionally override those defaults on a per-transform
|
136
|
-
* basis. Any configuration options defined here will be merged with
|
137
|
-
* the options defined in `processor.sass`.
|
138
|
-
*
|
139
|
-
* You can also skip SASS transfroms by passing a _boolean_ `false` which will
|
140
|
-
* inform Syncify to not pass output to SASS, which is the default if SASS is not
|
141
|
-
* installed.
|
142
|
-
*
|
143
|
-
* By default, Syncify will forward all input files using `.scss` or `.sass`
|
144
|
-
* or extension to SASS Dart. If you have PostCSS installed then Syncify will
|
145
|
-
* automatically pass SASS files to PostCSS in the post-process.
|
146
|
-
*
|
147
|
-
* @default true // if sass is not installed this is false
|
148
|
-
*/
|
149
|
-
sass?: boolean | SASSConfig;
|
150
|
-
}
|
151
|
-
|
152
|
-
/* -------------------------------------------- */
|
153
|
-
/* TRANSFORMER */
|
154
|
-
/* -------------------------------------------- */
|
155
|
-
|
156
|
-
export type StyleTransformer = (
|
157
|
-
| string
|
158
|
-
| string[]
|
159
|
-
| StyleTransform
|
160
|
-
| StyleTransform[]
|
161
|
-
| {
|
162
|
-
[K in RenamePaths]: (
|
163
|
-
| string
|
164
|
-
| string[]
|
165
|
-
| Pick<StyleTransform,
|
166
|
-
| 'postcss'
|
167
|
-
| 'sass'
|
168
|
-
| 'snippet'
|
169
|
-
| 'watch'
|
170
|
-
| 'input'
|
171
|
-
>
|
172
|
-
)
|
173
|
-
}
|
174
|
-
)
|
175
|
-
|
176
|
-
/* -------------------------------------------- */
|
177
|
-
/* INTERNAL USE */
|
178
|
-
/* -------------------------------------------- */
|
179
|
-
|
180
|
-
/**
|
181
|
-
* **INTERNAL USE**
|
182
|
-
*
|
183
|
-
* PostCSS Processor Configuration
|
184
|
-
*/
|
185
|
-
export type PostCSSProcesser = GetProcessorConfigs<PostCSSConfig[]>;
|
186
|
-
|
187
|
-
/**
|
188
|
-
* **INTERNAL USE**
|
189
|
-
*
|
190
|
-
* Tailwind Processor Configuration
|
191
|
-
*/
|
192
|
-
export type TailwindCSSProcesser = GetProcessorConfigs<TailwindCSSConfig>
|
193
|
-
|
194
|
-
/**
|
195
|
-
* **INTERNAL USE**
|
196
|
-
*
|
197
|
-
* SASS Processor Configuration
|
198
|
-
*/
|
199
|
-
export type SASSProcesser = GetProcessorConfigs<SASSConfig>
|
200
|
-
|
201
|
-
/**
|
202
|
-
* **INTERNAL USE**
|
203
|
-
*
|
204
|
-
* Bundling Configuration
|
205
|
-
*/
|
206
|
-
export type StyleBundle = Merge<StyleTransform, {
|
207
|
-
/**
|
208
|
-
* A UUID reference for this $.
|
209
|
-
*/
|
210
|
-
uuid: string;
|
211
|
-
/**
|
212
|
-
* Resolved input path
|
213
|
-
*/
|
214
|
-
input: string;
|
215
|
-
/**
|
216
|
-
* Anymatch function
|
217
|
-
*/
|
218
|
-
watch: Tester;
|
219
|
-
}>;
|
@@ -1,189 +0,0 @@
|
|
1
|
-
/* eslint-disable no-unused-vars */
|
2
|
-
|
3
|
-
import type { LiteralUnion, Merge } from 'type-fest';
|
4
|
-
import type { Tester } from 'anymatch';
|
5
|
-
import type { Config as SVGOConfig } from 'svgo';
|
6
|
-
import type { Config as SVGSpriteConfig } from 'svg-sprite';
|
7
|
-
import type { GetProcessorConfigs, RenamePaths } from '../bundle/shared';
|
8
|
-
|
9
|
-
/* -------------------------------------------- */
|
10
|
-
/* PROCESSOR CONFIGS */
|
11
|
-
/* -------------------------------------------- */
|
12
|
-
|
13
|
-
export { SVGOConfig, SVGSpriteConfig };
|
14
|
-
|
15
|
-
/* -------------------------------------------- */
|
16
|
-
/* SHARED */
|
17
|
-
/* -------------------------------------------- */
|
18
|
-
|
19
|
-
interface SVGShared<T extends 'file' | 'sprite'> {
|
20
|
-
/**
|
21
|
-
* SVG input source paths. Accepts `string` or `string[]` glob patterns.
|
22
|
-
* Resolution is relative to your defined `input` directory.
|
23
|
-
*
|
24
|
-
* @default ''
|
25
|
-
*/
|
26
|
-
input: string | string[];
|
27
|
-
/**
|
28
|
-
* Rename the svg file/s. The same name as source file will be used
|
29
|
-
* when undefined. Accepts namespaces, `[file]`, `[dir]` and `[ext]`.
|
30
|
-
* ---
|
31
|
-
*
|
32
|
-
* @default undefined
|
33
|
-
*
|
34
|
-
* @example
|
35
|
-
* 'source/svgs/arrow.svg' > 'arrow.svg' // if snippet is false
|
36
|
-
* 'source/svgs/checkmark.svg' > 'checkmark.liquid' // if snippet is true
|
37
|
-
*/
|
38
|
-
rename?: string;
|
39
|
-
/**
|
40
|
-
* Whether to generate svg as snippet or asset. When `true` the
|
41
|
-
* svg source will be written as a snippet
|
42
|
-
*
|
43
|
-
* @default false
|
44
|
-
*/
|
45
|
-
snippet?: boolean;
|
46
|
-
/**
|
47
|
-
* The SVG export format. Syncify can produce 2 different SVG formats:
|
48
|
-
*
|
49
|
-
* You can omit this option when you have only 1 pre-processor installed or
|
50
|
-
* if you are applying a per-transfrom configuration override as it will default
|
51
|
-
* to the format which the inferred pre-processor produces. If you are using
|
52
|
-
* both the supported processors ([SVGO](https://github.com/svg/svgo) &
|
53
|
-
* [SVG Sprite](https://github.com/svg-sprite)) then you will need
|
54
|
-
* to inform Syncify on which format it should produce.
|
55
|
-
*
|
56
|
-
* ---
|
57
|
-
*
|
58
|
-
* **File Format**
|
59
|
-
*
|
60
|
-
* _SVG transforms using a `file` format require SVGO to be installed. File
|
61
|
-
* formats will produce individual `.svg` files from that can be output as
|
62
|
-
* an`asset` or inlined into a `snippet`_
|
63
|
-
*
|
64
|
-
* ---
|
65
|
-
*
|
66
|
-
* **Sprite Format**
|
67
|
-
*
|
68
|
-
* _SVG transforms using a `sprite` format require SVG Sprite to be installed.
|
69
|
-
* Sprite formats will produce an SVG Sprite that can be output as an `asset`
|
70
|
-
* or inlined into a `snippet`_
|
71
|
-
*
|
72
|
-
* ---
|
73
|
-
*
|
74
|
-
* @default
|
75
|
-
* undefined // When no SVG pre-processor is installed
|
76
|
-
* null // When both SVGO and SVG Sprite are installed (required)
|
77
|
-
* 'file' // When SVGO is the only processor installed
|
78
|
-
* 'sprite' // When SVG Sprite is the only processor installed
|
79
|
-
*/
|
80
|
-
format?: LiteralUnion<T, string>;
|
81
|
-
}
|
82
|
-
|
83
|
-
export interface SVGFile extends SVGShared<'file'> {
|
84
|
-
/**
|
85
|
-
* [SVGO](https://github.com/svg/svgo) Override
|
86
|
-
*
|
87
|
-
* SVG File transforms will use the options provided to `processor.svgo`
|
88
|
-
* but you can optionally override those defaults on a per-transform
|
89
|
-
* basis. Any configuration options defined here will be merged with
|
90
|
-
* the options defined in `processor.svgo`.
|
91
|
-
*
|
92
|
-
* @default
|
93
|
-
* processor.svgo // When processor configuration is defined
|
94
|
-
*/
|
95
|
-
svgo?: SVGOConfig
|
96
|
-
}
|
97
|
-
|
98
|
-
export interface SVGSprite extends SVGShared<'sprite'> {
|
99
|
-
/**
|
100
|
-
* [SVG Sprite](https://github.com/svg-sprite) Override
|
101
|
-
*
|
102
|
-
* SVG Sprite transforms will use the options provided to `processor.sprite`
|
103
|
-
* but you can optionally override those defaults on a per-transform
|
104
|
-
* basis. Any configuration options defined here will be merged with
|
105
|
-
* the options defined in `processor.sprite`.
|
106
|
-
*
|
107
|
-
* @default
|
108
|
-
* processor.sprite // When processor configuration is defined
|
109
|
-
*/
|
110
|
-
sprite?: SVGSpriteConfig
|
111
|
-
}
|
112
|
-
|
113
|
-
/* -------------------------------------------- */
|
114
|
-
/* TRANSFORM */
|
115
|
-
/* -------------------------------------------- */
|
116
|
-
|
117
|
-
/**
|
118
|
-
* SVG processing transforms
|
119
|
-
*/
|
120
|
-
export type SVGTransform = (
|
121
|
-
| SVGFile
|
122
|
-
| SVGSprite
|
123
|
-
)
|
124
|
-
|
125
|
-
/* -------------------------------------------- */
|
126
|
-
/* TRANSFORMER */
|
127
|
-
/* -------------------------------------------- */
|
128
|
-
|
129
|
-
export type SVGTransformer = (
|
130
|
-
| string
|
131
|
-
| string[]
|
132
|
-
| SVGTransform
|
133
|
-
| SVGTransform[]
|
134
|
-
| {
|
135
|
-
[K in RenamePaths]: (
|
136
|
-
| string
|
137
|
-
| string[]
|
138
|
-
| Pick<SVGFile, 'format' | 'input' | 'snippet' | 'svgo'>
|
139
|
-
| Pick<SVGSprite, 'format'| 'input'| 'snippet' | 'sprite'>
|
140
|
-
)
|
141
|
-
}
|
142
|
-
)
|
143
|
-
|
144
|
-
/* -------------------------------------------- */
|
145
|
-
/* INTERAL USE */
|
146
|
-
/* -------------------------------------------- */
|
147
|
-
|
148
|
-
/**
|
149
|
-
* **INTERNAL USE**
|
150
|
-
*
|
151
|
-
* Processor Configuration
|
152
|
-
*/
|
153
|
-
export type SVGOProcesser = GetProcessorConfigs<SVGOConfig>
|
154
|
-
|
155
|
-
/**
|
156
|
-
* **INTERNAL USE**
|
157
|
-
*
|
158
|
-
* Processor Configuration
|
159
|
-
*/
|
160
|
-
export type SVGSpriteProcesser = GetProcessorConfigs<SVGSpriteConfig>
|
161
|
-
|
162
|
-
/**
|
163
|
-
* **INTERNAL USE**
|
164
|
-
*
|
165
|
-
* Bundling Configuration
|
166
|
-
*/
|
167
|
-
export type SVGBundle = Merge<SVGTransform, {
|
168
|
-
/**
|
169
|
-
* A UUID reference for this $.
|
170
|
-
*/
|
171
|
-
uuid: string;
|
172
|
-
/**
|
173
|
-
* Resolved input paths (paths are expanded)
|
174
|
-
*/
|
175
|
-
input: Set<string>;
|
176
|
-
/**
|
177
|
-
* File matching, used to determine when new files are
|
178
|
-
* added to an `input` defined path/directory.
|
179
|
-
*/
|
180
|
-
match: Tester;
|
181
|
-
/**
|
182
|
-
* SVGO Override
|
183
|
-
*/
|
184
|
-
svgo?: true | SVGOConfig;
|
185
|
-
/**
|
186
|
-
* SVG Sprite Override
|
187
|
-
*/
|
188
|
-
sprite?: true | SVGSpriteConfig;
|
189
|
-
}>;
|