@utoo/pack-shared 1.3.2-alpha.0 → 1.3.3-alpha.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/cjs/config.d.ts +2 -55
- package/cjs/utils.d.ts +1 -14
- package/cjs/utils.js +0 -35
- package/esm/config.d.ts +2 -55
- package/esm/utils.d.ts +1 -14
- package/esm/utils.js +0 -34
- package/package.json +1 -1
package/cjs/config.d.ts
CHANGED
|
@@ -18,18 +18,6 @@ export type RustifiedEnv = {
|
|
|
18
18
|
name: string;
|
|
19
19
|
value: string;
|
|
20
20
|
}[];
|
|
21
|
-
export interface ExperimentalConfig {
|
|
22
|
-
swcPlugins?: [string, any][];
|
|
23
|
-
dynamicIO?: boolean;
|
|
24
|
-
useCache?: boolean;
|
|
25
|
-
cacheHandlers?: Record<string, string>;
|
|
26
|
-
esmExternals?: boolean | "loose";
|
|
27
|
-
ppr?: boolean | "incremental";
|
|
28
|
-
taint?: boolean;
|
|
29
|
-
reactCompiler?: boolean | any;
|
|
30
|
-
viewTransition?: boolean;
|
|
31
|
-
serverActions?: boolean | any;
|
|
32
|
-
}
|
|
33
21
|
export type JSONValue = string | number | boolean | JSONValue[] | {
|
|
34
22
|
[k: string]: JSONValue;
|
|
35
23
|
};
|
|
@@ -69,45 +57,6 @@ export type TurbopackRuleConfigCollection = TurbopackRuleConfigItem | (Turbopack
|
|
|
69
57
|
export interface ModuleOptions {
|
|
70
58
|
rules?: Record<string, TurbopackRuleConfigCollection>;
|
|
71
59
|
}
|
|
72
|
-
/**
|
|
73
|
-
* Path rewrite: object form applies first matching regex→replacement;
|
|
74
|
-
* function form receives path and returns new path (sync only).
|
|
75
|
-
*/
|
|
76
|
-
export type PathRewrite = {
|
|
77
|
-
[regexp: string]: string;
|
|
78
|
-
} | ((path: string) => string);
|
|
79
|
-
/**
|
|
80
|
-
* Proxy rule for dev server HTTP/WS proxying.
|
|
81
|
-
* Mostly aligned with webpack-dev-server / http-proxy-middleware options.
|
|
82
|
-
*/
|
|
83
|
-
export interface ProxyRule {
|
|
84
|
-
/**
|
|
85
|
-
* Path(s) to match for proxying.
|
|
86
|
-
* When starts with `^`, will be treated as RegExp source.
|
|
87
|
-
* Otherwise, simple prefix match is used.
|
|
88
|
-
*/
|
|
89
|
-
context: string | string[];
|
|
90
|
-
/** Target server URL. */
|
|
91
|
-
target: string;
|
|
92
|
-
/**
|
|
93
|
-
* Path rewrite. Object: first matching regex is replaced (http-proxy-middleware style).
|
|
94
|
-
* Function: (path) => new path.
|
|
95
|
-
*/
|
|
96
|
-
pathRewrite?: PathRewrite;
|
|
97
|
-
/**
|
|
98
|
-
* Whether to change the Host header to match the target.
|
|
99
|
-
* Defaults to true.
|
|
100
|
-
*/
|
|
101
|
-
changeOrigin?: boolean;
|
|
102
|
-
/**
|
|
103
|
-
* Whether to verify the SSL certificate of the target.
|
|
104
|
-
* Set to false to accept self-signed certificates.
|
|
105
|
-
*/
|
|
106
|
-
secure?: boolean;
|
|
107
|
-
}
|
|
108
|
-
export type DevServerProxy = ProxyRule[];
|
|
109
|
-
/** Object style proxy options without `context`. */
|
|
110
|
-
export type ProxyOptions = Omit<ProxyRule, "context">;
|
|
111
60
|
export interface ResolveOptions {
|
|
112
61
|
alias?: Record<string, string | string[] | Record<string, string | string[]>>;
|
|
113
62
|
extensions?: string[];
|
|
@@ -147,8 +96,6 @@ export interface DevServerConfig {
|
|
|
147
96
|
host?: string;
|
|
148
97
|
/** Use HTTPS; when true without a certificate, a self-signed cert may be generated. */
|
|
149
98
|
https?: boolean;
|
|
150
|
-
/** HTTP proxy rules for Hono dev server (HTTP only; no generic WS proxy in this layer). */
|
|
151
|
-
proxy?: DevServerProxy;
|
|
152
99
|
}
|
|
153
100
|
export interface ConfigComplete {
|
|
154
101
|
entry: EntryOptions[];
|
|
@@ -209,6 +156,7 @@ export interface ConfigComplete {
|
|
|
209
156
|
styles?: {
|
|
210
157
|
autoCssModules?: boolean;
|
|
211
158
|
emotion?: boolean;
|
|
159
|
+
postcss?: JSONValue;
|
|
212
160
|
less?: {
|
|
213
161
|
implementation?: string;
|
|
214
162
|
[key: string]: any;
|
|
@@ -234,12 +182,11 @@ export interface ConfigComplete {
|
|
|
234
182
|
importSource?: string;
|
|
235
183
|
};
|
|
236
184
|
stats?: boolean;
|
|
185
|
+
swcPlugins?: [string, any][];
|
|
237
186
|
pluginRuntimeStrategy?: "workerThreads" | "childProcesses";
|
|
238
187
|
persistentCaching?: boolean;
|
|
239
188
|
nodePolyfill?: boolean;
|
|
240
189
|
devServer?: DevServerConfig;
|
|
241
|
-
cacheHandler?: string;
|
|
242
|
-
experimental?: ExperimentalConfig;
|
|
243
190
|
}
|
|
244
191
|
export interface HtmlConfig {
|
|
245
192
|
template?: string;
|
package/cjs/utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RustifiedEnv } from "./config";
|
|
2
2
|
import { Issue } from "./issue";
|
|
3
3
|
export declare class ModuleBuildError extends Error {
|
|
4
4
|
name: string;
|
|
@@ -9,19 +9,6 @@ export interface ResultWithIssues {
|
|
|
9
9
|
export declare function processIssues(result: ResultWithIssues, throwIssue: boolean, logErrors: boolean): void;
|
|
10
10
|
export declare function isWellKnownError(issue: Issue): boolean;
|
|
11
11
|
export declare function rustifyEnv(env: Record<string, string>): RustifiedEnv;
|
|
12
|
-
/**
|
|
13
|
-
* Convert object-style proxy config into DevServerProxy array.
|
|
14
|
-
* Object keys become context; string value → target + default changeOrigin; object value merged into ProxyRule.
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* proxy: [
|
|
18
|
-
* ...proxyFromObject({
|
|
19
|
-
* "/api": "http://localhost:3000",
|
|
20
|
-
* "/auth": { target: "http://localhost:5000", changeOrigin: true },
|
|
21
|
-
* }),
|
|
22
|
-
* ];
|
|
23
|
-
*/
|
|
24
|
-
export declare function proxyFromObject(obj: Record<string, string | ProxyOptions>): DevServerProxy;
|
|
25
12
|
type AnyFunc<T> = (this: T, ...args: any) => any;
|
|
26
13
|
export declare function debounce<T, F extends AnyFunc<T>>(fn: F, ms: number, maxWait?: number): (this: T, ...passedArgs: Parameters<F>) => void;
|
|
27
14
|
export {};
|
package/cjs/utils.js
CHANGED
|
@@ -4,7 +4,6 @@ exports.ModuleBuildError = void 0;
|
|
|
4
4
|
exports.processIssues = processIssues;
|
|
5
5
|
exports.isWellKnownError = isWellKnownError;
|
|
6
6
|
exports.rustifyEnv = rustifyEnv;
|
|
7
|
-
exports.proxyFromObject = proxyFromObject;
|
|
8
7
|
exports.debounce = debounce;
|
|
9
8
|
const issue_1 = require("./issue");
|
|
10
9
|
const styledString_1 = require("./styledString");
|
|
@@ -56,40 +55,6 @@ function rustifyEnv(env) {
|
|
|
56
55
|
value,
|
|
57
56
|
}));
|
|
58
57
|
}
|
|
59
|
-
/**
|
|
60
|
-
* Convert object-style proxy config into DevServerProxy array.
|
|
61
|
-
* Object keys become context; string value → target + default changeOrigin; object value merged into ProxyRule.
|
|
62
|
-
*
|
|
63
|
-
* @example
|
|
64
|
-
* proxy: [
|
|
65
|
-
* ...proxyFromObject({
|
|
66
|
-
* "/api": "http://localhost:3000",
|
|
67
|
-
* "/auth": { target: "http://localhost:5000", changeOrigin: true },
|
|
68
|
-
* }),
|
|
69
|
-
* ];
|
|
70
|
-
*/
|
|
71
|
-
function proxyFromObject(obj) {
|
|
72
|
-
const rules = [];
|
|
73
|
-
for (const [context, value] of Object.entries(obj)) {
|
|
74
|
-
if (!value)
|
|
75
|
-
continue;
|
|
76
|
-
if (typeof value === "string") {
|
|
77
|
-
rules.push({
|
|
78
|
-
context,
|
|
79
|
-
target: value,
|
|
80
|
-
changeOrigin: true,
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
rules.push({
|
|
85
|
-
context,
|
|
86
|
-
changeOrigin: true,
|
|
87
|
-
...value,
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
return rules;
|
|
92
|
-
}
|
|
93
58
|
function debounce(fn, ms, maxWait = Infinity) {
|
|
94
59
|
let timeoutId;
|
|
95
60
|
// The time the debouncing function was first called during this debounce queue.
|
package/esm/config.d.ts
CHANGED
|
@@ -18,18 +18,6 @@ export type RustifiedEnv = {
|
|
|
18
18
|
name: string;
|
|
19
19
|
value: string;
|
|
20
20
|
}[];
|
|
21
|
-
export interface ExperimentalConfig {
|
|
22
|
-
swcPlugins?: [string, any][];
|
|
23
|
-
dynamicIO?: boolean;
|
|
24
|
-
useCache?: boolean;
|
|
25
|
-
cacheHandlers?: Record<string, string>;
|
|
26
|
-
esmExternals?: boolean | "loose";
|
|
27
|
-
ppr?: boolean | "incremental";
|
|
28
|
-
taint?: boolean;
|
|
29
|
-
reactCompiler?: boolean | any;
|
|
30
|
-
viewTransition?: boolean;
|
|
31
|
-
serverActions?: boolean | any;
|
|
32
|
-
}
|
|
33
21
|
export type JSONValue = string | number | boolean | JSONValue[] | {
|
|
34
22
|
[k: string]: JSONValue;
|
|
35
23
|
};
|
|
@@ -69,45 +57,6 @@ export type TurbopackRuleConfigCollection = TurbopackRuleConfigItem | (Turbopack
|
|
|
69
57
|
export interface ModuleOptions {
|
|
70
58
|
rules?: Record<string, TurbopackRuleConfigCollection>;
|
|
71
59
|
}
|
|
72
|
-
/**
|
|
73
|
-
* Path rewrite: object form applies first matching regex→replacement;
|
|
74
|
-
* function form receives path and returns new path (sync only).
|
|
75
|
-
*/
|
|
76
|
-
export type PathRewrite = {
|
|
77
|
-
[regexp: string]: string;
|
|
78
|
-
} | ((path: string) => string);
|
|
79
|
-
/**
|
|
80
|
-
* Proxy rule for dev server HTTP/WS proxying.
|
|
81
|
-
* Mostly aligned with webpack-dev-server / http-proxy-middleware options.
|
|
82
|
-
*/
|
|
83
|
-
export interface ProxyRule {
|
|
84
|
-
/**
|
|
85
|
-
* Path(s) to match for proxying.
|
|
86
|
-
* When starts with `^`, will be treated as RegExp source.
|
|
87
|
-
* Otherwise, simple prefix match is used.
|
|
88
|
-
*/
|
|
89
|
-
context: string | string[];
|
|
90
|
-
/** Target server URL. */
|
|
91
|
-
target: string;
|
|
92
|
-
/**
|
|
93
|
-
* Path rewrite. Object: first matching regex is replaced (http-proxy-middleware style).
|
|
94
|
-
* Function: (path) => new path.
|
|
95
|
-
*/
|
|
96
|
-
pathRewrite?: PathRewrite;
|
|
97
|
-
/**
|
|
98
|
-
* Whether to change the Host header to match the target.
|
|
99
|
-
* Defaults to true.
|
|
100
|
-
*/
|
|
101
|
-
changeOrigin?: boolean;
|
|
102
|
-
/**
|
|
103
|
-
* Whether to verify the SSL certificate of the target.
|
|
104
|
-
* Set to false to accept self-signed certificates.
|
|
105
|
-
*/
|
|
106
|
-
secure?: boolean;
|
|
107
|
-
}
|
|
108
|
-
export type DevServerProxy = ProxyRule[];
|
|
109
|
-
/** Object style proxy options without `context`. */
|
|
110
|
-
export type ProxyOptions = Omit<ProxyRule, "context">;
|
|
111
60
|
export interface ResolveOptions {
|
|
112
61
|
alias?: Record<string, string | string[] | Record<string, string | string[]>>;
|
|
113
62
|
extensions?: string[];
|
|
@@ -147,8 +96,6 @@ export interface DevServerConfig {
|
|
|
147
96
|
host?: string;
|
|
148
97
|
/** Use HTTPS; when true without a certificate, a self-signed cert may be generated. */
|
|
149
98
|
https?: boolean;
|
|
150
|
-
/** HTTP proxy rules for Hono dev server (HTTP only; no generic WS proxy in this layer). */
|
|
151
|
-
proxy?: DevServerProxy;
|
|
152
99
|
}
|
|
153
100
|
export interface ConfigComplete {
|
|
154
101
|
entry: EntryOptions[];
|
|
@@ -209,6 +156,7 @@ export interface ConfigComplete {
|
|
|
209
156
|
styles?: {
|
|
210
157
|
autoCssModules?: boolean;
|
|
211
158
|
emotion?: boolean;
|
|
159
|
+
postcss?: JSONValue;
|
|
212
160
|
less?: {
|
|
213
161
|
implementation?: string;
|
|
214
162
|
[key: string]: any;
|
|
@@ -234,12 +182,11 @@ export interface ConfigComplete {
|
|
|
234
182
|
importSource?: string;
|
|
235
183
|
};
|
|
236
184
|
stats?: boolean;
|
|
185
|
+
swcPlugins?: [string, any][];
|
|
237
186
|
pluginRuntimeStrategy?: "workerThreads" | "childProcesses";
|
|
238
187
|
persistentCaching?: boolean;
|
|
239
188
|
nodePolyfill?: boolean;
|
|
240
189
|
devServer?: DevServerConfig;
|
|
241
|
-
cacheHandler?: string;
|
|
242
|
-
experimental?: ExperimentalConfig;
|
|
243
190
|
}
|
|
244
191
|
export interface HtmlConfig {
|
|
245
192
|
template?: string;
|
package/esm/utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RustifiedEnv } from "./config";
|
|
2
2
|
import { Issue } from "./issue";
|
|
3
3
|
export declare class ModuleBuildError extends Error {
|
|
4
4
|
name: string;
|
|
@@ -9,19 +9,6 @@ export interface ResultWithIssues {
|
|
|
9
9
|
export declare function processIssues(result: ResultWithIssues, throwIssue: boolean, logErrors: boolean): void;
|
|
10
10
|
export declare function isWellKnownError(issue: Issue): boolean;
|
|
11
11
|
export declare function rustifyEnv(env: Record<string, string>): RustifiedEnv;
|
|
12
|
-
/**
|
|
13
|
-
* Convert object-style proxy config into DevServerProxy array.
|
|
14
|
-
* Object keys become context; string value → target + default changeOrigin; object value merged into ProxyRule.
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* proxy: [
|
|
18
|
-
* ...proxyFromObject({
|
|
19
|
-
* "/api": "http://localhost:3000",
|
|
20
|
-
* "/auth": { target: "http://localhost:5000", changeOrigin: true },
|
|
21
|
-
* }),
|
|
22
|
-
* ];
|
|
23
|
-
*/
|
|
24
|
-
export declare function proxyFromObject(obj: Record<string, string | ProxyOptions>): DevServerProxy;
|
|
25
12
|
type AnyFunc<T> = (this: T, ...args: any) => any;
|
|
26
13
|
export declare function debounce<T, F extends AnyFunc<T>>(fn: F, ms: number, maxWait?: number): (this: T, ...passedArgs: Parameters<F>) => void;
|
|
27
14
|
export {};
|
package/esm/utils.js
CHANGED
|
@@ -47,40 +47,6 @@ export function rustifyEnv(env) {
|
|
|
47
47
|
value,
|
|
48
48
|
}));
|
|
49
49
|
}
|
|
50
|
-
/**
|
|
51
|
-
* Convert object-style proxy config into DevServerProxy array.
|
|
52
|
-
* Object keys become context; string value → target + default changeOrigin; object value merged into ProxyRule.
|
|
53
|
-
*
|
|
54
|
-
* @example
|
|
55
|
-
* proxy: [
|
|
56
|
-
* ...proxyFromObject({
|
|
57
|
-
* "/api": "http://localhost:3000",
|
|
58
|
-
* "/auth": { target: "http://localhost:5000", changeOrigin: true },
|
|
59
|
-
* }),
|
|
60
|
-
* ];
|
|
61
|
-
*/
|
|
62
|
-
export function proxyFromObject(obj) {
|
|
63
|
-
const rules = [];
|
|
64
|
-
for (const [context, value] of Object.entries(obj)) {
|
|
65
|
-
if (!value)
|
|
66
|
-
continue;
|
|
67
|
-
if (typeof value === "string") {
|
|
68
|
-
rules.push({
|
|
69
|
-
context,
|
|
70
|
-
target: value,
|
|
71
|
-
changeOrigin: true,
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
rules.push({
|
|
76
|
-
context,
|
|
77
|
-
changeOrigin: true,
|
|
78
|
-
...value,
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
return rules;
|
|
83
|
-
}
|
|
84
50
|
export function debounce(fn, ms, maxWait = Infinity) {
|
|
85
51
|
let timeoutId;
|
|
86
52
|
// The time the debouncing function was first called during this debounce queue.
|