@utoo/pack 1.1.2-alpha.6 → 1.1.2-lingguang

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.
Files changed (51) hide show
  1. package/README.md +2 -2
  2. package/cjs/index.d.ts +7 -6
  3. package/cjs/index.js +6 -5
  4. package/config_schema.json +1 -1
  5. package/esm/index.d.ts +7 -6
  6. package/esm/index.js +6 -5
  7. package/package.json +19 -18
  8. package/cjs/build.d.ts +0 -3
  9. package/cjs/build.js +0 -82
  10. package/cjs/dev.d.ts +0 -43
  11. package/cjs/dev.js +0 -376
  12. package/cjs/find-root.d.ts +0 -4
  13. package/cjs/find-root.js +0 -75
  14. package/cjs/hmr.d.ts +0 -80
  15. package/cjs/hmr.js +0 -286
  16. package/cjs/loaderWorkerPool.d.ts +0 -1
  17. package/cjs/loaderWorkerPool.js +0 -35
  18. package/cjs/mkcert.d.ts +0 -7
  19. package/cjs/mkcert.js +0 -183
  20. package/cjs/project.d.ts +0 -43
  21. package/cjs/project.js +0 -285
  22. package/cjs/types.d.ts +0 -300
  23. package/cjs/types.js +0 -2
  24. package/cjs/util.d.ts +0 -19
  25. package/cjs/util.js +0 -155
  26. package/cjs/webpackCompat.d.ts +0 -7
  27. package/cjs/webpackCompat.js +0 -408
  28. package/cjs/xcodeProfile.d.ts +0 -1
  29. package/cjs/xcodeProfile.js +0 -16
  30. package/esm/build.d.ts +0 -3
  31. package/esm/build.js +0 -79
  32. package/esm/dev.d.ts +0 -43
  33. package/esm/dev.js +0 -360
  34. package/esm/find-root.d.ts +0 -4
  35. package/esm/find-root.js +0 -66
  36. package/esm/hmr.d.ts +0 -80
  37. package/esm/hmr.js +0 -279
  38. package/esm/loaderWorkerPool.d.ts +0 -1
  39. package/esm/loaderWorkerPool.js +0 -32
  40. package/esm/mkcert.d.ts +0 -7
  41. package/esm/mkcert.js +0 -176
  42. package/esm/project.d.ts +0 -43
  43. package/esm/project.js +0 -247
  44. package/esm/types.d.ts +0 -300
  45. package/esm/types.js +0 -1
  46. package/esm/util.d.ts +0 -19
  47. package/esm/util.js +0 -141
  48. package/esm/webpackCompat.d.ts +0 -7
  49. package/esm/webpackCompat.js +0 -401
  50. package/esm/xcodeProfile.d.ts +0 -1
  51. package/esm/xcodeProfile.js +0 -13
package/README.md CHANGED
@@ -77,7 +77,7 @@ async function startDev() {
77
77
  ### Usage via CLI
78
78
 
79
79
  ```bash
80
- utoo-pack build --webpack
80
+ utoopack build --webpack
81
81
  ```
82
82
 
83
83
  ### Programmatic Usage
@@ -98,7 +98,7 @@ async function run() {
98
98
 
99
99
  ## ⚙️ Configuration
100
100
 
101
- The bundler can be configured via a `project_options.json` or through the programmatic API. Key configuration areas include:
101
+ The bundler can be configured via a `utoopack.json` or through the programmatic API. Key configuration areas include:
102
102
 
103
103
  - **`entry`**: Define your application entry points.
104
104
  - **`define`**: Build-time variable replacement.
package/cjs/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { build } from "./build";
2
- import { serve } from "./dev";
3
- import * as webpackCompat from "./webpackCompat";
1
+ import { build } from "./commands/build";
2
+ import { serve } from "./commands/dev";
3
+ import * as webpackCompat from "./config/webpackCompat";
4
4
  export { build };
5
5
  export { serve };
6
6
  declare const utoopack: {
@@ -8,9 +8,10 @@ declare const utoopack: {
8
8
  serve: typeof serve;
9
9
  };
10
10
  export default utoopack;
11
- export * from "./find-root";
12
- export * from "./types";
13
- export * from "./webpackCompat";
11
+ export * from "./config/types";
12
+ export * from "./config/webpackCompat";
13
+ export * from "./core/types";
14
+ export * from "./utils/find-root";
14
15
  export type WebpackConfig = webpackCompat.WebpackConfig;
15
16
  declare namespace utoopack {
16
17
  type WebpackConfig = webpackCompat.WebpackConfig;
package/cjs/index.js CHANGED
@@ -15,12 +15,13 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.serve = exports.build = void 0;
18
- const build_1 = require("./build");
18
+ const build_1 = require("./commands/build");
19
19
  Object.defineProperty(exports, "build", { enumerable: true, get: function () { return build_1.build; } });
20
- const dev_1 = require("./dev");
20
+ const dev_1 = require("./commands/dev");
21
21
  Object.defineProperty(exports, "serve", { enumerable: true, get: function () { return dev_1.serve; } });
22
22
  const utoopack = { build: build_1.build, serve: dev_1.serve };
23
23
  exports.default = utoopack;
24
- __exportStar(require("./find-root"), exports);
25
- __exportStar(require("./types"), exports);
26
- __exportStar(require("./webpackCompat"), exports);
24
+ __exportStar(require("./config/types"), exports);
25
+ __exportStar(require("./config/webpackCompat"), exports);
26
+ __exportStar(require("./core/types"), exports);
27
+ __exportStar(require("./utils/find-root"), exports);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/draft-07/schema#",
3
3
  "title": "ProjectOptions",
4
- "description": "Top-level project options configuration This represents the root structure of project_options.json",
4
+ "description": "Top-level project options configuration This represents the root structure of utoopack.json",
5
5
  "type": "object",
6
6
  "required": [
7
7
  "config"
package/esm/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { build } from "./build";
2
- import { serve } from "./dev";
3
- import * as webpackCompat from "./webpackCompat";
1
+ import { build } from "./commands/build";
2
+ import { serve } from "./commands/dev";
3
+ import * as webpackCompat from "./config/webpackCompat";
4
4
  export { build };
5
5
  export { serve };
6
6
  declare const utoopack: {
@@ -8,9 +8,10 @@ declare const utoopack: {
8
8
  serve: typeof serve;
9
9
  };
10
10
  export default utoopack;
11
- export * from "./find-root";
12
- export * from "./types";
13
- export * from "./webpackCompat";
11
+ export * from "./config/types";
12
+ export * from "./config/webpackCompat";
13
+ export * from "./core/types";
14
+ export * from "./utils/find-root";
14
15
  export type WebpackConfig = webpackCompat.WebpackConfig;
15
16
  declare namespace utoopack {
16
17
  type WebpackConfig = webpackCompat.WebpackConfig;
package/esm/index.js CHANGED
@@ -1,9 +1,10 @@
1
- import { build } from "./build";
2
- import { serve } from "./dev";
1
+ import { build } from "./commands/build";
2
+ import { serve } from "./commands/dev";
3
3
  export { build };
4
4
  export { serve };
5
5
  const utoopack = { build, serve };
6
6
  export default utoopack;
7
- export * from "./find-root";
8
- export * from "./types";
9
- export * from "./webpackCompat";
7
+ export * from "./config/types";
8
+ export * from "./config/webpackCompat";
9
+ export * from "./core/types";
10
+ export * from "./utils/find-root";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@utoo/pack",
3
- "version": "1.1.2-alpha.6",
3
+ "version": "1.1.2-lingguang",
4
4
  "main": "cjs/index.js",
5
5
  "module": "esm/index.js",
6
6
  "types": "esm/index.d.ts",
@@ -39,33 +39,34 @@
39
39
  },
40
40
  "license": "MIT",
41
41
  "dependencies": {
42
- "@utoo/style-loader": "^1.0.0",
43
- "@utoo/pack-shared": "^0.0.7",
44
42
  "@babel/code-frame": "7.22.5",
45
43
  "@swc/helpers": "0.5.15",
44
+ "@utoo/pack-shared": "^0.0.7",
45
+ "@utoo/style-loader": "^1.0.0",
46
+ "domparser-rs": "^0.0.5",
46
47
  "find-up": "4.1.0",
47
- "loader-runner": "^4.3.0",
48
48
  "less": "^4.0.0",
49
49
  "less-loader": "^12.0.0",
50
+ "loader-runner": "^4.3.0",
50
51
  "nanoid": "^3.3.11",
51
52
  "picocolors": "^1.1.1",
52
53
  "postcss": "8.4.31",
53
54
  "resolve-url-loader": "^5.0.0",
54
55
  "sass": "1.54.0",
55
56
  "sass-loader": "^13.2.0",
56
- "ws": "^8.18.1",
57
- "send": "0.17.1"
57
+ "send": "0.17.1",
58
+ "ws": "^8.18.1"
58
59
  },
59
60
  "devDependencies": {
60
61
  "@napi-rs/cli": "^2.18.0",
61
62
  "@types/babel__code-frame": "7.0.2",
63
+ "@types/mime": "^3.0.4",
64
+ "@types/mime-types": "3.0.1",
62
65
  "@types/node": "^20.3.0",
63
- "styled-jsx": "^5.1.6",
64
- "typescript": "^5.8.3",
65
- "@types/ws": "^8.18.1",
66
66
  "@types/send": "0.14.4",
67
- "@types/mime-types": "3.0.1",
68
- "@types/mime": "^3.0.4"
67
+ "@types/ws": "^8.18.1",
68
+ "styled-jsx": "^5.1.6",
69
+ "typescript": "^5.8.3"
69
70
  },
70
71
  "peerDependencies": {
71
72
  "@types/webpack": "^5.28.5"
@@ -89,12 +90,12 @@
89
90
  },
90
91
  "repository": "git@github.com:utooland/utoo.git",
91
92
  "optionalDependencies": {
92
- "@utoo/pack-darwin-arm64": "1.1.2-alpha.6",
93
- "@utoo/pack-darwin-x64": "1.1.2-alpha.6",
94
- "@utoo/pack-linux-arm64-gnu": "1.1.2-alpha.6",
95
- "@utoo/pack-linux-arm64-musl": "1.1.2-alpha.6",
96
- "@utoo/pack-linux-x64-gnu": "1.1.2-alpha.6",
97
- "@utoo/pack-linux-x64-musl": "1.1.2-alpha.6",
98
- "@utoo/pack-win32-x64-msvc": "1.1.2-alpha.6"
93
+ "@utoo/pack-darwin-arm64": "1.1.2-lingguang",
94
+ "@utoo/pack-darwin-x64": "1.1.2-lingguang",
95
+ "@utoo/pack-linux-arm64-gnu": "1.1.2-lingguang",
96
+ "@utoo/pack-linux-arm64-musl": "1.1.2-lingguang",
97
+ "@utoo/pack-linux-x64-gnu": "1.1.2-lingguang",
98
+ "@utoo/pack-linux-x64-musl": "1.1.2-lingguang",
99
+ "@utoo/pack-win32-x64-msvc": "1.1.2-lingguang"
99
100
  }
100
101
  }
package/cjs/build.d.ts DELETED
@@ -1,3 +0,0 @@
1
- import { BundleOptions } from "./types";
2
- import { WebpackConfig } from "./webpackCompat";
3
- export declare function build(options: BundleOptions | WebpackConfig, projectPath?: string, rootPath?: string): Promise<void>;
package/cjs/build.js DELETED
@@ -1,82 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.build = build;
4
- const pack_shared_1 = require("@utoo/pack-shared");
5
- const child_process_1 = require("child_process");
6
- const fs_1 = require("fs");
7
- const nanoid_1 = require("nanoid");
8
- const path_1 = require("path");
9
- const find_root_1 = require("./find-root");
10
- const project_1 = require("./project");
11
- const util_1 = require("./util");
12
- const webpackCompat_1 = require("./webpackCompat");
13
- const xcodeProfile_1 = require("./xcodeProfile");
14
- function build(options, projectPath, rootPath) {
15
- const bundleOptions = options.webpackMode
16
- ? (0, webpackCompat_1.compatOptionsFromWebpack)(options, projectPath, rootPath)
17
- : options;
18
- if (!rootPath) {
19
- // help user to find the rootDir automatically.
20
- rootPath = (0, find_root_1.findRootDir)(projectPath || process.cwd());
21
- }
22
- return buildInternal(bundleOptions, projectPath, rootPath);
23
- }
24
- async function buildInternal(bundleOptions, projectPath, rootPath) {
25
- var _a, _b, _c, _d;
26
- (0, util_1.blockStdout)();
27
- if (process.env.XCODE_PROFILE) {
28
- await (0, xcodeProfile_1.xcodeProfilingReady)();
29
- }
30
- const createProject = (0, project_1.projectFactory)();
31
- const project = await createProject({
32
- processEnv: (_a = bundleOptions.processEnv) !== null && _a !== void 0 ? _a : {},
33
- defineEnv: (0, util_1.createDefineEnv)({
34
- config: bundleOptions.config,
35
- dev: (_b = bundleOptions.dev) !== null && _b !== void 0 ? _b : false,
36
- optionDefineEnv: bundleOptions.defineEnv,
37
- }),
38
- watch: {
39
- enable: false,
40
- },
41
- dev: (_c = bundleOptions.dev) !== null && _c !== void 0 ? _c : false,
42
- buildId: bundleOptions.buildId || (0, nanoid_1.nanoid)(),
43
- config: {
44
- ...bundleOptions.config,
45
- stats: Boolean(process.env.ANALYZE) || bundleOptions.config.stats,
46
- },
47
- projectPath: projectPath || process.cwd(),
48
- rootPath: rootPath || projectPath || process.cwd(),
49
- packPath: (0, util_1.getPackPath)(),
50
- }, {
51
- persistentCaching: false,
52
- });
53
- const entrypoints = await project.writeAllEntrypointsToDisk();
54
- (0, pack_shared_1.handleIssues)(entrypoints.issues);
55
- if (process.env.ANALYZE) {
56
- await analyzeBundle(((_d = bundleOptions.config.output) === null || _d === void 0 ? void 0 : _d.path) || "dist");
57
- }
58
- await project.shutdown();
59
- // TODO: Maybe run tasks in worker is a better way, see
60
- // https://github.com/vercel/next.js/blob/512d8283054407ab92b2583ecce3b253c3be7b85/packages/next/src/lib/worker.ts
61
- }
62
- async function analyzeBundle(outputPath) {
63
- const statsPath = (0, path_1.join)(outputPath, "stats.json");
64
- if (!(0, fs_1.existsSync)(statsPath)) {
65
- console.warn(`Stats file not found at ${statsPath}. Make sure to enable stats in your configuration.`);
66
- return;
67
- }
68
- return new Promise((resolve, reject) => {
69
- const analyzer = (0, child_process_1.spawn)("npx", ["webpack-bundle-analyzer", statsPath], {
70
- stdio: "inherit",
71
- shell: true,
72
- });
73
- analyzer.on("error", (error) => {
74
- reject(new Error(`Failed to start bundle analyzer: ${error.message}`));
75
- });
76
- analyzer.on("close", () => {
77
- // The analyzer process has finished, so we can resolve the promise
78
- // to allow the build process to exit gracefully.
79
- resolve();
80
- });
81
- });
82
- }
package/cjs/dev.d.ts DELETED
@@ -1,43 +0,0 @@
1
- import { IncomingMessage, ServerResponse } from "http";
2
- import send from "send";
3
- import { Duplex, Writable } from "stream";
4
- import { BundleOptions } from "./types";
5
- import { WebpackConfig } from "./webpackCompat";
6
- export declare function serve(options: BundleOptions | WebpackConfig, projectPath?: string, rootPath?: string, serverOptions?: StartServerOptions): Promise<void>;
7
- export interface SelfSignedCertificate {
8
- key: string;
9
- cert: string;
10
- rootCA?: string;
11
- }
12
- export interface StartServerOptions {
13
- port: number;
14
- https?: boolean;
15
- hostname?: string;
16
- selfSignedCertificate?: SelfSignedCertificate;
17
- }
18
- export type RequestHandler = (req: IncomingMessage, res: ServerResponse) => Promise<void>;
19
- export type UpgradeHandler = (req: IncomingMessage, socket: Duplex, head: Buffer) => Promise<void>;
20
- export type ServerInitResult = {
21
- requestHandler: RequestHandler;
22
- upgradeHandler: UpgradeHandler;
23
- closeUpgraded: () => void;
24
- };
25
- export declare function startServer(serverOptions: StartServerOptions, bundleOptions: BundleOptions, projectPath: string, rootPath?: string): Promise<void>;
26
- export declare function initialize(bundleOptions: BundleOptions, projectPath: string, rootPath?: string): Promise<ServerInitResult>;
27
- export declare function pipeToNodeResponse(readable: ReadableStream<Uint8Array>, res: ServerResponse, waitUntilForEnd?: Promise<unknown>): Promise<void>;
28
- export declare function createAbortController(response: Writable): AbortController;
29
- export declare function isAbortError(e: any): e is Error & {
30
- name: "AbortError";
31
- };
32
- export declare const ResponseAbortedName = "ResponseAborted";
33
- export declare class ResponseAborted extends Error {
34
- readonly name = "ResponseAborted";
35
- }
36
- export declare class DetachedPromise<T = any> {
37
- readonly resolve: (value: T | PromiseLike<T>) => void;
38
- readonly reject: (reason: any) => void;
39
- readonly promise: Promise<T>;
40
- constructor();
41
- }
42
- export declare function serveStatic(req: IncomingMessage, res: ServerResponse, path: string, opts?: Parameters<typeof send>[2]): Promise<void>;
43
- export declare function formatHostname(hostname: string): string;