@utoo/pack 1.1.2 → 1.1.3
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 +2 -2
- package/cjs/index.d.ts +7 -6
- package/cjs/index.js +6 -5
- package/config_schema.json +1 -1
- package/esm/index.d.ts +7 -6
- package/esm/index.js +6 -5
- package/package.json +19 -18
- package/cjs/build.d.ts +0 -3
- package/cjs/build.js +0 -82
- package/cjs/dev.d.ts +0 -43
- package/cjs/dev.js +0 -376
- package/cjs/find-root.d.ts +0 -4
- package/cjs/find-root.js +0 -75
- package/cjs/hmr.d.ts +0 -80
- package/cjs/hmr.js +0 -286
- package/cjs/loaderWorkerPool.d.ts +0 -1
- package/cjs/loaderWorkerPool.js +0 -35
- package/cjs/mkcert.d.ts +0 -7
- package/cjs/mkcert.js +0 -183
- package/cjs/project.d.ts +0 -43
- package/cjs/project.js +0 -285
- package/cjs/types.d.ts +0 -300
- package/cjs/types.js +0 -2
- package/cjs/util.d.ts +0 -19
- package/cjs/util.js +0 -155
- package/cjs/webpackCompat.d.ts +0 -7
- package/cjs/webpackCompat.js +0 -408
- package/cjs/xcodeProfile.d.ts +0 -1
- package/cjs/xcodeProfile.js +0 -16
- package/esm/build.d.ts +0 -3
- package/esm/build.js +0 -79
- package/esm/dev.d.ts +0 -43
- package/esm/dev.js +0 -360
- package/esm/find-root.d.ts +0 -4
- package/esm/find-root.js +0 -66
- package/esm/hmr.d.ts +0 -80
- package/esm/hmr.js +0 -279
- package/esm/loaderWorkerPool.d.ts +0 -1
- package/esm/loaderWorkerPool.js +0 -32
- package/esm/mkcert.d.ts +0 -7
- package/esm/mkcert.js +0 -176
- package/esm/project.d.ts +0 -43
- package/esm/project.js +0 -247
- package/esm/types.d.ts +0 -300
- package/esm/types.js +0 -1
- package/esm/util.d.ts +0 -19
- package/esm/util.js +0 -141
- package/esm/webpackCompat.d.ts +0 -7
- package/esm/webpackCompat.js +0 -401
- package/esm/xcodeProfile.d.ts +0 -1
- package/esm/xcodeProfile.js +0 -13
package/esm/project.js
DELETED
|
@@ -1,247 +0,0 @@
|
|
|
1
|
-
import { isDeepStrictEqual } from "util";
|
|
2
|
-
import * as binding from "./binding";
|
|
3
|
-
import { runLoaderWorkerPool } from "./loaderWorkerPool";
|
|
4
|
-
import { rustifyEnv } from "./util";
|
|
5
|
-
export class TurbopackInternalError extends Error {
|
|
6
|
-
constructor(cause) {
|
|
7
|
-
super(cause.message);
|
|
8
|
-
this.name = "TurbopackInternalError";
|
|
9
|
-
this.stack = cause.stack;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
async function withErrorCause(fn) {
|
|
13
|
-
try {
|
|
14
|
-
return await fn();
|
|
15
|
-
}
|
|
16
|
-
catch (nativeError) {
|
|
17
|
-
throw new TurbopackInternalError(nativeError);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
function ensureLoadersHaveSerializableOptions(turbopackRules) {
|
|
21
|
-
for (const [glob, rule] of Object.entries(turbopackRules)) {
|
|
22
|
-
if (Array.isArray(rule)) {
|
|
23
|
-
checkLoaderItems(rule, glob);
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
checkConfigItem(rule, glob);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
function checkConfigItem(rule, glob) {
|
|
30
|
-
if (!rule)
|
|
31
|
-
return;
|
|
32
|
-
if ("loaders" in rule) {
|
|
33
|
-
checkLoaderItems(rule.loaders, glob);
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
for (const key in rule) {
|
|
37
|
-
const inner = rule[key];
|
|
38
|
-
if (typeof inner === "object" && inner) {
|
|
39
|
-
checkConfigItem(inner, glob);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
function checkLoaderItems(loaderItems, glob) {
|
|
45
|
-
for (const loaderItem of loaderItems) {
|
|
46
|
-
if (typeof loaderItem !== "string" &&
|
|
47
|
-
!isDeepStrictEqual(loaderItem, JSON.parse(JSON.stringify(loaderItem)))) {
|
|
48
|
-
throw new Error(`loader ${loaderItem.loader} for match "${glob}" does not have serializable options. Ensure that options passed are plain JavaScript objects and values.`);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
async function serializeConfig(config) {
|
|
54
|
-
var _a, _b;
|
|
55
|
-
let configSerializable = { ...config };
|
|
56
|
-
if ((_a = configSerializable.module) === null || _a === void 0 ? void 0 : _a.rules) {
|
|
57
|
-
ensureLoadersHaveSerializableOptions(configSerializable.module.rules);
|
|
58
|
-
}
|
|
59
|
-
if (configSerializable.optimization) {
|
|
60
|
-
configSerializable.optimization.modularizeImports =
|
|
61
|
-
configSerializable.optimization &&
|
|
62
|
-
((_b = configSerializable.optimization) === null || _b === void 0 ? void 0 : _b.modularizeImports)
|
|
63
|
-
? Object.fromEntries(Object.entries(configSerializable.optimization.modularizeImports).map(([mod, config]) => [
|
|
64
|
-
mod,
|
|
65
|
-
{
|
|
66
|
-
...config,
|
|
67
|
-
transform: typeof config.transform === "string"
|
|
68
|
-
? config.transform
|
|
69
|
-
: Object.entries(config.transform).map(([key, value]) => [
|
|
70
|
-
key,
|
|
71
|
-
value,
|
|
72
|
-
]),
|
|
73
|
-
},
|
|
74
|
-
]))
|
|
75
|
-
: undefined;
|
|
76
|
-
}
|
|
77
|
-
return JSON.stringify(configSerializable, null, 2);
|
|
78
|
-
}
|
|
79
|
-
async function rustifyPartialProjectOptions(options) {
|
|
80
|
-
return {
|
|
81
|
-
...options,
|
|
82
|
-
config: options.config && (await serializeConfig(options.config)),
|
|
83
|
-
processEnv: options.processEnv && rustifyEnv(options.processEnv),
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
async function rustifyProjectOptions(options) {
|
|
87
|
-
var _a;
|
|
88
|
-
return {
|
|
89
|
-
...options,
|
|
90
|
-
config: await serializeConfig(options.config),
|
|
91
|
-
processEnv: rustifyEnv((_a = options.processEnv) !== null && _a !== void 0 ? _a : {}),
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
export function projectFactory() {
|
|
95
|
-
const cancel = new (class Cancel extends Error {
|
|
96
|
-
})();
|
|
97
|
-
function subscribe(useBuffer, nativeFunction) {
|
|
98
|
-
// A buffer of produced items. This will only contain values if the
|
|
99
|
-
// consumer is slower than the producer.
|
|
100
|
-
let buffer = [];
|
|
101
|
-
// A deferred value waiting for the next produced item. This will only
|
|
102
|
-
// exist if the consumer is faster than the producer.
|
|
103
|
-
let waiting;
|
|
104
|
-
let canceled = false;
|
|
105
|
-
// The native function will call this every time it emits a new result. We
|
|
106
|
-
// either need to notify a waiting consumer, or buffer the new result until
|
|
107
|
-
// the consumer catches up.
|
|
108
|
-
function emitResult(err, value) {
|
|
109
|
-
if (waiting) {
|
|
110
|
-
let { resolve, reject } = waiting;
|
|
111
|
-
waiting = undefined;
|
|
112
|
-
if (err)
|
|
113
|
-
reject(err);
|
|
114
|
-
else
|
|
115
|
-
resolve(value);
|
|
116
|
-
}
|
|
117
|
-
else {
|
|
118
|
-
const item = { err, value };
|
|
119
|
-
if (useBuffer)
|
|
120
|
-
buffer.push(item);
|
|
121
|
-
else
|
|
122
|
-
buffer[0] = item;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
async function* createIterator() {
|
|
126
|
-
const task = await withErrorCause(() => nativeFunction(emitResult));
|
|
127
|
-
try {
|
|
128
|
-
while (!canceled) {
|
|
129
|
-
if (buffer.length > 0) {
|
|
130
|
-
const item = buffer.shift();
|
|
131
|
-
if (item.err)
|
|
132
|
-
throw item.err;
|
|
133
|
-
yield item.value;
|
|
134
|
-
}
|
|
135
|
-
else {
|
|
136
|
-
// eslint-disable-next-line no-loop-func
|
|
137
|
-
yield new Promise((resolve, reject) => {
|
|
138
|
-
waiting = { resolve, reject };
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
catch (e) {
|
|
144
|
-
if (e === cancel)
|
|
145
|
-
return;
|
|
146
|
-
if (e instanceof Error) {
|
|
147
|
-
throw new TurbopackInternalError(e);
|
|
148
|
-
}
|
|
149
|
-
throw e;
|
|
150
|
-
}
|
|
151
|
-
finally {
|
|
152
|
-
if (task) {
|
|
153
|
-
binding.rootTaskDispose(task);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
const iterator = createIterator();
|
|
158
|
-
iterator.return = async () => {
|
|
159
|
-
canceled = true;
|
|
160
|
-
if (waiting)
|
|
161
|
-
waiting.reject(cancel);
|
|
162
|
-
return { value: undefined, done: true };
|
|
163
|
-
};
|
|
164
|
-
return iterator;
|
|
165
|
-
}
|
|
166
|
-
class ProjectImpl {
|
|
167
|
-
constructor(nativeProject) {
|
|
168
|
-
this._nativeProject = nativeProject;
|
|
169
|
-
if (typeof binding.registerWorkerScheduler === "function") {
|
|
170
|
-
runLoaderWorkerPool(binding, require.resolve("@utoo/pack/cjs/binding.js"));
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
async update(options) {
|
|
174
|
-
await withErrorCause(async () => binding.projectUpdate(this._nativeProject, await rustifyPartialProjectOptions(options)));
|
|
175
|
-
}
|
|
176
|
-
async writeAllEntrypointsToDisk() {
|
|
177
|
-
return await withErrorCause(async () => {
|
|
178
|
-
const napiEndpoints = (await binding.projectWriteAllEntrypointsToDisk(this._nativeProject));
|
|
179
|
-
return napiEntrypointsToRawEntrypoints(napiEndpoints);
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
entrypointsSubscribe() {
|
|
183
|
-
const subscription = subscribe(false, async (callback) => binding.projectEntrypointsSubscribe(this._nativeProject, callback));
|
|
184
|
-
return (async function* () {
|
|
185
|
-
for await (const entrypoints of subscription) {
|
|
186
|
-
yield napiEntrypointsToRawEntrypoints(entrypoints);
|
|
187
|
-
}
|
|
188
|
-
})();
|
|
189
|
-
}
|
|
190
|
-
hmrEvents(identifier) {
|
|
191
|
-
return subscribe(true, async (callback) => binding.projectHmrEvents(this._nativeProject, identifier, callback));
|
|
192
|
-
}
|
|
193
|
-
hmrIdentifiersSubscribe() {
|
|
194
|
-
return subscribe(false, async (callback) => binding.projectHmrIdentifiersSubscribe(this._nativeProject, callback));
|
|
195
|
-
}
|
|
196
|
-
traceSource(stackFrame, currentDirectoryFileUrl) {
|
|
197
|
-
return binding.projectTraceSource(this._nativeProject, stackFrame, currentDirectoryFileUrl);
|
|
198
|
-
}
|
|
199
|
-
getSourceForAsset(filePath) {
|
|
200
|
-
return binding.projectGetSourceForAsset(this._nativeProject, filePath);
|
|
201
|
-
}
|
|
202
|
-
getSourceMap(filePath) {
|
|
203
|
-
return binding.projectGetSourceMap(this._nativeProject, filePath);
|
|
204
|
-
}
|
|
205
|
-
getSourceMapSync(filePath) {
|
|
206
|
-
return binding.projectGetSourceMapSync(this._nativeProject, filePath);
|
|
207
|
-
}
|
|
208
|
-
updateInfoSubscribe(aggregationMs) {
|
|
209
|
-
return subscribe(true, async (callback) => binding.projectUpdateInfoSubscribe(this._nativeProject, aggregationMs, callback));
|
|
210
|
-
}
|
|
211
|
-
shutdown() {
|
|
212
|
-
return binding.projectShutdown(this._nativeProject);
|
|
213
|
-
}
|
|
214
|
-
onExit() {
|
|
215
|
-
return binding.projectOnExit(this._nativeProject);
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
class EndpointImpl {
|
|
219
|
-
constructor(nativeEndpoint) {
|
|
220
|
-
this._nativeEndpoint = nativeEndpoint;
|
|
221
|
-
}
|
|
222
|
-
async writeToDisk() {
|
|
223
|
-
return await withErrorCause(() => binding.endpointWriteToDisk(this._nativeEndpoint));
|
|
224
|
-
}
|
|
225
|
-
async clientChanged() {
|
|
226
|
-
const clientSubscription = subscribe(false, async (callback) => binding.endpointClientChangedSubscribe(await this._nativeEndpoint, callback));
|
|
227
|
-
await clientSubscription.next();
|
|
228
|
-
return clientSubscription;
|
|
229
|
-
}
|
|
230
|
-
async serverChanged(includeIssues) {
|
|
231
|
-
const serverSubscription = subscribe(false, async (callback) => binding.endpointServerChangedSubscribe(await this._nativeEndpoint, includeIssues, callback));
|
|
232
|
-
await serverSubscription.next();
|
|
233
|
-
return serverSubscription;
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
function napiEntrypointsToRawEntrypoints(entrypoints) {
|
|
237
|
-
return {
|
|
238
|
-
apps: (entrypoints.apps || []).map((e) => new EndpointImpl(e)),
|
|
239
|
-
libraries: (entrypoints.libraries || []).map((e) => new EndpointImpl(e)),
|
|
240
|
-
issues: entrypoints.issues,
|
|
241
|
-
diagnostics: entrypoints.diagnostics,
|
|
242
|
-
};
|
|
243
|
-
}
|
|
244
|
-
return async function createProject(options, turboEngineOptions) {
|
|
245
|
-
return new ProjectImpl(await binding.projectNew(await rustifyProjectOptions(options), turboEngineOptions || {}));
|
|
246
|
-
};
|
|
247
|
-
}
|
package/esm/types.d.ts
DELETED
|
@@ -1,300 +0,0 @@
|
|
|
1
|
-
import { HmrIdentifiers, NapiDiagnostic, NapiIssue, NapiUpdateMessage, NapiWrittenEndpoint, StackFrame } from "./binding";
|
|
2
|
-
declare global {
|
|
3
|
-
export type TurbopackResult<T = {}> = T & {
|
|
4
|
-
issues: NapiIssue[];
|
|
5
|
-
diagnostics: NapiDiagnostic[];
|
|
6
|
-
};
|
|
7
|
-
export type RefCell = {
|
|
8
|
-
readonly __tag: unique symbol;
|
|
9
|
-
};
|
|
10
|
-
export type ExternalEndpoint = {
|
|
11
|
-
readonly __tag: unique symbol;
|
|
12
|
-
};
|
|
13
|
-
export type RcStr = string;
|
|
14
|
-
}
|
|
15
|
-
export interface BaseUpdate {
|
|
16
|
-
resource: {
|
|
17
|
-
headers: unknown;
|
|
18
|
-
path: string;
|
|
19
|
-
};
|
|
20
|
-
diagnostics: unknown[];
|
|
21
|
-
issues: NapiIssue[];
|
|
22
|
-
}
|
|
23
|
-
export interface IssuesUpdate extends BaseUpdate {
|
|
24
|
-
type: "issues";
|
|
25
|
-
}
|
|
26
|
-
export interface EcmascriptMergedUpdate {
|
|
27
|
-
type: "EcmascriptMergedUpdate";
|
|
28
|
-
chunks: {
|
|
29
|
-
[moduleName: string]: {
|
|
30
|
-
type: "partial";
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
entries: {
|
|
34
|
-
[moduleName: string]: {
|
|
35
|
-
code: string;
|
|
36
|
-
map: string;
|
|
37
|
-
url: string;
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
export interface PartialUpdate extends BaseUpdate {
|
|
42
|
-
type: "partial";
|
|
43
|
-
instruction: {
|
|
44
|
-
type: "ChunkListUpdate";
|
|
45
|
-
merged: EcmascriptMergedUpdate[] | undefined;
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
export type Update = IssuesUpdate | PartialUpdate;
|
|
49
|
-
export type RustifiedEnv = {
|
|
50
|
-
name: string;
|
|
51
|
-
value: string;
|
|
52
|
-
}[];
|
|
53
|
-
export interface EntryOptions {
|
|
54
|
-
name?: string;
|
|
55
|
-
import: string;
|
|
56
|
-
library?: LibraryOptions;
|
|
57
|
-
}
|
|
58
|
-
export interface LibraryOptions {
|
|
59
|
-
name?: string;
|
|
60
|
-
export?: Array<string>;
|
|
61
|
-
}
|
|
62
|
-
export interface DefineEnv {
|
|
63
|
-
client: RustifiedEnv;
|
|
64
|
-
edge: RustifiedEnv;
|
|
65
|
-
nodejs: RustifiedEnv;
|
|
66
|
-
}
|
|
67
|
-
export interface ExperimentalConfig {
|
|
68
|
-
}
|
|
69
|
-
export type TurbopackRuleConfigItem = TurbopackRuleConfigItemOptions | {
|
|
70
|
-
[condition: string]: TurbopackRuleConfigItem;
|
|
71
|
-
} | false;
|
|
72
|
-
/**
|
|
73
|
-
* @deprecated Use `TurbopackRuleConfigItem` instead.
|
|
74
|
-
*/
|
|
75
|
-
export type TurbopackLoaderItem = string | {
|
|
76
|
-
loader: string;
|
|
77
|
-
options: Record<string, JSONValue>;
|
|
78
|
-
};
|
|
79
|
-
export type TurbopackRuleConfigItemOrShortcut = TurbopackLoaderItem[] | TurbopackRuleConfigItem;
|
|
80
|
-
export type TurbopackRuleConfigItemOptions = {
|
|
81
|
-
loaders: TurbopackLoaderItem[];
|
|
82
|
-
as?: string;
|
|
83
|
-
};
|
|
84
|
-
export type TurbopackRuleCondition = {
|
|
85
|
-
path: string | RegExp;
|
|
86
|
-
};
|
|
87
|
-
export interface ModuleOptions {
|
|
88
|
-
rules?: Record<string, TurbopackRuleConfigItem>;
|
|
89
|
-
}
|
|
90
|
-
export interface ResolveOptions {
|
|
91
|
-
alias?: Record<string, string | string[] | Record<string, string | string[]>>;
|
|
92
|
-
extensions?: string[];
|
|
93
|
-
}
|
|
94
|
-
export type ExternalType = "script" | "commonjs" | "esm" | "global";
|
|
95
|
-
export interface ExternalAdvanced {
|
|
96
|
-
root: string;
|
|
97
|
-
type?: ExternalType;
|
|
98
|
-
script?: string;
|
|
99
|
-
}
|
|
100
|
-
export type ExternalConfig = string | ExternalAdvanced;
|
|
101
|
-
/**
|
|
102
|
-
* Provider configuration for automatic module imports.
|
|
103
|
-
* Similar to webpack's ProvidePlugin.
|
|
104
|
-
*
|
|
105
|
-
* @example
|
|
106
|
-
* ```ts
|
|
107
|
-
* provider: {
|
|
108
|
-
* // Provides `$` as `import $ from 'jquery'`
|
|
109
|
-
* $: 'jquery',
|
|
110
|
-
* // Provides `Buffer` as `import { Buffer } from 'buffer'`
|
|
111
|
-
* Buffer: ['buffer', 'Buffer'],
|
|
112
|
-
* }
|
|
113
|
-
* ```
|
|
114
|
-
*/
|
|
115
|
-
export type ProviderConfig = Record<string, string | [string, string]>;
|
|
116
|
-
export interface ConfigComplete {
|
|
117
|
-
entry: EntryOptions[];
|
|
118
|
-
mode?: "production" | "development";
|
|
119
|
-
module?: ModuleOptions;
|
|
120
|
-
resolve?: ResolveOptions;
|
|
121
|
-
externals?: Record<string, ExternalConfig>;
|
|
122
|
-
output?: {
|
|
123
|
-
path?: string;
|
|
124
|
-
type?: "standalone" | "export";
|
|
125
|
-
filename?: string;
|
|
126
|
-
chunkFilename?: string;
|
|
127
|
-
clean?: boolean;
|
|
128
|
-
copy?: Array<{
|
|
129
|
-
from: string;
|
|
130
|
-
to?: string;
|
|
131
|
-
} | string>;
|
|
132
|
-
publicPath?: string;
|
|
133
|
-
};
|
|
134
|
-
target?: string;
|
|
135
|
-
sourceMaps?: boolean;
|
|
136
|
-
define?: Record<string, string>;
|
|
137
|
-
provider?: ProviderConfig;
|
|
138
|
-
optimization?: {
|
|
139
|
-
moduleIds?: "named" | "deterministic";
|
|
140
|
-
minify?: boolean;
|
|
141
|
-
treeShaking?: boolean;
|
|
142
|
-
splitChunks?: Record<"js" | "css", {
|
|
143
|
-
minChunkSize?: number;
|
|
144
|
-
maxChunkCountPerGroup?: number;
|
|
145
|
-
maxMergeChunkSize?: number;
|
|
146
|
-
}>;
|
|
147
|
-
modularizeImports?: Record<string, {
|
|
148
|
-
transform: string | Record<string, string>;
|
|
149
|
-
preventFullImport?: boolean;
|
|
150
|
-
skipDefaultConversion?: boolean;
|
|
151
|
-
handleDefaultImport?: boolean;
|
|
152
|
-
handleNamespaceImport?: boolean;
|
|
153
|
-
style?: string;
|
|
154
|
-
}>;
|
|
155
|
-
packageImports?: string[];
|
|
156
|
-
transpilePackages?: string[];
|
|
157
|
-
removeConsole?: boolean | {
|
|
158
|
-
exclude?: string[];
|
|
159
|
-
};
|
|
160
|
-
concatenateModules?: boolean;
|
|
161
|
-
removeUnusedExports?: boolean;
|
|
162
|
-
nestedAsyncChunking?: boolean;
|
|
163
|
-
wasmAsAsset?: boolean;
|
|
164
|
-
};
|
|
165
|
-
styles?: {
|
|
166
|
-
less?: {
|
|
167
|
-
implementation?: string;
|
|
168
|
-
[key: string]: any;
|
|
169
|
-
};
|
|
170
|
-
sass?: {
|
|
171
|
-
implementation?: string;
|
|
172
|
-
[key: string]: any;
|
|
173
|
-
};
|
|
174
|
-
inlineCss?: {
|
|
175
|
-
insert?: string;
|
|
176
|
-
injectType?: string;
|
|
177
|
-
};
|
|
178
|
-
styledJsx?: boolean | {
|
|
179
|
-
useLightningcss?: boolean;
|
|
180
|
-
};
|
|
181
|
-
styledComponents?: boolean | StyledComponentsConfig;
|
|
182
|
-
emotion?: boolean | EmotionConfig;
|
|
183
|
-
};
|
|
184
|
-
images?: {
|
|
185
|
-
inlineLimit?: number;
|
|
186
|
-
};
|
|
187
|
-
stats?: boolean;
|
|
188
|
-
persistentCaching?: boolean;
|
|
189
|
-
nodePolyfill?: boolean;
|
|
190
|
-
devServer?: {
|
|
191
|
-
hot: boolean;
|
|
192
|
-
};
|
|
193
|
-
cacheHandler?: string;
|
|
194
|
-
experimental?: ExperimentalConfig;
|
|
195
|
-
}
|
|
196
|
-
export interface StyledComponentsConfig {
|
|
197
|
-
/**
|
|
198
|
-
* Enabled by default in development, disabled in production to reduce file size,
|
|
199
|
-
* setting this will override the default for all environments.
|
|
200
|
-
*/
|
|
201
|
-
displayName?: boolean;
|
|
202
|
-
topLevelImportPaths?: string[];
|
|
203
|
-
ssr?: boolean;
|
|
204
|
-
fileName?: boolean;
|
|
205
|
-
meaninglessFileNames?: string[];
|
|
206
|
-
minify?: boolean;
|
|
207
|
-
transpileTemplateLiterals?: boolean;
|
|
208
|
-
namespace?: string;
|
|
209
|
-
pure?: boolean;
|
|
210
|
-
cssProp?: boolean;
|
|
211
|
-
}
|
|
212
|
-
export interface EmotionConfig {
|
|
213
|
-
sourceMap?: boolean;
|
|
214
|
-
autoLabel?: "dev-only" | "always" | "never";
|
|
215
|
-
labelFormat?: string;
|
|
216
|
-
importMap?: {
|
|
217
|
-
[importName: string]: {
|
|
218
|
-
[exportName: string]: {
|
|
219
|
-
canonicalImport?: [string, string];
|
|
220
|
-
styledBaseImport?: [string, string];
|
|
221
|
-
};
|
|
222
|
-
};
|
|
223
|
-
};
|
|
224
|
-
}
|
|
225
|
-
export type JSONValue = string | number | boolean | JSONValue[] | {
|
|
226
|
-
[k: string]: JSONValue;
|
|
227
|
-
};
|
|
228
|
-
export interface ProjectOptions {
|
|
229
|
-
/**
|
|
230
|
-
* A root path from which all files must be nested under. Trying to access
|
|
231
|
-
* a file outside this root will fail. Think of this as a chroot.
|
|
232
|
-
*/
|
|
233
|
-
rootPath: string;
|
|
234
|
-
/**
|
|
235
|
-
* A path inside the root_path which contains the app/pages directories.
|
|
236
|
-
*/
|
|
237
|
-
projectPath: string;
|
|
238
|
-
/**
|
|
239
|
-
* The utoo pack configs.
|
|
240
|
-
*/
|
|
241
|
-
config: ConfigComplete;
|
|
242
|
-
/**
|
|
243
|
-
* A map of environment variables to use when compiling code.
|
|
244
|
-
*/
|
|
245
|
-
processEnv?: Record<string, string>;
|
|
246
|
-
defineEnv?: DefineEnv;
|
|
247
|
-
/**
|
|
248
|
-
* Whether to watch the filesystem for file changes.
|
|
249
|
-
*/
|
|
250
|
-
watch?: {
|
|
251
|
-
enable: boolean;
|
|
252
|
-
pollIntervalMs?: number;
|
|
253
|
-
};
|
|
254
|
-
/**
|
|
255
|
-
* The mode of utoo-pack.
|
|
256
|
-
*/
|
|
257
|
-
dev?: boolean;
|
|
258
|
-
/**
|
|
259
|
-
* The build id.
|
|
260
|
-
*/
|
|
261
|
-
buildId?: string;
|
|
262
|
-
/**
|
|
263
|
-
* Absolute path for `@utoo/pack`.
|
|
264
|
-
*/
|
|
265
|
-
packPath?: string;
|
|
266
|
-
}
|
|
267
|
-
export type BundleOptions = Omit<ProjectOptions, "rootPath" | "projectPath">;
|
|
268
|
-
export interface Project {
|
|
269
|
-
update(options: Partial<ProjectOptions>): Promise<void>;
|
|
270
|
-
entrypointsSubscribe(): AsyncIterableIterator<TurbopackResult<RawEntrypoints>>;
|
|
271
|
-
hmrEvents(identifier: string): AsyncIterableIterator<TurbopackResult<Update>>;
|
|
272
|
-
hmrIdentifiersSubscribe(): AsyncIterableIterator<TurbopackResult<HmrIdentifiers>>;
|
|
273
|
-
getSourceForAsset(filePath: string): Promise<string | null>;
|
|
274
|
-
getSourceMap(filePath: string): Promise<string | null>;
|
|
275
|
-
getSourceMapSync(filePath: string): string | null;
|
|
276
|
-
traceSource(stackFrame: StackFrame, currentDirectoryFileUrl: string): Promise<StackFrame | null>;
|
|
277
|
-
updateInfoSubscribe(aggregationMs: number): AsyncIterableIterator<TurbopackResult<NapiUpdateMessage>>;
|
|
278
|
-
shutdown(): Promise<void>;
|
|
279
|
-
onExit(): Promise<void>;
|
|
280
|
-
}
|
|
281
|
-
export interface RawEntrypoints {
|
|
282
|
-
apps?: Endpoint[];
|
|
283
|
-
libraries?: Endpoint[];
|
|
284
|
-
}
|
|
285
|
-
export interface Endpoint {
|
|
286
|
-
/** Write files for the endpoint to disk. */
|
|
287
|
-
writeToDisk(): Promise<TurbopackResult<NapiWrittenEndpoint>>;
|
|
288
|
-
/**
|
|
289
|
-
* Listen to client-side changes to the endpoint.
|
|
290
|
-
* After clientChanged() has been awaited it will listen to changes.
|
|
291
|
-
* The async iterator will yield for each change.
|
|
292
|
-
*/
|
|
293
|
-
clientChanged(): Promise<AsyncIterableIterator<TurbopackResult>>;
|
|
294
|
-
/**
|
|
295
|
-
* Listen to server-side changes to the endpoint.
|
|
296
|
-
* After serverChanged() has been awaited it will listen to changes.
|
|
297
|
-
* The async iterator will yield for each change.
|
|
298
|
-
*/
|
|
299
|
-
serverChanged(includeIssues: boolean): Promise<AsyncIterableIterator<TurbopackResult>>;
|
|
300
|
-
}
|
package/esm/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/esm/util.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { NapiIssue } from "./binding";
|
|
2
|
-
import { ConfigComplete, DefineEnv, RustifiedEnv } from "./types";
|
|
3
|
-
export declare class ModuleBuildError extends Error {
|
|
4
|
-
name: string;
|
|
5
|
-
}
|
|
6
|
-
export declare function processIssues(result: TurbopackResult, throwIssue: boolean, logErrors: boolean): void;
|
|
7
|
-
export declare function isWellKnownError(issue: NapiIssue): boolean;
|
|
8
|
-
export declare function rustifyEnv(env: Record<string, string>): RustifiedEnv;
|
|
9
|
-
interface DefineEnvOptions {
|
|
10
|
-
config: ConfigComplete;
|
|
11
|
-
dev: boolean;
|
|
12
|
-
optionDefineEnv?: DefineEnv;
|
|
13
|
-
}
|
|
14
|
-
export declare function createDefineEnv(options: DefineEnvOptions): DefineEnv;
|
|
15
|
-
type AnyFunc<T> = (this: T, ...args: any) => any;
|
|
16
|
-
export declare function debounce<T, F extends AnyFunc<T>>(fn: F, ms: number, maxWait?: number): (this: T, ...passedArgs: Parameters<F>) => void;
|
|
17
|
-
export declare function blockStdout(): void;
|
|
18
|
-
export declare function getPackPath(): string;
|
|
19
|
-
export {};
|