@utoo/pack 0.0.1-alpha.49 → 0.0.1-alpha.50
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/binding.d.ts +2 -6
- package/cjs/build.js +1 -0
- package/cjs/dev.js +4 -1
- package/cjs/hmr.js +1 -0
- package/cjs/types.d.ts +4 -0
- package/cjs/util.d.ts +1 -0
- package/cjs/util.js +8 -0
- package/esm/binding.d.ts +2 -6
- package/esm/build.js +2 -1
- package/esm/dev.js +5 -2
- package/esm/hmr.js +2 -1
- package/esm/types.d.ts +4 -0
- package/esm/util.d.ts +1 -0
- package/esm/util.js +4 -0
- package/package.json +8 -8
package/cjs/binding.d.ts
CHANGED
|
@@ -9,12 +9,6 @@ export declare class ExternalObject<T> {
|
|
|
9
9
|
[K: symbol]: T
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
|
-
export interface TransformOutput {
|
|
13
|
-
code: string
|
|
14
|
-
map?: string
|
|
15
|
-
output?: string
|
|
16
|
-
diagnostics: Array<string>
|
|
17
|
-
}
|
|
18
12
|
export interface NapiEndpointConfig {
|
|
19
13
|
|
|
20
14
|
}
|
|
@@ -68,6 +62,7 @@ export interface NapiProjectOptions {
|
|
|
68
62
|
dev: boolean
|
|
69
63
|
/** The build id. */
|
|
70
64
|
buildId: string
|
|
65
|
+
packPath: string
|
|
71
66
|
}
|
|
72
67
|
/** [NapiProjectOptions] with all fields optional. */
|
|
73
68
|
export interface NapiPartialProjectOptions {
|
|
@@ -99,6 +94,7 @@ export interface NapiPartialProjectOptions {
|
|
|
99
94
|
* debugging/profiling purposes.
|
|
100
95
|
*/
|
|
101
96
|
noMangling?: boolean
|
|
97
|
+
packPath?: string
|
|
102
98
|
}
|
|
103
99
|
export interface NapiDefineEnv {
|
|
104
100
|
client: Array<NapiEnvVar>
|
package/cjs/build.js
CHANGED
package/cjs/dev.js
CHANGED
|
@@ -47,7 +47,10 @@ async function serveInternal(options, projectPath, rootPath, serverOptions) {
|
|
|
47
47
|
selfSignedCertificate: (serverOptions === null || serverOptions === void 0 ? void 0 : serverOptions.https)
|
|
48
48
|
? await (0, mkcert_1.createSelfSignedCertificate)((serverOptions === null || serverOptions === void 0 ? void 0 : serverOptions.hostname) || "localhost")
|
|
49
49
|
: undefined,
|
|
50
|
-
},
|
|
50
|
+
}, {
|
|
51
|
+
...options,
|
|
52
|
+
packPath: (0, util_1.getPackPath)(),
|
|
53
|
+
}, projectPath || process.cwd(), rootPath);
|
|
51
54
|
}
|
|
52
55
|
async function startServer(serverOptions, bundleOptions, projectPath, rootPath) {
|
|
53
56
|
let { port, hostname, selfSignedCertificate } = serverOptions;
|
package/cjs/hmr.js
CHANGED
|
@@ -38,6 +38,7 @@ async function createHotReloader(bundleOptions, projectPath, rootPath) {
|
|
|
38
38
|
},
|
|
39
39
|
projectPath: projectPath || process.cwd(),
|
|
40
40
|
rootPath: rootPath || projectPath || process.cwd(),
|
|
41
|
+
packPath: (0, util_1.getPackPath)(),
|
|
41
42
|
}, {
|
|
42
43
|
persistentCaching: true,
|
|
43
44
|
});
|
package/cjs/types.d.ts
CHANGED
|
@@ -235,6 +235,10 @@ export interface ProjectOptions {
|
|
|
235
235
|
* The build id.
|
|
236
236
|
*/
|
|
237
237
|
buildId?: string;
|
|
238
|
+
/**
|
|
239
|
+
* Absolute path for `@utoo/pack`.
|
|
240
|
+
*/
|
|
241
|
+
packPath?: string;
|
|
238
242
|
}
|
|
239
243
|
export type BundleOptions = Omit<ProjectOptions, "rootPath" | "projectPath">;
|
|
240
244
|
export interface Project {
|
package/cjs/util.d.ts
CHANGED
|
@@ -18,4 +18,5 @@ export declare function createDefineEnv(options: DefineEnvOptions): DefineEnv;
|
|
|
18
18
|
type AnyFunc<T> = (this: T, ...args: any) => any;
|
|
19
19
|
export declare function debounce<T, F extends AnyFunc<T>>(fn: F, ms: number, maxWait?: number): (this: T, ...passedArgs: Parameters<F>) => void;
|
|
20
20
|
export declare function blockStdout(): void;
|
|
21
|
+
export declare function getPackPath(): string;
|
|
21
22
|
export {};
|
package/cjs/util.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.ModuleBuildError = void 0;
|
|
4
7
|
exports.processIssues = processIssues;
|
|
@@ -10,9 +13,11 @@ exports.rustifyEnv = rustifyEnv;
|
|
|
10
13
|
exports.createDefineEnv = createDefineEnv;
|
|
11
14
|
exports.debounce = debounce;
|
|
12
15
|
exports.blockStdout = blockStdout;
|
|
16
|
+
exports.getPackPath = getPackPath;
|
|
13
17
|
const code_frame_1 = require("@babel/code-frame");
|
|
14
18
|
const picocolors_1 = require("picocolors");
|
|
15
19
|
const magicIdentifier_1 = require("./magicIdentifier");
|
|
20
|
+
const path_1 = __importDefault(require("path"));
|
|
16
21
|
class ModuleBuildError extends Error {
|
|
17
22
|
constructor() {
|
|
18
23
|
super(...arguments);
|
|
@@ -238,3 +243,6 @@ function blockStdout() {
|
|
|
238
243
|
process.stderr._handle.setBlocking(true);
|
|
239
244
|
}
|
|
240
245
|
}
|
|
246
|
+
function getPackPath() {
|
|
247
|
+
return path_1.default.resolve(__dirname, '..');
|
|
248
|
+
}
|
package/esm/binding.d.ts
CHANGED
|
@@ -9,12 +9,6 @@ export declare class ExternalObject<T> {
|
|
|
9
9
|
[K: symbol]: T
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
|
-
export interface TransformOutput {
|
|
13
|
-
code: string
|
|
14
|
-
map?: string
|
|
15
|
-
output?: string
|
|
16
|
-
diagnostics: Array<string>
|
|
17
|
-
}
|
|
18
12
|
export interface NapiEndpointConfig {
|
|
19
13
|
|
|
20
14
|
}
|
|
@@ -68,6 +62,7 @@ export interface NapiProjectOptions {
|
|
|
68
62
|
dev: boolean
|
|
69
63
|
/** The build id. */
|
|
70
64
|
buildId: string
|
|
65
|
+
packPath: string
|
|
71
66
|
}
|
|
72
67
|
/** [NapiProjectOptions] with all fields optional. */
|
|
73
68
|
export interface NapiPartialProjectOptions {
|
|
@@ -99,6 +94,7 @@ export interface NapiPartialProjectOptions {
|
|
|
99
94
|
* debugging/profiling purposes.
|
|
100
95
|
*/
|
|
101
96
|
noMangling?: boolean
|
|
97
|
+
packPath?: string
|
|
102
98
|
}
|
|
103
99
|
export interface NapiDefineEnv {
|
|
104
100
|
client: Array<NapiEnvVar>
|
package/esm/build.js
CHANGED
|
@@ -4,7 +4,7 @@ import { nanoid } from "nanoid";
|
|
|
4
4
|
import { join } from "path";
|
|
5
5
|
import { findRootDir } from "./find-root";
|
|
6
6
|
import { projectFactory } from "./project";
|
|
7
|
-
import { blockStdout, createDefineEnv, formatIssue, isRelevantWarning, } from "./util";
|
|
7
|
+
import { blockStdout, createDefineEnv, formatIssue, isRelevantWarning, getPackPath, } from "./util";
|
|
8
8
|
import { compatOptionsFromWebpack } from "./webpackCompat";
|
|
9
9
|
import { xcodeProfilingReady } from "./xcodeProfile";
|
|
10
10
|
export function build(options, projectPath, rootPath) {
|
|
@@ -42,6 +42,7 @@ async function buildInternal(bundleOptions, projectPath, rootPath) {
|
|
|
42
42
|
},
|
|
43
43
|
projectPath: projectPath || process.cwd(),
|
|
44
44
|
rootPath: rootPath || projectPath || process.cwd(),
|
|
45
|
+
packPath: getPackPath(),
|
|
45
46
|
}, {
|
|
46
47
|
persistentCaching: false,
|
|
47
48
|
});
|
package/esm/dev.js
CHANGED
|
@@ -8,7 +8,7 @@ import url from "url";
|
|
|
8
8
|
import { findRootDir } from "./find-root";
|
|
9
9
|
import { createHotReloader } from "./hmr";
|
|
10
10
|
import { createSelfSignedCertificate } from "./mkcert";
|
|
11
|
-
import { blockStdout } from "./util";
|
|
11
|
+
import { blockStdout, getPackPath } from "./util";
|
|
12
12
|
import { compatOptionsFromWebpack } from "./webpackCompat";
|
|
13
13
|
import { xcodeProfilingReady } from "./xcodeProfile";
|
|
14
14
|
export function serve(options, projectPath, rootPath, serverOptions) {
|
|
@@ -33,7 +33,10 @@ async function serveInternal(options, projectPath, rootPath, serverOptions) {
|
|
|
33
33
|
selfSignedCertificate: (serverOptions === null || serverOptions === void 0 ? void 0 : serverOptions.https)
|
|
34
34
|
? await createSelfSignedCertificate((serverOptions === null || serverOptions === void 0 ? void 0 : serverOptions.hostname) || "localhost")
|
|
35
35
|
: undefined,
|
|
36
|
-
},
|
|
36
|
+
}, {
|
|
37
|
+
...options,
|
|
38
|
+
packPath: getPackPath(),
|
|
39
|
+
}, projectPath || process.cwd(), rootPath);
|
|
37
40
|
}
|
|
38
41
|
export async function startServer(serverOptions, bundleOptions, projectPath, rootPath) {
|
|
39
42
|
let { port, hostname, selfSignedCertificate } = serverOptions;
|
package/esm/hmr.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { nanoid } from "nanoid";
|
|
2
2
|
import ws from "ws";
|
|
3
3
|
import { projectFactory } from "./project";
|
|
4
|
-
import { createDefineEnv, debounce, processIssues } from "./util";
|
|
4
|
+
import { createDefineEnv, debounce, getPackPath, processIssues } from "./util";
|
|
5
5
|
const wsServer = new ws.Server({ noServer: true });
|
|
6
6
|
const sessionId = Math.floor(Number.MAX_SAFE_INTEGER * Math.random());
|
|
7
7
|
export const FAST_REFRESH_RUNTIME_RELOAD = "Fast Refresh had to perform a full reload due to a runtime error.";
|
|
@@ -31,6 +31,7 @@ export async function createHotReloader(bundleOptions, projectPath, rootPath) {
|
|
|
31
31
|
},
|
|
32
32
|
projectPath: projectPath || process.cwd(),
|
|
33
33
|
rootPath: rootPath || projectPath || process.cwd(),
|
|
34
|
+
packPath: getPackPath(),
|
|
34
35
|
}, {
|
|
35
36
|
persistentCaching: true,
|
|
36
37
|
});
|
package/esm/types.d.ts
CHANGED
|
@@ -235,6 +235,10 @@ export interface ProjectOptions {
|
|
|
235
235
|
* The build id.
|
|
236
236
|
*/
|
|
237
237
|
buildId?: string;
|
|
238
|
+
/**
|
|
239
|
+
* Absolute path for `@utoo/pack`.
|
|
240
|
+
*/
|
|
241
|
+
packPath?: string;
|
|
238
242
|
}
|
|
239
243
|
export type BundleOptions = Omit<ProjectOptions, "rootPath" | "projectPath">;
|
|
240
244
|
export interface Project {
|
package/esm/util.d.ts
CHANGED
|
@@ -18,4 +18,5 @@ export declare function createDefineEnv(options: DefineEnvOptions): DefineEnv;
|
|
|
18
18
|
type AnyFunc<T> = (this: T, ...args: any) => any;
|
|
19
19
|
export declare function debounce<T, F extends AnyFunc<T>>(fn: F, ms: number, maxWait?: number): (this: T, ...passedArgs: Parameters<F>) => void;
|
|
20
20
|
export declare function blockStdout(): void;
|
|
21
|
+
export declare function getPackPath(): string;
|
|
21
22
|
export {};
|
package/esm/util.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { codeFrameColumns } from "@babel/code-frame";
|
|
2
2
|
import { bold, green, magenta, red } from "picocolors";
|
|
3
3
|
import { decodeMagicIdentifier, MAGIC_IDENTIFIER_REGEX, } from "./magicIdentifier";
|
|
4
|
+
import path from 'path';
|
|
4
5
|
export class ModuleBuildError extends Error {
|
|
5
6
|
constructor() {
|
|
6
7
|
super(...arguments);
|
|
@@ -225,3 +226,6 @@ export function blockStdout() {
|
|
|
225
226
|
process.stderr._handle.setBlocking(true);
|
|
226
227
|
}
|
|
227
228
|
}
|
|
229
|
+
export function getPackPath() {
|
|
230
|
+
return path.resolve(__dirname, '..');
|
|
231
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@utoo/pack",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.50",
|
|
4
4
|
"main": "cjs/index.js",
|
|
5
5
|
"module": "esm/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -85,12 +85,12 @@
|
|
|
85
85
|
},
|
|
86
86
|
"repository": "git@github.com:utooland/utoo.git",
|
|
87
87
|
"optionalDependencies": {
|
|
88
|
-
"@utoo/pack-darwin-arm64": "0.0.1-alpha.
|
|
89
|
-
"@utoo/pack-darwin-x64": "0.0.1-alpha.
|
|
90
|
-
"@utoo/pack-linux-arm64-gnu": "0.0.1-alpha.
|
|
91
|
-
"@utoo/pack-linux-arm64-musl": "0.0.1-alpha.
|
|
92
|
-
"@utoo/pack-linux-x64-gnu": "0.0.1-alpha.
|
|
93
|
-
"@utoo/pack-linux-x64-musl": "0.0.1-alpha.
|
|
94
|
-
"@utoo/pack-win32-x64-msvc": "0.0.1-alpha.
|
|
88
|
+
"@utoo/pack-darwin-arm64": "0.0.1-alpha.50",
|
|
89
|
+
"@utoo/pack-darwin-x64": "0.0.1-alpha.50",
|
|
90
|
+
"@utoo/pack-linux-arm64-gnu": "0.0.1-alpha.50",
|
|
91
|
+
"@utoo/pack-linux-arm64-musl": "0.0.1-alpha.50",
|
|
92
|
+
"@utoo/pack-linux-x64-gnu": "0.0.1-alpha.50",
|
|
93
|
+
"@utoo/pack-linux-x64-musl": "0.0.1-alpha.50",
|
|
94
|
+
"@utoo/pack-win32-x64-msvc": "0.0.1-alpha.50"
|
|
95
95
|
}
|
|
96
96
|
}
|