@qwik.dev/optimizer 2.1.0-beta.6 → 2.1.0-beta.8
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/bindings/qwik.darwin-arm64.node +0 -0
- package/bindings/qwik.linux-x64-gnu.node +0 -0
- package/bindings/qwik.win32-x64-msvc.node +0 -0
- package/bindings/qwik_wasm_bg.wasm +0 -0
- package/dist/index.d.ts +2 -211
- package/dist/index.mjs +178 -226
- package/dist/optimizer.d.ts +3 -0
- package/dist/path.d.ts +32 -0
- package/dist/platform.d.ts +8 -0
- package/dist/qwik-binding-map.d.ts +26 -0
- package/dist/scripts.d.ts +2 -0
- package/dist/types.d.ts +183 -0
- package/package.json +1 -1
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/index.d.ts
CHANGED
|
@@ -1,211 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
type: 'component';
|
|
4
|
-
manual?: Record<string, string>;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
/** @public */
|
|
8
|
-
export declare const createOptimizer: (optimizerOptions?: OptimizerOptions) => Promise<Optimizer>;
|
|
9
|
-
|
|
10
|
-
/** @public */
|
|
11
|
-
export declare interface Diagnostic {
|
|
12
|
-
scope: string;
|
|
13
|
-
category: DiagnosticCategory;
|
|
14
|
-
code: string | null;
|
|
15
|
-
file: string;
|
|
16
|
-
message: string;
|
|
17
|
-
highlights: SourceLocation[] | null;
|
|
18
|
-
suggestions: string[] | null;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/** @public */
|
|
22
|
-
export declare type DiagnosticCategory = 'error' | 'warning' | 'sourceError';
|
|
23
|
-
|
|
24
|
-
/** @public */
|
|
25
|
-
export declare type EmitMode = 'dev' | 'prod' | 'lib' | 'hmr';
|
|
26
|
-
|
|
27
|
-
/** @public */
|
|
28
|
-
export declare type EntryStrategy = InlineEntryStrategy | HoistEntryStrategy | SingleEntryStrategy | HookEntryStrategy | SegmentEntryStrategy | ComponentEntryStrategy | SmartEntryStrategy;
|
|
29
|
-
|
|
30
|
-
/** @public */
|
|
31
|
-
export declare interface HoistEntryStrategy {
|
|
32
|
-
type: 'hoist';
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/** @public @deprecated Use SegmentStrategy instead */
|
|
36
|
-
export declare interface HookEntryStrategy {
|
|
37
|
-
type: 'hook';
|
|
38
|
-
manual?: Record<string, string>;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/** @public */
|
|
42
|
-
export declare interface InlineEntryStrategy {
|
|
43
|
-
type: 'inline';
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/** @public */
|
|
47
|
-
export declare type MinifyMode = 'simplify' | 'none';
|
|
48
|
-
|
|
49
|
-
/** @public */
|
|
50
|
-
export declare interface Optimizer {
|
|
51
|
-
/** Transforms the input code string, does not access the file system. */
|
|
52
|
-
transformModules(opts: TransformModulesOptions): Promise<TransformOutput>;
|
|
53
|
-
/** Optimizer system use. This can be updated with a custom file system. */
|
|
54
|
-
sys: OptimizerSystem;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/** @public */
|
|
58
|
-
export declare interface OptimizerOptions {
|
|
59
|
-
sys?: OptimizerSystem;
|
|
60
|
-
binding?: any;
|
|
61
|
-
/** Inline the global styles if they're smaller than this */
|
|
62
|
-
inlineStylesUpToBytes?: number;
|
|
63
|
-
/** Enable sourcemaps */
|
|
64
|
-
sourcemap?: boolean;
|
|
65
|
-
_optimizer?: unknown;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/** @public */
|
|
69
|
-
export declare interface OptimizerSystem {
|
|
70
|
-
cwd: () => string;
|
|
71
|
-
env: SystemEnvironment;
|
|
72
|
-
os: string;
|
|
73
|
-
dynamicImport: (path: string) => Promise<any>;
|
|
74
|
-
strictDynamicImport: (path: string) => Promise<any>;
|
|
75
|
-
getInputFiles?: (rootDir: string) => Promise<TransformModuleInput[]>;
|
|
76
|
-
path: Path;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/** @public */
|
|
80
|
-
export declare interface Path {
|
|
81
|
-
resolve(...paths: string[]): string;
|
|
82
|
-
normalize(path: string): string;
|
|
83
|
-
isAbsolute(path: string): boolean;
|
|
84
|
-
join(...paths: string[]): string;
|
|
85
|
-
relative(from: string, to: string): string;
|
|
86
|
-
dirname(path: string): string;
|
|
87
|
-
basename(path: string, ext?: string): string;
|
|
88
|
-
extname(path: string): string;
|
|
89
|
-
format(pathObject: {
|
|
90
|
-
root: string;
|
|
91
|
-
dir: string;
|
|
92
|
-
base: string;
|
|
93
|
-
ext: string;
|
|
94
|
-
name: string;
|
|
95
|
-
}): string;
|
|
96
|
-
parse(path: string): {
|
|
97
|
-
root: string;
|
|
98
|
-
dir: string;
|
|
99
|
-
base: string;
|
|
100
|
-
ext: string;
|
|
101
|
-
name: string;
|
|
102
|
-
};
|
|
103
|
-
readonly sep: string;
|
|
104
|
-
readonly delimiter: string;
|
|
105
|
-
readonly win32: null;
|
|
106
|
-
readonly posix: Path;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/** @public */
|
|
110
|
-
export declare interface SegmentAnalysis {
|
|
111
|
-
origin: string;
|
|
112
|
-
name: string;
|
|
113
|
-
entry: string | null;
|
|
114
|
-
displayName: string;
|
|
115
|
-
hash: string;
|
|
116
|
-
canonicalFilename: string;
|
|
117
|
-
extension: string;
|
|
118
|
-
parent: string | null;
|
|
119
|
-
ctxKind: 'eventHandler' | 'function';
|
|
120
|
-
ctxName: string;
|
|
121
|
-
captures: boolean;
|
|
122
|
-
loc: [number, number];
|
|
123
|
-
/** The parameter names if it's a function with parameters */
|
|
124
|
-
paramNames?: string[];
|
|
125
|
-
/** The transformed names of scoped variables, if any */
|
|
126
|
-
captureNames?: string[];
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/** @public */
|
|
130
|
-
export declare interface SegmentEntryStrategy {
|
|
131
|
-
type: 'segment';
|
|
132
|
-
manual?: Record<string, string>;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
/** @public */
|
|
136
|
-
export declare interface SingleEntryStrategy {
|
|
137
|
-
type: 'single';
|
|
138
|
-
manual?: Record<string, string>;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
/** @public */
|
|
142
|
-
export declare interface SmartEntryStrategy {
|
|
143
|
-
type: 'smart';
|
|
144
|
-
manual?: Record<string, string>;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
/** @public */
|
|
148
|
-
export declare interface SourceLocation {
|
|
149
|
-
hi: number;
|
|
150
|
-
lo: number;
|
|
151
|
-
startLine: number;
|
|
152
|
-
startCol: number;
|
|
153
|
-
endLine: number;
|
|
154
|
-
endCol: number;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
/** @public */
|
|
158
|
-
export declare type SystemEnvironment = 'node' | 'deno' | 'bun' | 'webworker' | 'browsermain' | 'unknown';
|
|
159
|
-
|
|
160
|
-
/** @public */
|
|
161
|
-
export declare interface TransformModule {
|
|
162
|
-
path: string;
|
|
163
|
-
isEntry: boolean;
|
|
164
|
-
code: string;
|
|
165
|
-
imports?: string[];
|
|
166
|
-
map: string | null;
|
|
167
|
-
segment: SegmentAnalysis | null;
|
|
168
|
-
origPath: string | null;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
/** @public */
|
|
172
|
-
export declare interface TransformModuleInput {
|
|
173
|
-
path: string;
|
|
174
|
-
devPath?: string;
|
|
175
|
-
code: string;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
/** @public */
|
|
179
|
-
export declare interface TransformModulesOptions extends TransformOptions {
|
|
180
|
-
input: TransformModuleInput[];
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
/** @public */
|
|
184
|
-
export declare interface TransformOptions {
|
|
185
|
-
srcDir: string;
|
|
186
|
-
rootDir?: string;
|
|
187
|
-
entryStrategy?: EntryStrategy;
|
|
188
|
-
minify?: MinifyMode;
|
|
189
|
-
sourceMaps?: boolean;
|
|
190
|
-
transpileTs?: boolean;
|
|
191
|
-
transpileJsx?: boolean;
|
|
192
|
-
preserveFilenames?: boolean;
|
|
193
|
-
explicitExtensions?: boolean;
|
|
194
|
-
mode?: EmitMode;
|
|
195
|
-
scope?: string;
|
|
196
|
-
stripExports?: string[];
|
|
197
|
-
regCtxName?: string[];
|
|
198
|
-
stripCtxName?: string[];
|
|
199
|
-
stripEventHandlers?: boolean;
|
|
200
|
-
isServer?: boolean;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
/** @public */
|
|
204
|
-
export declare interface TransformOutput {
|
|
205
|
-
modules: TransformModule[];
|
|
206
|
-
diagnostics: Diagnostic[];
|
|
207
|
-
isTypeScript: boolean;
|
|
208
|
-
isJsx: boolean;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
export { }
|
|
1
|
+
export { createOptimizer } from './optimizer';
|
|
2
|
+
export type * from './types';
|
package/dist/index.mjs
CHANGED
|
@@ -1,168 +1,147 @@
|
|
|
1
|
-
function
|
|
2
|
-
function
|
|
3
|
-
if (typeof u != "string")
|
|
4
|
-
throw new TypeError("Path must be a string. Received " + JSON.stringify(u));
|
|
1
|
+
function B(c = {}) {
|
|
2
|
+
function s(u) {
|
|
3
|
+
if (typeof u != "string") throw new TypeError("Path must be a string. Received " + JSON.stringify(u));
|
|
5
4
|
}
|
|
6
5
|
function d(u, n) {
|
|
7
|
-
let e = "",
|
|
8
|
-
for (let
|
|
9
|
-
if (
|
|
10
|
-
t = u.charCodeAt(s);
|
|
6
|
+
let e = "", i = 0, r = -1, l = 0, t;
|
|
7
|
+
for (let o = 0; o <= u.length; ++o) {
|
|
8
|
+
if (o < u.length) t = u.charCodeAt(o);
|
|
11
9
|
else {
|
|
12
|
-
if (t === 47)
|
|
13
|
-
break;
|
|
10
|
+
if (t === 47) break;
|
|
14
11
|
t = 47;
|
|
15
12
|
}
|
|
16
13
|
if (t === 47) {
|
|
17
|
-
if (!(
|
|
18
|
-
if (
|
|
19
|
-
if (e.length
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
14
|
+
if (!(r === o - 1 || l === 1))
|
|
15
|
+
if (r !== o - 1 && l === 2) {
|
|
16
|
+
if (e.length < 2 || i !== 2 || e.charCodeAt(e.length - 1) !== 46 || e.charCodeAt(e.length - 2) !== 46) {
|
|
17
|
+
if (e.length > 2) {
|
|
18
|
+
const f = e.lastIndexOf("/");
|
|
19
|
+
if (f !== e.length - 1) {
|
|
20
|
+
f === -1 ? (e = "", i = 0) : (e = e.slice(0, f), i = e.length - 1 - e.lastIndexOf("/")), r = o, l = 0;
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
} else if (e.length === 2 || e.length === 1) {
|
|
24
|
+
e = "", i = 0, r = o, l = 0;
|
|
23
25
|
continue;
|
|
24
26
|
}
|
|
25
|
-
} else if (e.length === 2 || e.length === 1) {
|
|
26
|
-
e = "", r = 0, i = s, l = 0;
|
|
27
|
-
continue;
|
|
28
27
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
i = s, l = 0;
|
|
28
|
+
n && (e.length > 0 ? e += "/.." : e = "..", i = 2);
|
|
29
|
+
} else
|
|
30
|
+
e.length > 0 ? e += "/" + u.slice(r + 1, o) : e = u.slice(r + 1, o), i = o - r - 1;
|
|
31
|
+
r = o, l = 0;
|
|
34
32
|
} else t === 46 && l !== -1 ? ++l : l = -1;
|
|
35
33
|
}
|
|
36
34
|
return e;
|
|
37
35
|
}
|
|
38
|
-
function
|
|
39
|
-
const e = n.dir || n.root,
|
|
40
|
-
return e ? e === n.root ? e +
|
|
36
|
+
function g(u, n) {
|
|
37
|
+
const e = n.dir || n.root, i = n.base || (n.name || "") + (n.ext || "");
|
|
38
|
+
return e ? e === n.root ? e + i : e + u + i : i;
|
|
41
39
|
}
|
|
42
|
-
const
|
|
43
|
-
let e = "",
|
|
44
|
-
for (let l = n.length - 1; l >= -1 && !
|
|
40
|
+
const y = function(...n) {
|
|
41
|
+
let e = "", i = !1, r;
|
|
42
|
+
for (let l = n.length - 1; l >= -1 && !i; l--) {
|
|
45
43
|
let t;
|
|
46
|
-
l >= 0 ? t = n[l] : (
|
|
44
|
+
l >= 0 ? t = n[l] : (r === void 0 && (c && typeof c.cwd == "function" ? r = c.cwd() : typeof process < "u" && typeof process.cwd == "function" ? r = process.cwd() : r = "/"), t = r), s(t), t.length !== 0 && (e = t + "/" + e, i = t.charCodeAt(0) === 47);
|
|
47
45
|
}
|
|
48
|
-
return e = d(e, !
|
|
46
|
+
return e = d(e, !i), i ? e.length > 0 ? "/" + e : "/" : e.length > 0 ? e : ".";
|
|
49
47
|
}, h = function(n) {
|
|
50
|
-
if (
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
if (n.length === 0)
|
|
58
|
-
return ".";
|
|
48
|
+
if (s(n), n.length === 0) return ".";
|
|
49
|
+
const e = n.charCodeAt(0) === 47, i = n.charCodeAt(n.length - 1) === 47;
|
|
50
|
+
return n = d(n, !e), n.length === 0 && !e && (n = "."), n.length > 0 && i && (n += "/"), e ? "/" + n : n;
|
|
51
|
+
}, b = function(n) {
|
|
52
|
+
return s(n), n.length > 0 && n.charCodeAt(0) === 47;
|
|
53
|
+
}, p = function(...n) {
|
|
54
|
+
if (n.length === 0) return ".";
|
|
59
55
|
let e;
|
|
60
|
-
for (let
|
|
61
|
-
const
|
|
62
|
-
|
|
56
|
+
for (let i = 0; i < n.length; ++i) {
|
|
57
|
+
const r = n[i];
|
|
58
|
+
s(r), r.length > 0 && (e === void 0 ? e = r : e += "/" + r);
|
|
63
59
|
}
|
|
64
60
|
return e === void 0 ? "." : h(e);
|
|
65
61
|
}, v = function(n, e) {
|
|
66
|
-
if (
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
;
|
|
71
|
-
const i = n.length, l = i - r;
|
|
62
|
+
if (s(n), s(e), n === e || (n = y(n), e = y(e), n === e)) return "";
|
|
63
|
+
let i = 1;
|
|
64
|
+
for (; i < n.length && n.charCodeAt(i) === 47; ++i) ;
|
|
65
|
+
const r = n.length, l = r - i;
|
|
72
66
|
let t = 1;
|
|
73
|
-
for (; t < e.length && e.charCodeAt(t) === 47; ++t)
|
|
74
|
-
|
|
75
|
-
const f = e.length - t, y = l < f ? l : f;
|
|
67
|
+
for (; t < e.length && e.charCodeAt(t) === 47; ++t) ;
|
|
68
|
+
const o = e.length - t, f = l < o ? l : o;
|
|
76
69
|
let m = -1, a = 0;
|
|
77
|
-
for (; a <=
|
|
78
|
-
if (a ===
|
|
79
|
-
if (
|
|
80
|
-
if (e.charCodeAt(t + a) === 47)
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
return e.slice(t + a);
|
|
84
|
-
} else l > y && (n.charCodeAt(r + a) === 47 ? m = a : a === 0 && (m = 0));
|
|
70
|
+
for (; a <= f; ++a) {
|
|
71
|
+
if (a === f) {
|
|
72
|
+
if (o > f) {
|
|
73
|
+
if (e.charCodeAt(t + a) === 47) return e.slice(t + a + 1);
|
|
74
|
+
if (a === 0) return e.slice(t + a);
|
|
75
|
+
} else l > f && (n.charCodeAt(i + a) === 47 ? m = a : a === 0 && (m = 0));
|
|
85
76
|
break;
|
|
86
77
|
}
|
|
87
|
-
const
|
|
88
|
-
if (
|
|
89
|
-
|
|
90
|
-
D === 47 && (m = a);
|
|
78
|
+
const P = n.charCodeAt(i + a);
|
|
79
|
+
if (P !== e.charCodeAt(t + a)) break;
|
|
80
|
+
P === 47 && (m = a);
|
|
91
81
|
}
|
|
92
|
-
let
|
|
93
|
-
for (a =
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
if (o(n), n.length === 0)
|
|
98
|
-
return ".";
|
|
82
|
+
let w = "";
|
|
83
|
+
for (a = i + m + 1; a <= r; ++a) (a === r || n.charCodeAt(a) === 47) && (w.length === 0 ? w += ".." : w += "/..");
|
|
84
|
+
return w.length > 0 ? w + e.slice(t + m) : (t += m, e.charCodeAt(t) === 47 && ++t, e.slice(t));
|
|
85
|
+
}, A = function(n) {
|
|
86
|
+
if (s(n), n.length === 0) return ".";
|
|
99
87
|
let e = n.charCodeAt(0);
|
|
100
|
-
const
|
|
101
|
-
let
|
|
88
|
+
const i = e === 47;
|
|
89
|
+
let r = -1, l = !0;
|
|
102
90
|
for (let t = n.length - 1; t >= 1; --t)
|
|
103
91
|
if (e = n.charCodeAt(t), e === 47) {
|
|
104
92
|
if (!l) {
|
|
105
|
-
|
|
93
|
+
r = t;
|
|
106
94
|
break;
|
|
107
95
|
}
|
|
108
|
-
} else
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
o(n);
|
|
115
|
-
let r = 0, i = -1, l = !0, t;
|
|
96
|
+
} else l = !1;
|
|
97
|
+
return r === -1 ? i ? "/" : "." : i && r === 1 ? "//" : n.slice(0, r);
|
|
98
|
+
}, C = function(n, e) {
|
|
99
|
+
if (e !== void 0 && typeof e != "string") throw new TypeError('"ext" argument must be a string');
|
|
100
|
+
s(n);
|
|
101
|
+
let i = 0, r = -1, l = !0, t;
|
|
116
102
|
if (e !== void 0 && e.length > 0 && e.length <= n.length) {
|
|
117
|
-
if (e.length === n.length && e === n)
|
|
118
|
-
|
|
119
|
-
let s = e.length - 1, f = -1;
|
|
103
|
+
if (e.length === n.length && e === n) return "";
|
|
104
|
+
let o = e.length - 1, f = -1;
|
|
120
105
|
for (t = n.length - 1; t >= 0; --t) {
|
|
121
|
-
const
|
|
122
|
-
if (
|
|
106
|
+
const m = n.charCodeAt(t);
|
|
107
|
+
if (m === 47) {
|
|
123
108
|
if (!l) {
|
|
124
|
-
|
|
109
|
+
i = t + 1;
|
|
125
110
|
break;
|
|
126
111
|
}
|
|
127
112
|
} else
|
|
128
|
-
f === -1 && (l = !1, f = t + 1),
|
|
113
|
+
f === -1 && (l = !1, f = t + 1), o >= 0 && (m === e.charCodeAt(o) ? --o === -1 && (r = t) : (o = -1, r = f));
|
|
129
114
|
}
|
|
130
|
-
return
|
|
115
|
+
return i === r ? r = f : r === -1 && (r = n.length), n.slice(i, r);
|
|
131
116
|
} else {
|
|
132
|
-
for (t = n.length - 1; t >= 0; --t)
|
|
133
|
-
if (
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
return i === -1 ? "" : n.slice(r, i);
|
|
117
|
+
for (t = n.length - 1; t >= 0; --t) if (n.charCodeAt(t) === 47) {
|
|
118
|
+
if (!l) {
|
|
119
|
+
i = t + 1;
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
} else r === -1 && (l = !1, r = t + 1);
|
|
123
|
+
return r === -1 ? "" : n.slice(i, r);
|
|
140
124
|
}
|
|
141
|
-
},
|
|
142
|
-
|
|
143
|
-
let e = -1,
|
|
144
|
-
for (let
|
|
145
|
-
const f = n.charCodeAt(
|
|
125
|
+
}, k = function(n) {
|
|
126
|
+
s(n);
|
|
127
|
+
let e = -1, i = 0, r = -1, l = !0, t = 0;
|
|
128
|
+
for (let o = n.length - 1; o >= 0; --o) {
|
|
129
|
+
const f = n.charCodeAt(o);
|
|
146
130
|
if (f === 47) {
|
|
147
131
|
if (!l) {
|
|
148
|
-
|
|
132
|
+
i = o + 1;
|
|
149
133
|
break;
|
|
150
134
|
}
|
|
151
135
|
continue;
|
|
152
136
|
}
|
|
153
|
-
|
|
137
|
+
r === -1 && (l = !1, r = o + 1), f === 46 ? e === -1 ? e = o : t !== 1 && (t = 1) : e !== -1 && (t = -1);
|
|
154
138
|
}
|
|
155
|
-
return e === -1 ||
|
|
156
|
-
|
|
157
|
-
|
|
139
|
+
return e === -1 || r === -1 || t === 0 || t === 1 && e === r - 1 && e === i + 1 ? "" : n.slice(e, r);
|
|
140
|
+
}, I = function(n) {
|
|
141
|
+
if (n === null || typeof n != "object") throw new TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof n);
|
|
142
|
+
return g("/", n);
|
|
158
143
|
}, S = function(n) {
|
|
159
|
-
|
|
160
|
-
throw new TypeError(
|
|
161
|
-
'The "pathObject" argument must be of type Object. Received type ' + typeof n
|
|
162
|
-
);
|
|
163
|
-
return w("/", n);
|
|
164
|
-
}, x = function(n) {
|
|
165
|
-
o(n);
|
|
144
|
+
s(n);
|
|
166
145
|
const e = {
|
|
167
146
|
root: "",
|
|
168
147
|
dir: "",
|
|
@@ -170,152 +149,125 @@ function q(c = {}) {
|
|
|
170
149
|
ext: "",
|
|
171
150
|
name: ""
|
|
172
151
|
};
|
|
173
|
-
if (n.length === 0)
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
s = m + 1;
|
|
152
|
+
if (n.length === 0) return e;
|
|
153
|
+
let i = n.charCodeAt(0), r;
|
|
154
|
+
const l = i === 47;
|
|
155
|
+
l ? (e.root = "/", r = 1) : r = 0;
|
|
156
|
+
let t = -1, o = 0, f = -1, m = !0, a = n.length - 1, w = 0;
|
|
157
|
+
for (; a >= r; --a) {
|
|
158
|
+
if (i = n.charCodeAt(a), i === 47) {
|
|
159
|
+
if (!m) {
|
|
160
|
+
o = a + 1;
|
|
183
161
|
break;
|
|
184
162
|
}
|
|
185
163
|
continue;
|
|
186
164
|
}
|
|
187
|
-
f === -1 && (
|
|
165
|
+
f === -1 && (m = !1, f = a + 1), i === 46 ? t === -1 ? t = a : w !== 1 && (w = 1) : t !== -1 && (w = -1);
|
|
188
166
|
}
|
|
189
|
-
return t === -1 || f === -1 ||
|
|
190
|
-
|
|
191
|
-
a === 1 && t === f - 1 && t === s + 1 ? f !== -1 && (s === 0 && l ? e.base = e.name = n.slice(1, f) : e.base = e.name = n.slice(s, f)) : (s === 0 && l ? (e.name = n.slice(1, t), e.base = n.slice(1, f)) : (e.name = n.slice(s, t), e.base = n.slice(s, f)), e.ext = n.slice(t, f)), s > 0 ? e.dir = n.slice(0, s - 1) : l && (e.dir = "/"), e;
|
|
192
|
-
}, E = "/", P = ":";
|
|
167
|
+
return t === -1 || f === -1 || w === 0 || w === 1 && t === f - 1 && t === o + 1 ? f !== -1 && (o === 0 && l ? e.base = e.name = n.slice(1, f) : e.base = e.name = n.slice(o, f)) : (o === 0 && l ? (e.name = n.slice(1, t), e.base = n.slice(1, f)) : (e.name = n.slice(o, t), e.base = n.slice(o, f)), e.ext = n.slice(t, f)), o > 0 ? e.dir = n.slice(0, o - 1) : l && (e.dir = "/"), e;
|
|
168
|
+
}, x = "/", E = ":";
|
|
193
169
|
return {
|
|
194
170
|
relative: v,
|
|
195
|
-
resolve:
|
|
196
|
-
parse:
|
|
197
|
-
format:
|
|
198
|
-
join:
|
|
199
|
-
isAbsolute:
|
|
200
|
-
basename:
|
|
171
|
+
resolve: y,
|
|
172
|
+
parse: S,
|
|
173
|
+
format: I,
|
|
174
|
+
join: p,
|
|
175
|
+
isAbsolute: b,
|
|
176
|
+
basename: C,
|
|
201
177
|
normalize: h,
|
|
202
|
-
dirname:
|
|
203
|
-
extname:
|
|
204
|
-
delimiter:
|
|
205
|
-
sep:
|
|
178
|
+
dirname: A,
|
|
179
|
+
extname: k,
|
|
180
|
+
delimiter: E,
|
|
181
|
+
sep: x,
|
|
206
182
|
win32: null,
|
|
207
183
|
posix: {
|
|
208
184
|
relative: v,
|
|
209
|
-
resolve:
|
|
210
|
-
parse:
|
|
211
|
-
format:
|
|
212
|
-
join:
|
|
213
|
-
isAbsolute:
|
|
214
|
-
basename:
|
|
185
|
+
resolve: y,
|
|
186
|
+
parse: S,
|
|
187
|
+
format: I,
|
|
188
|
+
join: p,
|
|
189
|
+
isAbsolute: b,
|
|
190
|
+
basename: C,
|
|
215
191
|
normalize: h,
|
|
216
|
-
dirname:
|
|
217
|
-
extname:
|
|
218
|
-
delimiter:
|
|
219
|
-
sep:
|
|
192
|
+
dirname: A,
|
|
193
|
+
extname: k,
|
|
194
|
+
delimiter: E,
|
|
195
|
+
sep: x,
|
|
220
196
|
win32: null,
|
|
221
197
|
posix: null
|
|
222
198
|
}
|
|
223
199
|
};
|
|
224
200
|
}
|
|
225
|
-
|
|
226
|
-
darwin: {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
]
|
|
245
|
-
},
|
|
246
|
-
linux: {
|
|
247
|
-
x64: [
|
|
248
|
-
{
|
|
249
|
-
platform: "linux",
|
|
250
|
-
arch: "x64",
|
|
251
|
-
abi: "gnu",
|
|
252
|
-
platformArchABI: "qwik.linux-x64-gnu.node"
|
|
253
|
-
}
|
|
254
|
-
]
|
|
255
|
-
}
|
|
201
|
+
var _ = {
|
|
202
|
+
darwin: { arm64: [{
|
|
203
|
+
platform: "darwin",
|
|
204
|
+
arch: "arm64",
|
|
205
|
+
abi: null,
|
|
206
|
+
platformArchABI: "qwik.darwin-arm64.node"
|
|
207
|
+
}] },
|
|
208
|
+
win32: { x64: [{
|
|
209
|
+
platform: "win32",
|
|
210
|
+
arch: "x64",
|
|
211
|
+
abi: "msvc",
|
|
212
|
+
platformArchABI: "qwik.win32-x64-msvc.node"
|
|
213
|
+
}] },
|
|
214
|
+
linux: { x64: [{
|
|
215
|
+
platform: "linux",
|
|
216
|
+
arch: "x64",
|
|
217
|
+
abi: "gnu",
|
|
218
|
+
platformArchABI: "qwik.linux-x64-gnu.node"
|
|
219
|
+
}] }
|
|
256
220
|
};
|
|
257
|
-
async function
|
|
258
|
-
const c =
|
|
221
|
+
async function q() {
|
|
222
|
+
const c = D(), s = {
|
|
259
223
|
dynamicImport: (d) => {
|
|
260
|
-
throw new Error(
|
|
261
|
-
`Qwik Optimizer sys.dynamicImport() not implemented, trying to import: "${d}"`
|
|
262
|
-
);
|
|
224
|
+
throw new Error(`Qwik Optimizer sys.dynamicImport() not implemented, trying to import: "${d}"`);
|
|
263
225
|
},
|
|
264
226
|
strictDynamicImport: (d) => {
|
|
265
|
-
throw new Error(
|
|
266
|
-
`Qwik Optimizer sys.strictDynamicImport() not implemented, trying to import: "${d}"`
|
|
267
|
-
);
|
|
227
|
+
throw new Error(`Qwik Optimizer sys.strictDynamicImport() not implemented, trying to import: "${d}"`);
|
|
268
228
|
},
|
|
269
229
|
path: null,
|
|
270
230
|
cwd: () => "/",
|
|
271
231
|
os: "unknown",
|
|
272
232
|
env: c
|
|
273
233
|
};
|
|
274
|
-
if (
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
return o;
|
|
234
|
+
if (s.path = B(s), s.strictDynamicImport = s.dynamicImport = (d) => import(d), c !== "webworker" && c !== "browsermain") try {
|
|
235
|
+
s.path = await s.dynamicImport("node:path"), s.cwd = () => process.cwd(), s.os = process.platform;
|
|
236
|
+
} catch {
|
|
237
|
+
}
|
|
238
|
+
return s;
|
|
280
239
|
}
|
|
281
|
-
async function
|
|
282
|
-
const
|
|
283
|
-
if (
|
|
284
|
-
const d =
|
|
240
|
+
async function N(c) {
|
|
241
|
+
const s = D();
|
|
242
|
+
if (s === "node" || s === "bun") {
|
|
243
|
+
const d = _[process.platform];
|
|
285
244
|
if (d) {
|
|
286
|
-
const
|
|
287
|
-
if (
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
);
|
|
293
|
-
} catch (h) {
|
|
294
|
-
console.warn(
|
|
295
|
-
`Unable to load native binding ${g.platformArchABI}. Falling back to wasm build.`,
|
|
296
|
-
h?.message
|
|
297
|
-
);
|
|
298
|
-
}
|
|
245
|
+
const g = d[process.arch];
|
|
246
|
+
if (g) for (const y of g) try {
|
|
247
|
+
return (await c.dynamicImport("node:module")).default.createRequire(import.meta.url)(`../bindings/${y.platformArchABI}`);
|
|
248
|
+
} catch (h) {
|
|
249
|
+
console.warn(`Unable to load native binding ${y.platformArchABI}. Falling back to wasm build.`, h?.message);
|
|
250
|
+
}
|
|
299
251
|
}
|
|
300
252
|
}
|
|
301
|
-
if (
|
|
302
|
-
const d = await c.dynamicImport("node:url"),
|
|
303
|
-
return await h.default(
|
|
253
|
+
if (s === "node" || s === "bun") {
|
|
254
|
+
const d = await c.dynamicImport("node:url"), g = c.path.dirname(d.fileURLToPath(import.meta.url)), y = c.path.join(g, "..", "bindings", "qwik_wasm_bg.wasm"), h = await c.dynamicImport("../bindings/qwik.wasm.mjs"), b = await (await c.dynamicImport("node:fs")).promises.readFile(y), p = await WebAssembly.compile(b);
|
|
255
|
+
return await h.default(p), h;
|
|
304
256
|
} else {
|
|
305
257
|
const d = await c.dynamicImport("../bindings/qwik.wasm.mjs");
|
|
306
258
|
return await d.default(), d;
|
|
307
259
|
}
|
|
308
260
|
}
|
|
309
|
-
|
|
310
|
-
const
|
|
261
|
+
var D = () => typeof Deno < "u" ? "deno" : typeof Bun < "u" ? "bun" : typeof process < "u" && typeof global < "u" && process.versions && process.versions.node ? "node" : typeof self < "u" && typeof location < "u" && typeof navigator < "u" && typeof fetch == "function" && typeof WorkerGlobalScope == "function" && typeof self.importScripts == "function" ? "webworker" : typeof window < "u" && typeof document < "u" && typeof location < "u" && typeof navigator < "u" && typeof Window == "function" && typeof fetch == "function" ? "browsermain" : "unknown", R = async (c = {}) => {
|
|
262
|
+
const s = c?.sys || await q(), d = c?.binding || await N(s);
|
|
311
263
|
return {
|
|
312
264
|
async transformModules(g) {
|
|
313
|
-
return
|
|
265
|
+
return T(d, g);
|
|
314
266
|
},
|
|
315
|
-
sys:
|
|
267
|
+
sys: s
|
|
316
268
|
};
|
|
317
|
-
},
|
|
318
|
-
const
|
|
269
|
+
}, T = (c, s) => c.transform_modules(z(s)), z = (c) => {
|
|
270
|
+
const s = {
|
|
319
271
|
minify: "simplify",
|
|
320
272
|
sourceMaps: !1,
|
|
321
273
|
transpileTs: !1,
|
|
@@ -332,10 +284,10 @@ const B = () => typeof Deno < "u" ? "deno" : typeof Bun < "u" ? "bun" : typeof p
|
|
|
332
284
|
stripCtxName: void 0,
|
|
333
285
|
isServer: void 0
|
|
334
286
|
};
|
|
335
|
-
return Object.entries(c).forEach(([d,
|
|
336
|
-
|
|
337
|
-
}),
|
|
287
|
+
return Object.entries(c).forEach(([d, g]) => {
|
|
288
|
+
g != null && (s[d] = g);
|
|
289
|
+
}), s.entryStrategy = c.entryStrategy?.type ?? "smart", s.manualChunks = c.entryStrategy?.manual ?? void 0, s;
|
|
338
290
|
};
|
|
339
291
|
export {
|
|
340
|
-
|
|
292
|
+
R as createOptimizer
|
|
341
293
|
};
|
package/dist/path.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export declare function createPath(opts?: {
|
|
2
|
+
cwd?: () => string;
|
|
3
|
+
}): Path;
|
|
4
|
+
export interface ParsedPath {
|
|
5
|
+
/** The root of the path such as '/' or 'c:' */
|
|
6
|
+
root: string;
|
|
7
|
+
/** The full directory path such as '/home/user/dir' or 'c:\path\dir' */
|
|
8
|
+
dir: string;
|
|
9
|
+
/** The file name including extension (if any) such as 'index.html' */
|
|
10
|
+
base: string;
|
|
11
|
+
/** The file extension (if any) such as '.html' */
|
|
12
|
+
ext: string;
|
|
13
|
+
/** The file name without extension (if any) such as 'index' */
|
|
14
|
+
name: string;
|
|
15
|
+
}
|
|
16
|
+
export type FormatInputPathObject = Partial<ParsedPath>;
|
|
17
|
+
export interface Path {
|
|
18
|
+
resolve(...pathSegments: string[]): string;
|
|
19
|
+
normalize(path: string): string;
|
|
20
|
+
isAbsolute(path: string): boolean;
|
|
21
|
+
join(...paths: string[]): string;
|
|
22
|
+
relative(from: string, to: string): string;
|
|
23
|
+
dirname(path: string): string;
|
|
24
|
+
basename(path: string, ext?: string): string;
|
|
25
|
+
extname(path: string): string;
|
|
26
|
+
format(pathObject: FormatInputPathObject): string;
|
|
27
|
+
parse(path: string): ParsedPath;
|
|
28
|
+
readonly sep: string;
|
|
29
|
+
readonly delimiter: string;
|
|
30
|
+
readonly win32: null;
|
|
31
|
+
readonly posix: Path;
|
|
32
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { OptimizerSystem, TransformModuleInput, TransformOutput } from './types';
|
|
2
|
+
export declare function getSystem(): Promise<OptimizerSystem>;
|
|
3
|
+
export declare const getPlatformInputFiles: (sys: OptimizerSystem) => Promise<((rootDir: string) => Promise<TransformModuleInput[]>) | null>;
|
|
4
|
+
export declare function loadPlatformBinding(sys: OptimizerSystem): Promise<any>;
|
|
5
|
+
export interface PlatformBinding {
|
|
6
|
+
transform_fs?: (opts: any) => TransformOutput;
|
|
7
|
+
transform_modules: (opts: any) => Promise<TransformOutput>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare const QWIK_BINDING_MAP: {
|
|
2
|
+
darwin: {
|
|
3
|
+
arm64: {
|
|
4
|
+
platform: string;
|
|
5
|
+
arch: string;
|
|
6
|
+
abi: null;
|
|
7
|
+
platformArchABI: string;
|
|
8
|
+
}[];
|
|
9
|
+
};
|
|
10
|
+
win32: {
|
|
11
|
+
x64: {
|
|
12
|
+
platform: string;
|
|
13
|
+
arch: string;
|
|
14
|
+
abi: string;
|
|
15
|
+
platformArchABI: string;
|
|
16
|
+
}[];
|
|
17
|
+
};
|
|
18
|
+
linux: {
|
|
19
|
+
x64: {
|
|
20
|
+
platform: string;
|
|
21
|
+
arch: string;
|
|
22
|
+
abi: string;
|
|
23
|
+
platformArchABI: string;
|
|
24
|
+
}[];
|
|
25
|
+
};
|
|
26
|
+
};
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/** @public */
|
|
2
|
+
export interface Optimizer {
|
|
3
|
+
/** Transforms the input code string, does not access the file system. */
|
|
4
|
+
transformModules(opts: TransformModulesOptions): Promise<TransformOutput>;
|
|
5
|
+
/** Optimizer system use. This can be updated with a custom file system. */
|
|
6
|
+
sys: OptimizerSystem;
|
|
7
|
+
}
|
|
8
|
+
/** @public */
|
|
9
|
+
export interface OptimizerOptions {
|
|
10
|
+
sys?: OptimizerSystem;
|
|
11
|
+
binding?: any;
|
|
12
|
+
/** Inline the global styles if they're smaller than this */
|
|
13
|
+
inlineStylesUpToBytes?: number;
|
|
14
|
+
/** Enable sourcemaps */
|
|
15
|
+
sourcemap?: boolean;
|
|
16
|
+
_optimizer?: unknown;
|
|
17
|
+
}
|
|
18
|
+
/** @public */
|
|
19
|
+
export interface OptimizerSystem {
|
|
20
|
+
cwd: () => string;
|
|
21
|
+
env: SystemEnvironment;
|
|
22
|
+
os: string;
|
|
23
|
+
dynamicImport: (path: string) => Promise<any>;
|
|
24
|
+
strictDynamicImport: (path: string) => Promise<any>;
|
|
25
|
+
getInputFiles?: (rootDir: string) => Promise<TransformModuleInput[]>;
|
|
26
|
+
path: Path;
|
|
27
|
+
}
|
|
28
|
+
/** @public */
|
|
29
|
+
export type SystemEnvironment = 'node' | 'deno' | 'bun' | 'webworker' | 'browsermain' | 'unknown';
|
|
30
|
+
/** @public */
|
|
31
|
+
export interface TransformOptions {
|
|
32
|
+
srcDir: string;
|
|
33
|
+
rootDir?: string;
|
|
34
|
+
entryStrategy?: EntryStrategy;
|
|
35
|
+
minify?: MinifyMode;
|
|
36
|
+
sourceMaps?: boolean;
|
|
37
|
+
transpileTs?: boolean;
|
|
38
|
+
transpileJsx?: boolean;
|
|
39
|
+
preserveFilenames?: boolean;
|
|
40
|
+
explicitExtensions?: boolean;
|
|
41
|
+
mode?: EmitMode;
|
|
42
|
+
scope?: string;
|
|
43
|
+
stripExports?: string[];
|
|
44
|
+
regCtxName?: string[];
|
|
45
|
+
stripCtxName?: string[];
|
|
46
|
+
stripEventHandlers?: boolean;
|
|
47
|
+
isServer?: boolean;
|
|
48
|
+
}
|
|
49
|
+
/** @public */
|
|
50
|
+
export interface TransformModulesOptions extends TransformOptions {
|
|
51
|
+
input: TransformModuleInput[];
|
|
52
|
+
}
|
|
53
|
+
/** @public */
|
|
54
|
+
export interface TransformModuleInput {
|
|
55
|
+
path: string;
|
|
56
|
+
devPath?: string;
|
|
57
|
+
code: string;
|
|
58
|
+
}
|
|
59
|
+
/** @public */
|
|
60
|
+
export interface TransformOutput {
|
|
61
|
+
modules: TransformModule[];
|
|
62
|
+
diagnostics: Diagnostic[];
|
|
63
|
+
isTypeScript: boolean;
|
|
64
|
+
isJsx: boolean;
|
|
65
|
+
}
|
|
66
|
+
/** @public */
|
|
67
|
+
export interface SegmentAnalysis {
|
|
68
|
+
origin: string;
|
|
69
|
+
name: string;
|
|
70
|
+
entry: string | null;
|
|
71
|
+
displayName: string;
|
|
72
|
+
hash: string;
|
|
73
|
+
canonicalFilename: string;
|
|
74
|
+
extension: string;
|
|
75
|
+
parent: string | null;
|
|
76
|
+
ctxKind: 'eventHandler' | 'function';
|
|
77
|
+
ctxName: string;
|
|
78
|
+
captures: boolean;
|
|
79
|
+
loc: [number, number];
|
|
80
|
+
/** The parameter names if it's a function with parameters */
|
|
81
|
+
paramNames?: string[];
|
|
82
|
+
/** The transformed names of scoped variables, if any */
|
|
83
|
+
captureNames?: string[];
|
|
84
|
+
}
|
|
85
|
+
/** @public */
|
|
86
|
+
export interface TransformModule {
|
|
87
|
+
path: string;
|
|
88
|
+
isEntry: boolean;
|
|
89
|
+
code: string;
|
|
90
|
+
imports?: string[];
|
|
91
|
+
map: string | null;
|
|
92
|
+
segment: SegmentAnalysis | null;
|
|
93
|
+
origPath: string | null;
|
|
94
|
+
}
|
|
95
|
+
/** @public */
|
|
96
|
+
export interface Diagnostic {
|
|
97
|
+
scope: string;
|
|
98
|
+
category: DiagnosticCategory;
|
|
99
|
+
code: string | null;
|
|
100
|
+
file: string;
|
|
101
|
+
message: string;
|
|
102
|
+
highlights: SourceLocation[] | null;
|
|
103
|
+
suggestions: string[] | null;
|
|
104
|
+
}
|
|
105
|
+
/** @public */
|
|
106
|
+
export interface SourceLocation {
|
|
107
|
+
hi: number;
|
|
108
|
+
lo: number;
|
|
109
|
+
startLine: number;
|
|
110
|
+
startCol: number;
|
|
111
|
+
endLine: number;
|
|
112
|
+
endCol: number;
|
|
113
|
+
}
|
|
114
|
+
/** @public */
|
|
115
|
+
export type DiagnosticCategory = 'error' | 'warning' | 'sourceError';
|
|
116
|
+
/** @public */
|
|
117
|
+
export type EntryStrategy = InlineEntryStrategy | HoistEntryStrategy | SingleEntryStrategy | HookEntryStrategy | SegmentEntryStrategy | ComponentEntryStrategy | SmartEntryStrategy;
|
|
118
|
+
/** @public */
|
|
119
|
+
export type MinifyMode = 'simplify' | 'none';
|
|
120
|
+
/** @public */
|
|
121
|
+
export type EmitMode = 'dev' | 'prod' | 'lib' | 'hmr';
|
|
122
|
+
/** @public */
|
|
123
|
+
export interface InlineEntryStrategy {
|
|
124
|
+
type: 'inline';
|
|
125
|
+
}
|
|
126
|
+
/** @public */
|
|
127
|
+
export interface HoistEntryStrategy {
|
|
128
|
+
type: 'hoist';
|
|
129
|
+
}
|
|
130
|
+
/** @public @deprecated Use SegmentStrategy instead */
|
|
131
|
+
export interface HookEntryStrategy {
|
|
132
|
+
type: 'hook';
|
|
133
|
+
manual?: Record<string, string>;
|
|
134
|
+
}
|
|
135
|
+
/** @public */
|
|
136
|
+
export interface SegmentEntryStrategy {
|
|
137
|
+
type: 'segment';
|
|
138
|
+
manual?: Record<string, string>;
|
|
139
|
+
}
|
|
140
|
+
/** @public */
|
|
141
|
+
export interface SingleEntryStrategy {
|
|
142
|
+
type: 'single';
|
|
143
|
+
manual?: Record<string, string>;
|
|
144
|
+
}
|
|
145
|
+
/** @public */
|
|
146
|
+
export interface ComponentEntryStrategy {
|
|
147
|
+
type: 'component';
|
|
148
|
+
manual?: Record<string, string>;
|
|
149
|
+
}
|
|
150
|
+
/** @public */
|
|
151
|
+
export interface SmartEntryStrategy {
|
|
152
|
+
type: 'smart';
|
|
153
|
+
manual?: Record<string, string>;
|
|
154
|
+
}
|
|
155
|
+
/** @public */
|
|
156
|
+
export interface Path {
|
|
157
|
+
resolve(...paths: string[]): string;
|
|
158
|
+
normalize(path: string): string;
|
|
159
|
+
isAbsolute(path: string): boolean;
|
|
160
|
+
join(...paths: string[]): string;
|
|
161
|
+
relative(from: string, to: string): string;
|
|
162
|
+
dirname(path: string): string;
|
|
163
|
+
basename(path: string, ext?: string): string;
|
|
164
|
+
extname(path: string): string;
|
|
165
|
+
format(pathObject: {
|
|
166
|
+
root: string;
|
|
167
|
+
dir: string;
|
|
168
|
+
base: string;
|
|
169
|
+
ext: string;
|
|
170
|
+
name: string;
|
|
171
|
+
}): string;
|
|
172
|
+
parse(path: string): {
|
|
173
|
+
root: string;
|
|
174
|
+
dir: string;
|
|
175
|
+
base: string;
|
|
176
|
+
ext: string;
|
|
177
|
+
name: string;
|
|
178
|
+
};
|
|
179
|
+
readonly sep: string;
|
|
180
|
+
readonly delimiter: string;
|
|
181
|
+
readonly win32: null;
|
|
182
|
+
readonly posix: Path;
|
|
183
|
+
}
|
package/package.json
CHANGED