@utoo/pack 1.4.1 → 1.4.2-alpha.1

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.
@@ -15,5 +15,14 @@ export interface StartServerOptions {
15
15
  hostname?: string;
16
16
  logServerInfo?: boolean;
17
17
  selfSignedCertificate?: SelfSignedCertificate;
18
+ /**
19
+ * Called after the initial dev build has been written and the HTTP server is
20
+ * listening. Integrations can await this instead of polling the internal
21
+ * server port.
22
+ */
23
+ onReady?: (context: {
24
+ port: number;
25
+ hostname: string;
26
+ }) => void | Promise<void>;
18
27
  }
19
28
  export declare function serve(options: BundleOptions | WebpackConfig, projectPath?: string, rootPath?: string, serverOptions?: StartServerOptions): Promise<void>;
@@ -139,7 +139,7 @@ function serve(options, projectPath, rootPath, serverOptions) {
139
139
  }
140
140
  const HMR_PATH = "/turbopack-hmr";
141
141
  async function runDev(options, projectPath, rootPath, serverOptions) {
142
- var _a, _b, _d, _e, _f, _g;
142
+ var _a, _b, _d, _e, _f, _g, _h;
143
143
  (0, common_1.blockStdout)();
144
144
  process.title = "utoopack-dev-server";
145
145
  if (process.env.XCODE_PROFILE) {
@@ -206,6 +206,24 @@ async function runDev(options, projectPath, rootPath, serverOptions) {
206
206
  fetch: app.fetch,
207
207
  });
208
208
  injectWebSocket(server);
209
+ if (!server.listening) {
210
+ await new Promise((resolve, reject) => {
211
+ const onListening = () => {
212
+ server.off("error", onError);
213
+ resolve();
214
+ };
215
+ const onError = (error) => {
216
+ server.off("listening", onListening);
217
+ reject(error);
218
+ };
219
+ server.once("listening", onListening);
220
+ server.once("error", onError);
221
+ });
222
+ }
223
+ await ((_h = serverOptions === null || serverOptions === void 0 ? void 0 : serverOptions.onReady) === null || _h === void 0 ? void 0 : _h.call(serverOptions, {
224
+ port: serveOptsBase.port,
225
+ hostname: serveOptsBase.hostname,
226
+ }));
209
227
  if ((serverOptions === null || serverOptions === void 0 ? void 0 : serverOptions.logServerInfo) !== false) {
210
228
  const scheme = serveOptsBase.serverOptions ? "https" : "http";
211
229
  const displayHost = serveOptsBase.hostname === "0.0.0.0"
@@ -72,6 +72,17 @@
72
72
  }
73
73
  ]
74
74
  },
75
+ "mdx": {
76
+ "description": "Enable Rust MDX transform support",
77
+ "anyOf": [
78
+ {
79
+ "$ref": "#/definitions/SchemaMdxConfigOrBoolean"
80
+ },
81
+ {
82
+ "type": "null"
83
+ }
84
+ ]
85
+ },
75
86
  "mode": {
76
87
  "description": "Build mode",
77
88
  "type": [
@@ -791,7 +802,8 @@
791
802
  "script",
792
803
  "commonjs",
793
804
  "esm",
794
- "global"
805
+ "global",
806
+ "promise"
795
807
  ]
796
808
  },
797
809
  "SchemaExternalUmd": {
@@ -916,6 +928,83 @@
916
928
  }
917
929
  ]
918
930
  },
931
+ "SchemaMdxConfig": {
932
+ "description": "Rust MDX transform options",
933
+ "type": "object",
934
+ "properties": {
935
+ "development": {
936
+ "description": "Whether to compile in development mode",
937
+ "type": [
938
+ "boolean",
939
+ "null"
940
+ ]
941
+ },
942
+ "jsx": {
943
+ "description": "Whether to preserve JSX in the MDX compiler output",
944
+ "type": [
945
+ "boolean",
946
+ "null"
947
+ ]
948
+ },
949
+ "jsxImportSource": {
950
+ "description": "JSX import source to use",
951
+ "type": [
952
+ "string",
953
+ "null"
954
+ ]
955
+ },
956
+ "jsxRuntime": {
957
+ "description": "JSX runtime to use",
958
+ "type": [
959
+ "string",
960
+ "null"
961
+ ]
962
+ },
963
+ "mdxType": {
964
+ "description": "MDX parser mode",
965
+ "anyOf": [
966
+ {
967
+ "$ref": "#/definitions/SchemaMdxParseConstructs"
968
+ },
969
+ {
970
+ "type": "null"
971
+ }
972
+ ]
973
+ },
974
+ "providerImportSource": {
975
+ "description": "Module providing useMDXComponents",
976
+ "type": [
977
+ "string",
978
+ "null"
979
+ ]
980
+ }
981
+ }
982
+ },
983
+ "SchemaMdxConfigOrBoolean": {
984
+ "description": "MDX configuration",
985
+ "anyOf": [
986
+ {
987
+ "description": "Simple boolean to enable/disable the Rust MDX transform",
988
+ "type": "boolean"
989
+ },
990
+ {
991
+ "description": "Advanced MDX transform options",
992
+ "allOf": [
993
+ {
994
+ "$ref": "#/definitions/SchemaMdxConfig"
995
+ }
996
+ ]
997
+ }
998
+ ]
999
+ },
1000
+ "SchemaMdxParseConstructs": {
1001
+ "description": "MDX parser mode",
1002
+ "type": "string",
1003
+ "enum": [
1004
+ "commonmark",
1005
+ "gfm"
1006
+ ]
1007
+ },
919
1008
  "SchemaModularizeImportPackageConfig": {
920
1009
  "description": "Modularize import package configuration",
921
1010
  "type": "object",
@@ -15,5 +15,14 @@ export interface StartServerOptions {
15
15
  hostname?: string;
16
16
  logServerInfo?: boolean;
17
17
  selfSignedCertificate?: SelfSignedCertificate;
18
+ /**
19
+ * Called after the initial dev build has been written and the HTTP server is
20
+ * listening. Integrations can await this instead of polling the internal
21
+ * server port.
22
+ */
23
+ onReady?: (context: {
24
+ port: number;
25
+ hostname: string;
26
+ }) => void | Promise<void>;
18
27
  }
19
28
  export declare function serve(options: BundleOptions | WebpackConfig, projectPath?: string, rootPath?: string, serverOptions?: StartServerOptions): Promise<void>;
@@ -133,7 +133,7 @@ export function serve(options, projectPath, rootPath, serverOptions) {
133
133
  }
134
134
  const HMR_PATH = "/turbopack-hmr";
135
135
  async function runDev(options, projectPath, rootPath, serverOptions) {
136
- var _a, _b, _d, _e, _f, _g;
136
+ var _a, _b, _d, _e, _f, _g, _h;
137
137
  blockStdout();
138
138
  process.title = "utoopack-dev-server";
139
139
  if (process.env.XCODE_PROFILE) {
@@ -200,6 +200,24 @@ async function runDev(options, projectPath, rootPath, serverOptions) {
200
200
  fetch: app.fetch,
201
201
  });
202
202
  injectWebSocket(server);
203
+ if (!server.listening) {
204
+ await new Promise((resolve, reject) => {
205
+ const onListening = () => {
206
+ server.off("error", onError);
207
+ resolve();
208
+ };
209
+ const onError = (error) => {
210
+ server.off("listening", onListening);
211
+ reject(error);
212
+ };
213
+ server.once("listening", onListening);
214
+ server.once("error", onError);
215
+ });
216
+ }
217
+ await ((_h = serverOptions === null || serverOptions === void 0 ? void 0 : serverOptions.onReady) === null || _h === void 0 ? void 0 : _h.call(serverOptions, {
218
+ port: serveOptsBase.port,
219
+ hostname: serveOptsBase.hostname,
220
+ }));
203
221
  if ((serverOptions === null || serverOptions === void 0 ? void 0 : serverOptions.logServerInfo) !== false) {
204
222
  const scheme = serveOptsBase.serverOptions ? "https" : "http";
205
223
  const displayHost = serveOptsBase.hostname === "0.0.0.0"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@utoo/pack",
3
- "version": "1.4.1",
3
+ "version": "1.4.2-alpha.1",
4
4
  "main": "cjs/index.js",
5
5
  "module": "esm/index.js",
6
6
  "types": "esm/index.d.ts",
@@ -41,7 +41,7 @@
41
41
  "@hono/node-server": "^1.19.11",
42
42
  "@hono/node-ws": "^1.3.0",
43
43
  "@swc/helpers": "0.5.15",
44
- "@utoo/pack-shared": "1.4.1",
44
+ "@utoo/pack-shared": "1.4.2-alpha.1",
45
45
  "domparser-rs": "^0.0.7",
46
46
  "find-up": "4.1.0",
47
47
  "get-port": "5.1.1",
@@ -92,12 +92,12 @@
92
92
  },
93
93
  "repository": "git@github.com:utooland/utoo.git",
94
94
  "optionalDependencies": {
95
- "@utoo/pack-darwin-arm64": "1.4.1",
96
- "@utoo/pack-darwin-x64": "1.4.1",
97
- "@utoo/pack-linux-arm64-gnu": "1.4.1",
98
- "@utoo/pack-linux-arm64-musl": "1.4.1",
99
- "@utoo/pack-linux-x64-gnu": "1.4.1",
100
- "@utoo/pack-linux-x64-musl": "1.4.1",
101
- "@utoo/pack-win32-x64-msvc": "1.4.1"
95
+ "@utoo/pack-darwin-arm64": "1.4.2-alpha.1",
96
+ "@utoo/pack-darwin-x64": "1.4.2-alpha.1",
97
+ "@utoo/pack-linux-arm64-gnu": "1.4.2-alpha.1",
98
+ "@utoo/pack-linux-arm64-musl": "1.4.2-alpha.1",
99
+ "@utoo/pack-linux-x64-gnu": "1.4.2-alpha.1",
100
+ "@utoo/pack-linux-x64-musl": "1.4.2-alpha.1",
101
+ "@utoo/pack-win32-x64-msvc": "1.4.2-alpha.1"
102
102
  }
103
103
  }