@syncify/cli 0.1.3-beta → 0.2.1-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs.js +178 -147
- package/dist/cli.js +7 -2
- package/package.json +60 -35
- package/pnpm-lock.yaml +1493 -1461
- package/readme.md +464 -182
- package/types/api.d.ts +2 -2
- package/types/cli.d.ts +46 -42
- package/types/config/index.d.ts +18 -12
- package/types/config/terser.d.ts +267 -0
- package/types/config/views.d.ts +13 -5
- package/types/index.d.ts +13 -9
- package/types/{misc → internal}/commands.d.ts +16 -28
- package/types/{bundle → internal}/file.d.ts +87 -30
- package/types/internal/filters.d.ts +81 -0
- package/types/{bundle → internal}/hot.d.ts +21 -4
- package/types/internal/index.d.ts +509 -0
- package/types/{bundle → internal}/plugin.d.ts +7 -5
- package/types/internal/processors.d.ts +54 -0
- package/types/{misc/modes.d.ts → internal/reports.d.ts} +57 -6
- package/types/{misc → internal}/requests.d.ts +5 -4
- package/types/{misc → internal}/shared.d.ts +6 -10
- package/types/modules/html-minifier-terser.d.ts +211 -0
- package/types/transforms/image.d.ts +1 -1
- package/types/transforms/script.d.ts +191 -57
- package/types/transforms/style.d.ts +51 -10
- package/types/transforms/svg.d.ts +1 -1
- package/types/bundle/index.d.ts +0 -479
- package/types/config/minify.d.ts +0 -115
- /package/types/{bundle → internal}/cache.d.ts +0 -0
- /package/types/{misc → internal}/errors.d.ts +0 -0
- /package/types/{misc → internal}/markdown.d.ts +0 -0
@@ -9,7 +9,7 @@ export type Namespacing = (
|
|
9
9
|
/**
|
10
10
|
* Namespaced Paths
|
11
11
|
*/
|
12
|
-
export type NamespacePaths = `${'assets' | 'snippets'}/${
|
12
|
+
export type NamespacePaths = `${'assets' | 'snippets'}/${string}`
|
13
13
|
|
14
14
|
/**
|
15
15
|
* Directory Paths
|
@@ -19,7 +19,7 @@ export type DirPaths = `${'assets' | 'snippets'}/${string}`
|
|
19
19
|
/**
|
20
20
|
* Rename Paths
|
21
21
|
*/
|
22
|
-
export type RenamePaths = NamespacePaths
|
22
|
+
export type RenamePaths = NamespacePaths;
|
23
23
|
|
24
24
|
/**
|
25
25
|
* Rename input type
|
@@ -31,16 +31,12 @@ export type RenameInput = {
|
|
31
31
|
/**
|
32
32
|
* Rename input paths type
|
33
33
|
*/
|
34
|
-
export type RenameInputPaths = {
|
35
|
-
[filename: RenamePaths]: string | string[]
|
36
|
-
}
|
34
|
+
export type RenameInputPaths = { [filename: RenamePaths]: string | string[] }
|
37
35
|
|
38
36
|
/**
|
39
37
|
* Rename config type
|
40
38
|
*/
|
41
|
-
export type RenameConfig<T> = {
|
42
|
-
[filename: RenamePaths]: string | string[] | T
|
43
|
-
}
|
39
|
+
export type RenameConfig<T> = { [filename: RenamePaths]: string | string[] | T}
|
44
40
|
|
45
41
|
/**
|
46
42
|
* Processor Configuration
|
@@ -58,9 +54,9 @@ export type GetProcessorConfigs<T> = {
|
|
58
54
|
/**
|
59
55
|
* Whether or not a config file exists for the processor,
|
60
56
|
* When one exists the URI path location to the file will
|
61
|
-
* applied as the value.
|
57
|
+
* be applied as the value.
|
62
58
|
*/
|
63
|
-
file:
|
59
|
+
file: boolean | string;
|
64
60
|
/**
|
65
61
|
* Configuration of the processor, Initialized with defaults
|
66
62
|
*/
|
@@ -0,0 +1,211 @@
|
|
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>;
|
@@ -3,34 +3,94 @@ import type { Merge } from 'type-fest';
|
|
3
3
|
import type { Tester } from 'anymatch';
|
4
4
|
import type { Tsconfig } from 'tsconfig-type';
|
5
5
|
import type { BuildOptions as ESBuildOptions } from 'esbuild';
|
6
|
-
import type { GetProcessorConfigs, RenamePaths } from '../
|
6
|
+
import type { GetProcessorConfigs, RenamePaths } from '../internal/shared';
|
7
7
|
|
8
|
-
|
9
|
-
| '
|
10
|
-
| '
|
11
|
-
| '
|
12
|
-
| '
|
13
|
-
| '
|
14
|
-
| '
|
15
|
-
| '
|
16
|
-
| '
|
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'
|
17
46
|
| 'banner'
|
18
|
-
| '
|
47
|
+
| 'bundle'
|
19
48
|
| 'charset'
|
20
49
|
| 'chunkNames'
|
21
|
-
| '
|
22
|
-
| '
|
50
|
+
| 'entryNames'
|
51
|
+
| 'conditions'
|
52
|
+
| 'define'
|
53
|
+
| 'external'
|
54
|
+
| 'footer'
|
55
|
+
| 'format'
|
56
|
+
| 'globalName'
|
57
|
+
| 'tsconfigRaw'
|
58
|
+
| 'tsconfig'
|
59
|
+
| 'treeShaking'
|
60
|
+
| 'target'
|
23
61
|
| 'jsx'
|
24
62
|
| 'jsxDev'
|
25
63
|
| 'jsxFactory'
|
26
64
|
| 'jsxFragment'
|
27
65
|
| 'jsxImportSource'
|
28
|
-
| '
|
29
|
-
| '
|
30
|
-
| '
|
66
|
+
| 'jsxSideEffects'
|
67
|
+
| 'inject'
|
68
|
+
| 'ignoreAnnotations'
|
69
|
+
| 'drop'
|
70
|
+
| 'splitting'
|
31
71
|
| 'supported'
|
72
|
+
| 'sourcesContent'
|
73
|
+
| 'sourceRoot'
|
74
|
+
| 'sourcemap'
|
75
|
+
| 'pure'
|
32
76
|
| 'plugins'
|
33
|
-
|
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, {
|
34
94
|
/**
|
35
95
|
* The format to be generated. Because we are targeting
|
36
96
|
* browser environments, Syncify does not allow for CJS (commonjs)
|
@@ -54,24 +114,42 @@ export type ESBuildConfig = Merge<Pick<ESBuildOptions,
|
|
54
114
|
/* TRANSFORM */
|
55
115
|
/* -------------------------------------------- */
|
56
116
|
|
57
|
-
|
117
|
+
interface ScriptSharedConfig {
|
58
118
|
/**
|
59
119
|
* JS/TS input source paths. Accepts `string` or `string[]` glob patterns.
|
60
120
|
* Resolution is relative to your defined `input` directory.
|
61
121
|
*
|
122
|
+
* ---
|
123
|
+
*
|
62
124
|
* @default undefined
|
63
125
|
*/
|
64
126
|
input: string | string[];
|
65
|
-
/**
|
66
|
-
* The format to be generated. Because we are targeting
|
67
|
-
* browser environments, Syncify does not allow for CJS (commonjs)
|
68
|
-
* bundles to be produced.
|
69
|
-
*
|
70
|
-
* @default 'esm'
|
71
|
-
*/
|
72
|
-
format?: 'esm' | 'iife';
|
73
127
|
/**
|
74
|
-
*
|
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
|
75
153
|
* when undefined. Accepts namespaces, `[file]`, `[dir]` and `[ext]`.
|
76
154
|
*
|
77
155
|
* ---
|
@@ -81,7 +159,7 @@ export interface ScriptTransform {
|
|
81
159
|
rename?: string;
|
82
160
|
/**
|
83
161
|
* Optionally write the javascript file inline as a snippet. This will transform
|
84
|
-
* the JS and contained code will be output within `<script></script>` tags
|
162
|
+
* the JS and contained code will be output within `<script></script>` tags as a
|
85
163
|
* `snippet.liquid` file.
|
86
164
|
*
|
87
165
|
* @default false
|
@@ -89,12 +167,12 @@ export interface ScriptTransform {
|
|
89
167
|
snippet?: boolean;
|
90
168
|
/**
|
91
169
|
* Entry points (paths/files) to watch that will trigger a rebuilds of
|
92
|
-
* the
|
170
|
+
* the defined _input_ file. By default, Syncify will watch all import entries
|
93
171
|
* imported by the _input_.
|
94
172
|
*
|
95
173
|
* @default []
|
96
174
|
*/
|
97
|
-
watch?: string[]
|
175
|
+
watch?: string[]
|
98
176
|
/**
|
99
177
|
* [ESBuild](https://esbuild.github.io/) Override
|
100
178
|
*
|
@@ -111,6 +189,40 @@ export interface ScriptTransform {
|
|
111
189
|
esbuild?: boolean | ESBuildConfig;
|
112
190
|
}
|
113
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
|
+
|
114
226
|
/* -------------------------------------------- */
|
115
227
|
/* TRANSFORMER */
|
116
228
|
/* -------------------------------------------- */
|
@@ -120,19 +232,7 @@ export type ScriptTransformer = (
|
|
120
232
|
| string[]
|
121
233
|
| ScriptTransform
|
122
234
|
| ScriptTransform[]
|
123
|
-
| {
|
124
|
-
[K in RenamePaths]: (
|
125
|
-
| string
|
126
|
-
| string[]
|
127
|
-
| Pick<ScriptTransform,
|
128
|
-
| 'input'
|
129
|
-
| 'format'
|
130
|
-
| 'snippet'
|
131
|
-
| 'watch'
|
132
|
-
| 'esbuild'
|
133
|
-
>
|
134
|
-
)
|
135
|
-
}
|
235
|
+
| { [rename: RenamePaths]: string | string[] | Omit<ScriptTransform, 'rename'> }
|
136
236
|
)
|
137
237
|
|
138
238
|
/* -------------------------------------------- */
|
@@ -144,31 +244,65 @@ export type ScriptTransformer = (
|
|
144
244
|
*
|
145
245
|
* Processor Configuration
|
146
246
|
*/
|
147
|
-
export type ESBuildProcesser = Merge<
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
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
|
+
}>
|
153
254
|
|
154
255
|
/**
|
155
256
|
* **INTERNAL USE**
|
156
257
|
*
|
157
|
-
* Bundling Configuration
|
258
|
+
* Bundling Configuration for scripts
|
158
259
|
*/
|
159
|
-
export
|
260
|
+
export interface ScriptBundle {
|
160
261
|
/**
|
161
262
|
* A UUID reference for this bundle.
|
162
263
|
*/
|
163
264
|
uuid: string;
|
164
265
|
/**
|
165
|
-
* Resolved input path
|
266
|
+
* Resolved input path. Passed to the ESBuild `entryPoint` option.
|
166
267
|
*/
|
167
268
|
input: string;
|
168
269
|
/**
|
169
|
-
*
|
170
|
-
* Matches applied to the anymatch pattern and applied
|
171
|
-
* at runtime.
|
270
|
+
* The namespace value, used in CLI logs
|
172
271
|
*/
|
173
|
-
|
174
|
-
|
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
|
+
}
|
@@ -1,9 +1,10 @@
|
|
1
1
|
/* eslint-disable no-unused-vars */
|
2
2
|
|
3
|
-
import type { Merge } from 'type-fest';
|
3
|
+
import type { LiteralUnion, Merge } from 'type-fest';
|
4
4
|
import type { Tester } from 'anymatch';
|
5
|
+
import type { Config as TailwindConfig } from 'tailwindcss';
|
5
6
|
import type { Plugin as PostCSSPlugin, Transformer, TransformCallback } from 'postcss';
|
6
|
-
import type { GetProcessorConfigs, RenamePaths } from '../
|
7
|
+
import type { GetProcessorConfigs, RenamePaths } from '../internal/shared';
|
7
8
|
|
8
9
|
/* -------------------------------------------- */
|
9
10
|
/* PROCESSOR CONFIGS */
|
@@ -15,6 +16,21 @@ export type PostCSSConfig = (
|
|
15
16
|
| TransformCallback
|
16
17
|
);
|
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
|
+
|
18
34
|
export interface SASSConfig {
|
19
35
|
/**
|
20
36
|
* Whether or not to generate sourcemaps
|
@@ -81,6 +97,21 @@ export interface StyleTransform {
|
|
81
97
|
* @default false
|
82
98
|
*/
|
83
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;
|
84
115
|
/**
|
85
116
|
* [PostCSS](https://postcss.org/) Override
|
86
117
|
*
|
@@ -96,7 +127,7 @@ export interface StyleTransform {
|
|
96
127
|
*
|
97
128
|
* @default true // if postcss is not installed this is false
|
98
129
|
*/
|
99
|
-
postcss?: boolean | PostCSSConfig[]
|
130
|
+
postcss?: boolean | PostCSSConfig[];
|
100
131
|
/**
|
101
132
|
* [SASS Dart](https://sass-lang.com/documentation/js-api/) Override
|
102
133
|
*
|
@@ -105,10 +136,13 @@ export interface StyleTransform {
|
|
105
136
|
* basis. Any configuration options defined here will be merged with
|
106
137
|
* the options defined in `processor.sass`.
|
107
138
|
*
|
108
|
-
* You can also skip
|
109
|
-
*
|
110
|
-
*
|
111
|
-
*
|
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.
|
112
146
|
*
|
113
147
|
* @default true // if sass is not installed this is false
|
114
148
|
*/
|
@@ -146,14 +180,21 @@ export type StyleTransformer = (
|
|
146
180
|
/**
|
147
181
|
* **INTERNAL USE**
|
148
182
|
*
|
149
|
-
* Processor Configuration
|
183
|
+
* PostCSS Processor Configuration
|
184
|
+
*/
|
185
|
+
export type PostCSSProcesser = GetProcessorConfigs<PostCSSConfig[]>;
|
186
|
+
|
187
|
+
/**
|
188
|
+
* **INTERNAL USE**
|
189
|
+
*
|
190
|
+
* Tailwind Processor Configuration
|
150
191
|
*/
|
151
|
-
export type
|
192
|
+
export type TailwindCSSProcesser = GetProcessorConfigs<TailwindCSSConfig>
|
152
193
|
|
153
194
|
/**
|
154
195
|
* **INTERNAL USE**
|
155
196
|
*
|
156
|
-
* Processor Configuration
|
197
|
+
* SASS Processor Configuration
|
157
198
|
*/
|
158
199
|
export type SASSProcesser = GetProcessorConfigs<SASSConfig>
|
159
200
|
|