solid-optimizer 1.0.0-next.0 → 1.0.0-next.10
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/README.md +27 -13
- package/dist/{compile-Cz6hbiQv.mjs → compile-Cvjy2e11.mjs} +1925 -385
- package/dist/compile-Cvjy2e11.mjs.map +1 -0
- package/dist/{compile-BRCj4UN7.d.mts → compile-ioIkBKzR.d.mts} +15 -2
- package/dist/compile-ioIkBKzR.d.mts.map +1 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/vite.d.mts +12 -2
- package/dist/vite.d.mts.map +1 -1
- package/dist/vite.mjs +401 -116
- package/dist/vite.mjs.map +1 -1
- package/package.json +8 -5
- package/src/ast.ts +4 -3
- package/src/compile.ts +96 -16
- package/src/conditional.ts +547 -0
- package/src/constants.ts +58 -13
- package/src/context.ts +5 -3
- package/src/copy-size.ts +68 -27
- package/src/fold.ts +334 -107
- package/src/inline.ts +832 -177
- package/src/jsx.ts +55 -34
- package/src/memo.ts +309 -38
- package/src/nesting.ts +325 -0
- package/src/provider.ts +62 -40
- package/src/scope.ts +115 -9
- package/src/size.ts +6 -1
- package/src/terminate.ts +66 -0
- package/src/text.ts +297 -0
- package/src/value.ts +32 -15
- package/src/vite/globals.ts +26 -11
- package/src/vite/index.ts +419 -117
- package/src/vite/inject.ts +91 -16
- package/src/vite/report.ts +21 -12
- package/src/vite/runtime.ts +32 -6
- package/src/vite/usage.ts +89 -48
- package/dist/compile-BRCj4UN7.d.mts.map +0 -1
- package/dist/compile-Cz6hbiQv.mjs.map +0 -1
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { SourceMap } from "@jridgewell/remapping";
|
|
2
|
-
import MagicString from "magic-string";
|
|
3
2
|
import "oxc-parser";
|
|
4
3
|
//#region src/value.d.ts
|
|
5
4
|
type Primitive = string | number | boolean | null | undefined;
|
|
@@ -62,6 +61,14 @@ interface CompileOptions {
|
|
|
62
61
|
* @default true
|
|
63
62
|
*/
|
|
64
63
|
memos?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Replace a `<Show>` or `<Switch>` without callback children or `keyed`
|
|
66
|
+
* with a ternary, which Solid's JSX transform compiles to memos without a
|
|
67
|
+
* component.
|
|
68
|
+
*
|
|
69
|
+
* @default true
|
|
70
|
+
*/
|
|
71
|
+
conditionals?: boolean;
|
|
65
72
|
/**
|
|
66
73
|
* The names of Solid's built-in components. A tag only folds when it is
|
|
67
74
|
* one of these, and an empty list turns control-flow folding off.
|
|
@@ -123,6 +130,12 @@ interface CompileOptions {
|
|
|
123
130
|
* @default false
|
|
124
131
|
*/
|
|
125
132
|
alwaysInline?: boolean;
|
|
133
|
+
/**
|
|
134
|
+
* Top-level components to inline wherever they can be, like
|
|
135
|
+
* `alwaysInline` does for every component. The Vite plugin lists the
|
|
136
|
+
* copies of components from `optimizer.packages` here.
|
|
137
|
+
*/
|
|
138
|
+
alwaysInlineComponents?: readonly string[];
|
|
126
139
|
/**
|
|
127
140
|
* The most passes to run. One pass can expose work for the next, such as
|
|
128
141
|
* an inlined component whose props now fold. Compilation stops early once
|
|
@@ -189,4 +202,4 @@ interface ModuleConstants {
|
|
|
189
202
|
declare function readModuleConstants(code: string, options?: Pick<CompileOptions, 'filename' | 'importedConstants' | 'globalConstants'>): ModuleConstants;
|
|
190
203
|
//#endregion
|
|
191
204
|
export { readModuleConstants as a, SkipPass as c, compile as i, Primitive as l, CompileResult as n, ImportedConstants as o, ModuleConstants as r, Skip as s, CompileOptions as t };
|
|
192
|
-
//# sourceMappingURL=compile-
|
|
205
|
+
//# sourceMappingURL=compile-ioIkBKzR.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compile-ioIkBKzR.d.mts","names":[],"sources":["../src/value.ts","../src/context.ts","../src/constants.ts","../src/compile.ts"],"mappings":";;;KAUY;;;;KC4DA;;;;;UAMK;WACN,MAAM;;WAEN;;WAEA;;;;;;;;KC9DC,oBAAoB,SAAS,eAAe,SAAS,eAAe;;;UCC/D;;;;;;;EAOf;;;;;;;EAOA;;;;;;EAMA;;;;;;;EAOA;;;;;;;EAOA;;;;;;;;EAQA;;;;;;;EAOA;;;;;;;EAOA;;;;;;EAMA,iBAAiB,SAAS;;;;;;;EAO1B;;;;;;EAMA,oBAAoB;;;;;;EAMpB,kBAAkB,SAAS,eAAe;;;;;;EAM1C,mBAAmB,SAAS;;;;;;;;EAQ5B,mBAAmB,SAAS;;;;;;;;EAQ5B;;;;;;EAMA;;;;;;;;EAQA;;;;;;EAMA;;;;;;;EAOA;;UAGe;EACf;;EAEA,KAAK;;;;;EAKL,UAAU;;;;;;;;;;;;;iBAmGI,QAAQ,cAAc,UAAS,iBAAsB;UAwHpD;;;;;EAKf;;;;;;EAMA,SAAS,eAAe;;;;;;;;iBASV,oBACd,cACA,UAAS,KAAK,wEACb"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as readModuleConstants, c as SkipPass, i as compile, l as Primitive, n as CompileResult, o as ImportedConstants, r as ModuleConstants, s as Skip, t as CompileOptions } from "./compile-
|
|
1
|
+
import { a as readModuleConstants, c as SkipPass, i as compile, l as Primitive, n as CompileResult, o as ImportedConstants, r as ModuleConstants, s as Skip, t as CompileOptions } from "./compile-ioIkBKzR.mjs";
|
|
2
2
|
export { type CompileOptions, type CompileResult, type ImportedConstants, type ModuleConstants, type Primitive, type Skip, type SkipPass, compile, readModuleConstants };
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as readModuleConstants, t as compile } from "./compile-
|
|
1
|
+
import { n as readModuleConstants, t as compile } from "./compile-Cvjy2e11.mjs";
|
|
2
2
|
export { compile, readModuleConstants };
|
package/dist/vite.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { s as Skip, t as CompileOptions } from "./compile-
|
|
1
|
+
import { s as Skip, t as CompileOptions } from "./compile-ioIkBKzR.mjs";
|
|
2
2
|
import { Options as Options$1 } from "@solidjs/vite-plugin";
|
|
3
3
|
import { Plugin } from "vite";
|
|
4
4
|
//#region src/vite/report.d.ts
|
|
@@ -10,7 +10,7 @@ interface OptimizerReport {
|
|
|
10
10
|
}
|
|
11
11
|
//#endregion
|
|
12
12
|
//#region src/vite/index.d.ts
|
|
13
|
-
export interface OptimizerOptions extends Pick<CompileOptions, 'fold' | 'inline' | 'alwaysInline' | 'contexts' | 'memos' | 'maxPasses'> {
|
|
13
|
+
export interface OptimizerOptions extends Pick<CompileOptions, 'fold' | 'inline' | 'alwaysInline' | 'contexts' | 'memos' | 'conditionals' | 'maxPasses'> {
|
|
14
14
|
/**
|
|
15
15
|
* Where the optimizer runs.
|
|
16
16
|
*
|
|
@@ -35,6 +35,16 @@ export interface OptimizerOptions extends Pick<CompileOptions, 'fold' | 'inline'
|
|
|
35
35
|
* @default false
|
|
36
36
|
*/
|
|
37
37
|
report?: boolean | ((report: OptimizerReport) => void);
|
|
38
|
+
/**
|
|
39
|
+
* Packages whose components can be copied into the modules that use
|
|
40
|
+
* them, like `['@kobalte/core']`. A package has to publish its JSX, as
|
|
41
|
+
* most Solid libraries do through the `solid` export condition. A copy
|
|
42
|
+
* lets the bundler drop the original, and the runtime code only it used,
|
|
43
|
+
* even when the package lands in another chunk.
|
|
44
|
+
*
|
|
45
|
+
* @default []
|
|
46
|
+
*/
|
|
47
|
+
packages?: readonly string[];
|
|
38
48
|
}
|
|
39
49
|
export interface Options extends Partial<Options$1> {
|
|
40
50
|
/** Set to `false` to use `@solidjs/vite-plugin` as it is. */
|
package/dist/vite.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.d.mts","names":["SolidPluginOptions"],"sources":["../src/vite/report.ts","../src/vite/index.ts"],"mappings":";;;;;UAUiB;;WAEN;WACA,gBAAgB;;;;
|
|
1
|
+
{"version":3,"file":"vite.d.mts","names":["SolidPluginOptions"],"sources":["../src/vite/report.ts","../src/vite/index.ts"],"mappings":";;;;;UAUiB;;WAEN;WACA,gBAAgB;;;;iBC0CV,yBAAyB,KACxC;;;;;;;;;EAWA;;;;;;EAMA;;;;;;;;;EASA,qBAAqB,QAAQ;;;;;;;;;;EAU7B;;iBAKe,gBAAgB,QAAQA;;EAEvC,YAAY;;wBAiNU,eAAe,UAAS,UAAe"}
|