rollipop 1.0.0-beta.1 → 1.0.0-beta.2

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 CHANGED
@@ -1 +1,5 @@
1
1
  # rollipop
2
+
3
+ React Native build toolkit powered by Rolldown.
4
+
5
+ [Installation](https://rollipop.dev/docs/get-started/quick-start) · [Configuration](https://rollipop.dev/docs/get-started/configuration) · [CLI](https://rollipop.dev/docs/get-started/cli-commands)
@@ -2,7 +2,8 @@ import { stripFlowTypes } from "../common/transformer.js";
2
2
  import { DEFAULT_ANALYZE_FILE, DEFAULT_ANALYZE_REPORT_FILE, DEFAULT_ASSET_EXTENSIONS, DEFAULT_ENV_FILE, DEFAULT_ENV_PREFIX, DEFAULT_HMR_CLIENT_PATH, DEFAULT_RESOLVER_ALIAS_FIELDS, DEFAULT_RESOLVER_CONDITION_NAMES, DEFAULT_RESOLVER_MAIN_FIELDS, DEFAULT_RUNTIME_TARGET, DEFAULT_SOURCE_EXTENSIONS } from "../constants.js";
3
3
  import { ClientLogReporter } from "../events/builtin-reporters.js";
4
4
  import { resolvePackagePath } from "../utils/node-resolve.js";
5
- import { resolveAssetRegistryPath, resolveInitializeCorePath, resolvePolyfillScriptPaths } from "../internal/react-native.js";
5
+ import { resolveReactNativeRuntime } from "../internal/react-native/runtime.js";
6
+ import "../internal/react-native.js";
6
7
  import fs from "node:fs";
7
8
  //#region src/config/defaults.ts
8
9
  async function getDefaultConfig(projectRoot, mode) {
@@ -12,6 +13,7 @@ async function getDefaultConfig(projectRoot, mode) {
12
13
  } catch {
13
14
  throw new Error(`Could not resolve 'react-native' package path. Please check your project path.`);
14
15
  }
16
+ const runtime = resolveReactNativeRuntime(projectRoot, reactNativePath);
15
17
  return {
16
18
  root: projectRoot,
17
19
  mode: mode ?? "development",
@@ -26,8 +28,8 @@ async function getDefaultConfig(projectRoot, mode) {
26
28
  symlinks: true
27
29
  },
28
30
  transform: { swc: { native: { externalHelpers: true } } },
29
- prelude: [resolveInitializeCorePath(projectRoot)],
30
- polyfills: await Promise.all(resolvePolyfillScriptPaths(projectRoot, reactNativePath).map(async (path) => {
31
+ prelude: runtime.prelude,
32
+ polyfills: await Promise.all(runtime.polyfills.map(async (path) => {
31
33
  const code = fs.readFileSync(path, "utf-8");
32
34
  return {
33
35
  type: "iife",
@@ -38,7 +40,7 @@ async function getDefaultConfig(projectRoot, mode) {
38
40
  treeshake: true,
39
41
  reactNative: {
40
42
  reactNativePath,
41
- assetRegistryPath: resolveAssetRegistryPath(projectRoot),
43
+ assetRegistryPath: runtime.assetRegistryPath,
42
44
  hmrClientPath: DEFAULT_HMR_CLIENT_PATH
43
45
  },
44
46
  dev: {
package/dist/constants.js CHANGED
@@ -20,7 +20,7 @@ var constants_exports = /* @__PURE__ */ __exportAll({
20
20
  ROLLIPOP_VIRTUAL_ENTRY_ID: () => ROLLIPOP_VIRTUAL_ENTRY_ID,
21
21
  ROLLIPOP_VIRTUAL_PREFIX: () => ROLLIPOP_VIRTUAL_PREFIX
22
22
  });
23
- const ROLLIPOP_VERSION = "1.0.0-beta.1";
23
+ const ROLLIPOP_VERSION = "1.0.0-beta.2";
24
24
  const ROLLIPOP_VIRTUAL_PREFIX = "\0rollipop/";
25
25
  const ROLLIPOP_VIRTUAL_BOOTSTRAP_ID = `${ROLLIPOP_VIRTUAL_PREFIX}bootstrap`;
26
26
  const ROLLIPOP_VIRTUAL_ENTRY_ID = `${ROLLIPOP_VIRTUAL_PREFIX}entry`;
@@ -28,4 +28,5 @@ export type Plugin = Omit<rolldown.Plugin, InternalRolldownHook> & {
28
28
  configureServer?: (this: PluginContext, server: DevServer) => AsyncResult<void | (() => AsyncResult<void>)>;
29
29
  devtools?: DevToolsPluginOptions;
30
30
  };
31
- //#endregion
31
+ //#endregion
32
+ export {};
@@ -90,4 +90,5 @@ type MetroCompatibleEvent = {
90
90
  bundlerId?: string;
91
91
  };
92
92
  export type ReportableEvent = InternalEvent | MetroCompatibleEvent;
93
- //#endregion
93
+ //#endregion
94
+ export {};
@@ -1,14 +1,14 @@
1
1
  var __rolldown_runtime__ = (function() {
2
2
  //#region \0rolldown/runtime.js
3
- function e$1(e) {
3
+ function r$1(r) {
4
4
  "@swc/helpers - typeof";
5
- return e && typeof Symbol !== "undefined" && e.constructor === Symbol ? "symbol" : typeof e;
5
+ return r && typeof Symbol !== "undefined" && r.constructor === Symbol ? "symbol" : typeof r;
6
6
  }
7
7
  var __create = Object.create;
8
8
  var __defProp = Object.defineProperty;
9
- var __name = function e(e, r) {
10
- return __defProp(e, "name", {
11
- value: r,
9
+ var __name = function r(r, e) {
10
+ return __defProp(r, "name", {
11
+ value: e,
12
12
  configurable: true
13
13
  });
14
14
  };
@@ -16,94 +16,127 @@ var __rolldown_runtime__ = (function() {
16
16
  var __getOwnPropNames = Object.getOwnPropertyNames;
17
17
  var __getProtoOf = Object.getPrototypeOf;
18
18
  var __hasOwnProp = Object.prototype.hasOwnProperty;
19
- var __esm = function e(e, r, t) {
19
+ var __esm = function r(r, e, t) {
20
20
  return function() {
21
21
  if (t) throw t[0];
22
22
  try {
23
- return e && (r = (0, e[__getOwnPropNames(e)[0]])(e = 0)), r;
24
- } catch (e) {
25
- throw t = [e], e;
23
+ return r && (e = (0, r[__getOwnPropNames(r)[0]])(r = 0)), e;
24
+ } catch (r) {
25
+ throw t = [r], r;
26
26
  }
27
27
  };
28
28
  };
29
- var __esmMin = function e(e, r, t) {
29
+ var __esmMin = function r(r, e, t) {
30
30
  return function() {
31
31
  if (t) throw t[0];
32
32
  try {
33
- return e && (r = e(e = 0)), r;
34
- } catch (e) {
35
- throw t = [e], e;
33
+ return r && (e = r(r = 0)), e;
34
+ } catch (r) {
35
+ throw t = [r], r;
36
36
  }
37
37
  };
38
38
  };
39
- var __commonJS = function e(e, r) {
39
+ var __commonJS = function r(r, e) {
40
40
  return function() {
41
- return r || ((0, e[__getOwnPropNames(e)[0]])((r = { exports: {} }).exports, r), e = null), r.exports;
41
+ return e || ((0, r[__getOwnPropNames(r)[0]])((e = { exports: {} }).exports, e, e.exports), r = null), e.exports;
42
42
  };
43
43
  };
44
- var __commonJSMin = function e(e, r) {
44
+ var __commonJSMin = function r(r, e) {
45
45
  return function() {
46
- return r || (e((r = { exports: {} }).exports, r), e = null), r.exports;
46
+ return e || (r((e = { exports: {} }).exports, e, e.exports), r = null), e.exports;
47
47
  };
48
48
  };
49
- var __exportAll = function e(e, r) {
49
+ var __exportAll = function r(r, e) {
50
50
  var t = {};
51
- for (var o in e) __defProp(t, o, {
52
- get: e[o],
51
+ for (var o in r) __defProp(t, o, {
52
+ get: r[o],
53
53
  enumerable: true
54
54
  });
55
- if (!r) __defProp(t, Symbol.toStringTag, { value: "Module" });
55
+ if (!e) __defProp(t, Symbol.toStringTag, { value: "Module" });
56
56
  return t;
57
57
  };
58
- var __copyProps = function r(r, t, o, n) {
59
- if (t && (typeof t === "undefined" ? "undefined" : e$1(t)) === "object" || typeof t === "function") for (var u = __getOwnPropNames(t), _ = 0, p = u.length, a; _ < p; _++) {
60
- a = u[_];
61
- if (!__hasOwnProp.call(r, a) && a !== o) __defProp(r, a, {
62
- get: (function(e) {
63
- return t[e];
64
- }).bind(null, a),
65
- enumerable: !(n = __getOwnPropDesc(t, a)) || n.enumerable
58
+ var __copyProps = function e(e, t, o, n) {
59
+ if (t && (typeof t === "undefined" ? "undefined" : r$1(t)) === "object" || typeof t === "function") for (var _ = __getOwnPropNames(t), a = 0, u = _.length, p; a < u; a++) {
60
+ p = _[a];
61
+ if (!__hasOwnProp.call(e, p) && p !== o) __defProp(e, p, {
62
+ get: (function(r) {
63
+ return t[r];
64
+ }).bind(null, p),
65
+ enumerable: !(n = __getOwnPropDesc(t, p)) || n.enumerable
66
66
  });
67
67
  }
68
- return r;
68
+ return e;
69
69
  };
70
- var __reExport = function e(e, r, t) {
71
- return __copyProps(e, r, "default"), t && __copyProps(t, r, "default");
70
+ var __reExport = function r(r, e, t) {
71
+ return __copyProps(r, e, "default"), t && __copyProps(t, e, "default");
72
72
  };
73
- var __toESM = function e(e, r, t) {
74
- return t = e != null ? __create(__getProtoOf(e)) : {}, __copyProps(r || !e || !e.__esModule || !__hasOwnProp.call(e, "default") ? __defProp(t, "default", {
75
- value: e,
73
+ var __toESM = function r(r, e, t) {
74
+ return t = r != null ? __create(__getProtoOf(r)) : {}, __copyProps(e || !r || !r.__esModule || !__hasOwnProp.call(r, "default") ? __defProp(t, "default", {
75
+ value: r,
76
76
  enumerable: true
77
- }) : t, e);
77
+ }) : t, r);
78
+ };
79
+ var __toCommonJS = function r(r) {
80
+ return __hasOwnProp.call(r, "module.exports") ? r["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), r);
78
81
  };
79
- var __toCommonJS = function e(e) {
80
- return __hasOwnProp.call(e, "module.exports") ? e["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), e);
82
+ var __share_factories = __create(null);
83
+ var __share_records = __create(null);
84
+ var __share = function r(r, e) {
85
+ if (!(r in __share_factories)) __share_factories[r] = e;
86
+ };
87
+ var __share_require = function r(r) {
88
+ var e = __share_records[r];
89
+ if (e) {
90
+ if (e.failed) throw e.error;
91
+ return e.exports;
92
+ }
93
+ var t = __share_factories[r];
94
+ if (!t) throw new Error("Shared chunk \"" + r + "\" was not registered before it was required.");
95
+ e = __share_records[r] = {
96
+ exports: {},
97
+ failed: false,
98
+ error: void 0
99
+ };
100
+ try {
101
+ t(e.exports);
102
+ } catch (r) {
103
+ e.failed = true;
104
+ e.error = r;
105
+ throw r;
106
+ }
107
+ return e.exports;
108
+ };
109
+ var __share_export = function r(r, e) {
110
+ for (var t in e) __defProp(r, t, {
111
+ get: e[t],
112
+ enumerable: true
113
+ });
81
114
  };
82
- var __toBinaryNode = function e(e) {
83
- return new Uint8Array(Buffer.from(e, "base64"));
115
+ var __toBinaryNode = function r(r) {
116
+ return new Uint8Array(Buffer.from(r, "base64"));
84
117
  };
85
118
  var __toBinary = function() {
86
- var e = /* @__PURE__ */ new Uint8Array(128);
87
- for (var r = 0; r < 64; r++) e[r < 26 ? r + 65 : r < 52 ? r + 71 : r < 62 ? r - 4 : r * 4 - 205] = r;
88
- return function(r) {
89
- var t = r.length, o = new Uint8Array((t - (r[t - 1] == "=") - (r[t - 2] == "=")) * 3 / 4 | 0);
90
- for (var n = 0, u = 0; n < t;) {
91
- var _ = e[r.charCodeAt(n++)], p = e[r.charCodeAt(n++)];
92
- var a = e[r.charCodeAt(n++)], f = e[r.charCodeAt(n++)];
93
- o[u++] = _ << 2 | p >> 4;
94
- o[u++] = p << 4 | a >> 2;
95
- o[u++] = a << 6 | f;
119
+ var r = /* @__PURE__ */ new Uint8Array(128);
120
+ for (var e = 0; e < 64; e++) r[e < 26 ? e + 65 : e < 52 ? e + 71 : e < 62 ? e - 4 : e * 4 - 205] = e;
121
+ return function(e) {
122
+ var t = e.length, o = new Uint8Array((t - (e[t - 1] == "=") - (e[t - 2] == "=")) * 3 / 4 | 0);
123
+ for (var n = 0, _ = 0; n < t;) {
124
+ var a = r[e.charCodeAt(n++)], u = r[e.charCodeAt(n++)];
125
+ var p = r[e.charCodeAt(n++)], f = r[e.charCodeAt(n++)];
126
+ o[_++] = a << 2 | u >> 4;
127
+ o[_++] = u << 4 | p >> 2;
128
+ o[_++] = p << 6 | f;
96
129
  }
97
130
  return o;
98
131
  };
99
132
  }();
100
- var __require = function(e) {
101
- return typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(e, { get: function e(e, r) {
102
- return (typeof require !== "undefined" ? require : e)[r];
103
- } }) : e;
104
- }(function(e) {
133
+ var __require = function(r) {
134
+ return typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(r, { get: function r(r, e) {
135
+ return (typeof require !== "undefined" ? require : r)[e];
136
+ } }) : r;
137
+ }(function(r) {
105
138
  if (typeof require !== "undefined") return require.apply(this, arguments);
106
- throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
139
+ throw Error("Calling `require` for \"" + r + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
107
140
  });
108
141
  //#endregion
109
142
  //#region ../../node_modules/mitt/dist/mitt.mjs
@@ -0,0 +1,14 @@
1
+ import { resolvePolyfillScriptPaths } from "./polyfills.js";
2
+ //#region src/internal/react-native/legacy.ts
3
+ const legacyRuntime = {
4
+ range: "<0.87.0-0",
5
+ resolve(context) {
6
+ return {
7
+ prelude: [context.require.resolve("./Libraries/Core/InitializeCore")],
8
+ polyfills: resolvePolyfillScriptPaths(context),
9
+ assetRegistryPath: "react-native/Libraries/Image/AssetRegistry.js"
10
+ };
11
+ }
12
+ };
13
+ //#endregion
14
+ export { legacyRuntime };
@@ -0,0 +1,28 @@
1
+ import { resolvePackagePath } from "../../utils/node-resolve.js";
2
+ import { createRequire } from "node:module";
3
+ import path from "node:path";
4
+ //#region src/internal/react-native/polyfills.ts
5
+ function resolvePolyfillScriptPaths({ projectRoot, reactNativePath, require }) {
6
+ const polyfillPath = resolveOptional(() => require.resolve("@react-native/js-polyfills", { paths: [reactNativePath, projectRoot] }));
7
+ if (polyfillPath) return require(polyfillPath)();
8
+ let metroConfigPath;
9
+ try {
10
+ metroConfigPath = resolvePackagePath(projectRoot, "@react-native/metro-config");
11
+ } catch {}
12
+ if (metroConfigPath) {
13
+ const requireFromMetroConfig = createRequire(path.join(metroConfigPath, "package.json"));
14
+ const metroPolyfillPath = resolveOptional(() => requireFromMetroConfig.resolve("@react-native/js-polyfills"));
15
+ if (metroPolyfillPath) return requireFromMetroConfig(metroPolyfillPath)();
16
+ }
17
+ return require("./rn-get-polyfills")();
18
+ }
19
+ function resolveOptional(resolve) {
20
+ try {
21
+ return resolve();
22
+ } catch (error) {
23
+ if (error instanceof Error && "code" in error && (error.code === "MODULE_NOT_FOUND" || error.code === "ERR_PACKAGE_PATH_NOT_EXPORTED")) return;
24
+ throw error;
25
+ }
26
+ }
27
+ //#endregion
28
+ export { resolvePolyfillScriptPaths };
@@ -0,0 +1,14 @@
1
+ import { resolvePolyfillScriptPaths } from "./polyfills.js";
2
+ //#region src/internal/react-native/public-assets.ts
3
+ const publicAssetsRuntime = {
4
+ range: ">=0.87.0-0 <0.88.0-0",
5
+ resolve(context) {
6
+ return {
7
+ prelude: [context.require.resolve("./Libraries/Core/InitializeCore")],
8
+ polyfills: resolvePolyfillScriptPaths(context),
9
+ assetRegistryPath: "react-native/asset-registry"
10
+ };
11
+ }
12
+ };
13
+ //#endregion
14
+ export { publicAssetsRuntime };
@@ -0,0 +1,14 @@
1
+ import { resolvePolyfillScriptPaths } from "./polyfills.js";
2
+ //#region src/internal/react-native/public.ts
3
+ const publicRuntime = {
4
+ range: ">=0.88.0-0",
5
+ resolve(context) {
6
+ return {
7
+ prelude: [context.require.resolve("react-native/setup-env")],
8
+ polyfills: resolvePolyfillScriptPaths(context),
9
+ assetRegistryPath: "react-native/asset-registry"
10
+ };
11
+ }
12
+ };
13
+ //#endregion
14
+ export { publicRuntime };
@@ -0,0 +1,25 @@
1
+ import { legacyRuntime } from "./legacy.js";
2
+ import { publicRuntime } from "./public.js";
3
+ import { publicAssetsRuntime } from "./public-assets.js";
4
+ import { createRequire } from "node:module";
5
+ import path from "node:path";
6
+ import { satisfies } from "semver";
7
+ //#region src/internal/react-native/runtime.ts
8
+ const strategies = [
9
+ publicRuntime,
10
+ publicAssetsRuntime,
11
+ legacyRuntime
12
+ ];
13
+ function resolveReactNativeRuntime(projectRoot, reactNativePath) {
14
+ const require = createRequire(path.join(reactNativePath, "package.json"));
15
+ const { version } = require("./package.json");
16
+ const strategy = strategies.find(({ range }) => satisfies(version, range, { includePrerelease: true }));
17
+ if (!strategy) throw new Error(`Unsupported React Native version: ${version}`);
18
+ return strategy.resolve({
19
+ projectRoot,
20
+ reactNativePath,
21
+ require
22
+ });
23
+ }
24
+ //#endregion
25
+ export { resolveReactNativeRuntime };
@@ -1,46 +1,7 @@
1
1
  import { asLiteral } from "../common/code.js";
2
- import { resolvePackagePath } from "../utils/node-resolve.js";
3
- import { createRequire } from "node:module";
4
- import path from "node:path";
2
+ import { resolveReactNativeRuntime } from "./react-native/runtime.js";
5
3
  import { isNotNil } from "es-toolkit";
6
4
  //#region src/internal/react-native.ts
7
- const ASSET_REGISTRY_PATH = "react-native/asset-registry";
8
- const LEGACY_ASSET_REGISTRY_PATH = "react-native/Libraries/Image/AssetRegistry.js";
9
- const require = createRequire(import.meta.url);
10
- function resolveInitializeCorePath(basePath) {
11
- return resolveOptional("react-native/setup-env", [basePath]) ?? require.resolve("react-native/Libraries/Core/InitializeCore", { paths: [basePath] });
12
- }
13
- function resolveAssetRegistryPath(basePath) {
14
- return resolveOptional(ASSET_REGISTRY_PATH, [basePath]) ? ASSET_REGISTRY_PATH : LEGACY_ASSET_REGISTRY_PATH;
15
- }
16
- function resolvePolyfillScriptPaths(basePath, reactNativePath) {
17
- const polyfillPath = resolveOptional("@react-native/js-polyfills", [reactNativePath, basePath]);
18
- if (polyfillPath) return loadPolyfillScriptPaths(polyfillPath);
19
- let metroConfigPath;
20
- try {
21
- metroConfigPath = resolvePackagePath(basePath, "@react-native/metro-config");
22
- } catch {}
23
- if (metroConfigPath) {
24
- const requireFromMetroConfig = createRequire(path.join(metroConfigPath, "package.json"));
25
- const metroPolyfillPath = resolveOptionalWith(() => requireFromMetroConfig.resolve("@react-native/js-polyfills"));
26
- if (metroPolyfillPath) return loadPolyfillScriptPaths(metroPolyfillPath, requireFromMetroConfig);
27
- }
28
- return loadPolyfillScriptPaths(require.resolve(path.join(reactNativePath, "rn-get-polyfills")));
29
- }
30
- function loadPolyfillScriptPaths(modulePath, load = require) {
31
- return load(modulePath)();
32
- }
33
- function resolveOptional(moduleId, paths) {
34
- return resolveOptionalWith(() => require.resolve(moduleId, { paths }));
35
- }
36
- function resolveOptionalWith(resolve) {
37
- try {
38
- return resolve();
39
- } catch (error) {
40
- if (error instanceof Error && "code" in error && (error.code === "MODULE_NOT_FOUND" || error.code === "ERR_PACKAGE_PATH_NOT_EXPORTED")) return;
41
- throw error;
42
- }
43
- }
44
5
  function getGlobalVariables(dev) {
45
6
  return [
46
7
  `var __BUNDLE_START_TIME__ = globalThis.nativePerformanceNow ? nativePerformanceNow() : Date.now();`,
@@ -51,4 +12,4 @@ function getGlobalVariables(dev) {
51
12
  ].filter(isNotNil);
52
13
  }
53
14
  //#endregion
54
- export { getGlobalVariables, resolveAssetRegistryPath, resolveInitializeCorePath, resolvePolyfillScriptPaths };
15
+ export { getGlobalVariables, resolveReactNativeRuntime };
@@ -1,2 +1 @@
1
- import { command } from "./command.js";
2
- export { command };
1
+ export { command } from "./command.js";
@@ -1,2 +1 @@
1
- import { command } from "./command.js";
2
- export { command };
1
+ export { command } from "./command.js";
@@ -1,2 +1 @@
1
- import { command } from "./command.js";
2
- export { command };
1
+ export { command } from "./command.js";
package/dist/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  //#region package.json
2
- var version = "1.0.0-beta.1";
2
+ var version = "1.0.0-beta.2";
3
3
  //#endregion
4
4
  export { version };
@@ -0,0 +1,27 @@
1
+ var __create = Object.create;
2
+ __create(null);
3
+ __create(null);
4
+ (function() {
5
+ var r = /* @__PURE__ */ new Uint8Array(128);
6
+ for (var e = 0; e < 64; e++) r[e < 26 ? e + 65 : e < 52 ? e + 71 : e < 62 ? e - 4 : e * 4 - 205] = e;
7
+ return function(e) {
8
+ var t = e.length, o = new Uint8Array((t - (e[t - 1] == "=") - (e[t - 2] == "=")) * 3 / 4 | 0);
9
+ for (var n = 0, _ = 0; n < t;) {
10
+ var a = r[e.charCodeAt(n++)], u = r[e.charCodeAt(n++)];
11
+ var p = r[e.charCodeAt(n++)], f = r[e.charCodeAt(n++)];
12
+ o[_++] = a << 2 | u >> 4;
13
+ o[_++] = u << 4 | p >> 2;
14
+ o[_++] = p << 6 | f;
15
+ }
16
+ return o;
17
+ };
18
+ })();
19
+ (function(r) {
20
+ return typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(r, { get: function r(r, e) {
21
+ return (typeof require !== "undefined" ? require : r)[e];
22
+ } }) : r;
23
+ })(function(r) {
24
+ if (typeof require !== "undefined") return require.apply(this, arguments);
25
+ throw Error("Calling `require` for \"" + r + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
26
+ });
27
+ //#endregion
package/dist/runtime.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import "./rolldown-runtime-BHXq-rbM.js";
1
+ import "./rolldown-runtime-DXE2a-Yu.js";
2
2
  import { createSignatureFunctionForTransform, getFamilyByType, isLikelyComponentType, performReactRefresh, register } from "react-refresh";
3
3
  //#endregion
4
4
  export { setCustomHMRHandler };
package/dist/runtime.js CHANGED
@@ -1,4 +1,4 @@
1
- import "./rolldown-runtime-BHXq-rbM.js";
1
+ import "./rolldown-runtime-DXE2a-Yu.js";
2
2
  //#region src/runtime.ts
3
3
  function setCustomHMRHandler(l) {
4
4
  if (__DEV__ && globalThis.__rollipop_runtime__ != null) {
@@ -7,4 +7,5 @@ export interface BundleStore {
7
7
  sourceMap: string | undefined;
8
8
  sourceMapConsumer: Promise<SourceMapConsumerType> | undefined;
9
9
  }
10
- //#endregion
10
+ //#endregion
11
+ export {};
@@ -57,7 +57,7 @@ async function createDevServer(config, options) {
57
57
  eventBus.subscribe(createReporterEventListener(config.reporter));
58
58
  eventBus.subscribe(createReactNativeEventListener(reportEvent));
59
59
  eventBus.subscribe(createDevServerEventListener(emitter));
60
- const { middleware: devMiddleware, websocketEndpoints } = createDevMiddleware({
60
+ const { middleware: devMiddleware, websocketEndpoints } = options?.inspector ?? createDevMiddleware({
61
61
  serverBaseUrl,
62
62
  logger: {
63
63
  info(...args) {
@@ -18,7 +18,10 @@ function toDevframeEvent(event) {
18
18
  case "bundle_build_failed":
19
19
  case "hmr_failed":
20
20
  case "watch_change": return bundlerEventToDevframeEvent(event);
21
- case "hmr_updates":
21
+ case "hmr_updates": return {
22
+ type: "hmr_updates",
23
+ bundlerId: event.bundlerId
24
+ };
22
25
  case "client_message":
23
26
  case "client_error":
24
27
  case "transform":
@@ -1,5 +1,6 @@
1
1
  import { resetCache } from "../../utils/reset-cache.js";
2
2
  import { getBaseBundleName } from "../../utils/bundle.js";
3
+ import { getHotUpdatePath, parseHotUpdatePath } from "../hot-update-store.js";
3
4
  import { parseUrl } from "../../utils/url.js";
4
5
  import { symbolicate } from "../symbolicate.js";
5
6
  import { toDevframeEvent } from "./events.js";
@@ -20,7 +21,7 @@ var RollipopDevframeController = class {
20
21
  this.definition = defineDevframe({
21
22
  id: "rollipop",
22
23
  name: "Rollipop",
23
- version: "1.0.0-beta.1",
24
+ version: "1.0.0-beta.2",
24
25
  packageName: "rollipop",
25
26
  homepage: "https://github.com/rollipop-dev/rollipop",
26
27
  description: "React Native development dashboard powered by Rollipop.",
@@ -58,6 +59,14 @@ var RollipopDevframeController = class {
58
59
  getBuilds() {
59
60
  return this.context.state.getBuilds();
60
61
  }
62
+ getHmrChunks(bundlerId) {
63
+ return this.context.bundlerPool.hotUpdateStore.list(bundlerId).map((chunk) => ({
64
+ filename: chunk.filename,
65
+ bundleUrl: new URL(getHotUpdatePath(bundlerId, chunk.filename), this.context.serverBaseUrl).href,
66
+ sourceMapUrl: chunk.sourcemapFilename == null ? null : new URL(getHotUpdatePath(bundlerId, chunk.sourcemapFilename), this.context.serverBaseUrl).href,
67
+ updatedAt: chunk.updatedAt
68
+ }));
69
+ }
61
70
  getBuildLogs(bundlerId) {
62
71
  const logs = this.context.state.getBuildLogs(bundlerId);
63
72
  if (logs != null) return logs;
@@ -80,17 +89,26 @@ var RollipopDevframeController = class {
80
89
  }
81
90
  async symbolicateBundlePosition(bundleUrl, line, column) {
82
91
  const { pathname, query } = parseUrl(bundleUrl);
83
- if (pathname == null || query.platform == null || query.dev == null) throw new Error("Bundle URL must include pathname, platform, and dev query parameters");
84
- const bundle = await this.context.bundlerPool.get(getBaseBundleName(pathname), {
85
- platform: String(query.platform),
86
- dev: query.dev === "true",
87
- ...query.minify == null ? {} : { minify: query.minify === "true" }
88
- }).getBundle();
92
+ let bundle;
93
+ if (pathname?.startsWith(`/hot/`)) {
94
+ const hotUpdate = parseHotUpdatePath(pathname);
95
+ if (hotUpdate == null) throw new Error("Invalid HMR chunk URL");
96
+ const stored = this.context.bundlerPool.hotUpdateStore.resolve(hotUpdate.id, hotUpdate.filename);
97
+ if (stored == null) throw new Error(`HMR chunk not found: ${hotUpdate.id}/${hotUpdate.filename}`);
98
+ bundle = stored;
99
+ } else {
100
+ if (pathname == null || query.platform == null || query.dev == null) throw new Error("Bundle URL must include pathname, platform, and dev query parameters");
101
+ bundle = await this.context.bundlerPool.get(getBaseBundleName(pathname), {
102
+ platform: String(query.platform),
103
+ dev: query.dev === "true",
104
+ ...query.minify == null ? {} : { minify: query.minify === "true" }
105
+ }).getBundle();
106
+ }
89
107
  return symbolicate(bundle, [{
90
108
  file: bundleUrl,
91
109
  lineNumber: line + 1,
92
110
  column
93
- }]);
111
+ }], { fallbackToNextMapping: true });
94
112
  }
95
113
  async triggerFullBuild(bundlerId) {
96
114
  const bundler = this.context.bundlerPool.getInstanceById(bundlerId);
@@ -124,6 +142,11 @@ function registerDashboardRpcFunctions(rpc, controller) {
124
142
  type: "query",
125
143
  handler: () => controller.getBuilds()
126
144
  }));
145
+ rpc.register(defineRpcFunction({
146
+ name: "get-hmr-chunks",
147
+ type: "query",
148
+ handler: (bundlerId) => controller.getHmrChunks(bundlerId)
149
+ }));
127
150
  rpc.register(defineRpcFunction({
128
151
  name: "get-build-logs",
129
152
  type: "query",
@@ -16,7 +16,7 @@ async function setupDevframe(context, server, inspectorDeviceServer) {
16
16
  const controller = new RollipopDevframeController(context, createAgentToolContext(context));
17
17
  const devtools = initHub({
18
18
  name: DEVFRAME_NAME,
19
- version: "1.0.0-beta.1",
19
+ version: "1.0.0-beta.2",
20
20
  base: ROLLIPOP_DEVFRAME_BASE,
21
21
  cwd: context.config.root,
22
22
  ui: createUi({
@@ -8,11 +8,18 @@ export interface HotUpdatePatch {
8
8
  }
9
9
  export declare class HotUpdateStore {
10
10
  private readonly hotPath;
11
+ private readonly patches;
11
12
  constructor(projectRoot: string);
12
13
  clear(): void;
13
14
  write(id: string, patch: HotUpdatePatch): void;
15
+ list(id: string): {
16
+ filename: string;
17
+ sourcemapFilename: string | null;
18
+ updatedAt: number;
19
+ }[];
14
20
  resolve(id: string, filename: string): BundleStore | undefined;
15
21
  readAsset(id: string, filename: string): Buffer | undefined;
22
+ private getSourcemapFilename;
16
23
  private getDirectoryPath;
17
24
  private getFilePath;
18
25
  }
@@ -27,10 +27,12 @@ function parseHotUpdatePath(pathname) {
27
27
  }
28
28
  var HotUpdateStore = class {
29
29
  hotPath;
30
+ patches = /* @__PURE__ */ new Map();
30
31
  constructor(projectRoot) {
31
32
  this.hotPath = path.join(FileStorage.getPath(projectRoot), "hot");
32
33
  }
33
34
  clear() {
35
+ this.patches.clear();
34
36
  try {
35
37
  fs.rmSync(this.hotPath, {
36
38
  recursive: true,
@@ -47,14 +49,29 @@ var HotUpdateStore = class {
47
49
  fs.mkdirSync(directoryPath, { recursive: true });
48
50
  if (patch.sourcemap != null && patch.sourcemapFilename != null) fs.writeFileSync(this.getFilePath(id, patch.sourcemapFilename), patch.sourcemap, "utf-8");
49
51
  fs.writeFileSync(this.getFilePath(id, patch.filename), patch.code, "utf-8");
52
+ const patches = this.patches.get(id) ?? /* @__PURE__ */ new Map();
53
+ patches.set(patch.filename, patch.sourcemapFilename ?? null);
54
+ this.patches.set(id, patches);
55
+ }
56
+ list(id) {
57
+ assertPathSegment(id, "id");
58
+ return Array.from(this.patches.get(id)?.keys() ?? []).flatMap((filename) => {
59
+ const stats = fs.statSync(this.getFilePath(id, filename), { throwIfNoEntry: false });
60
+ if (!stats?.isFile()) return [];
61
+ return [{
62
+ filename,
63
+ sourcemapFilename: this.getSourcemapFilename(id, filename),
64
+ updatedAt: stats.mtimeMs
65
+ }];
66
+ }).sort((a, b) => b.updatedAt - a.updatedAt);
50
67
  }
51
68
  resolve(id, filename) {
52
69
  assertPathSegment(id, "id");
53
70
  assertPathSegment(filename, "filename");
54
71
  const bundleFilePath = this.getFilePath(id, filename);
55
72
  if (!isFile(bundleFilePath)) return;
56
- const sourcemapFilePath = this.getFilePath(id, `${filename}.map`);
57
- return new HotUpdateBundleStore(bundleFilePath, isFile(sourcemapFilePath) ? sourcemapFilePath : void 0);
73
+ const sourcemapFilename = this.getSourcemapFilename(id, filename);
74
+ return new HotUpdateBundleStore(bundleFilePath, sourcemapFilename == null ? void 0 : this.getFilePath(id, sourcemapFilename));
58
75
  }
59
76
  readAsset(id, filename) {
60
77
  assertPathSegment(id, "id");
@@ -62,6 +79,11 @@ var HotUpdateStore = class {
62
79
  const filePath = this.getFilePath(id, filename);
63
80
  return isFile(filePath) ? fs.readFileSync(filePath) : void 0;
64
81
  }
82
+ getSourcemapFilename(id, filename) {
83
+ const storedFilename = this.patches.get(id)?.get(filename);
84
+ const sourcemapFilename = storedFilename === void 0 ? `${filename}.map` : storedFilename;
85
+ return sourcemapFilename != null && isFile(this.getFilePath(id, sourcemapFilename)) ? sourcemapFilename : null;
86
+ }
65
87
  getDirectoryPath(id) {
66
88
  return path.join(this.hotPath, id);
67
89
  }
@@ -1,4 +1,5 @@
1
1
  import { parseUrl } from "../utils/url.js";
2
+ import { SourceMapConsumer } from "source-map";
2
3
  import { codeFrameColumns } from "@babel/code-frame";
3
4
  //#region src/server/symbolicate.ts
4
5
  /**
@@ -25,16 +26,16 @@ const INTERNAL_CALLSITES_REGEX = new RegExp([
25
26
  "/node_modules/scheduler/.+\\.js$",
26
27
  "^\\[native code\\]$"
27
28
  ].map((pathPattern) => pathPattern.replaceAll("/", "[/\\\\]")).join("|"));
28
- async function symbolicate(bundleStore, stack) {
29
- return symbolicateWithBundleResolver(stack, (frame) => frame.file?.startsWith("http") ? bundleStore : void 0);
29
+ async function symbolicate(bundleStore, stack, options) {
30
+ return symbolicateWithBundleResolver(stack, (frame) => frame.file?.startsWith("http") ? bundleStore : void 0, options);
30
31
  }
31
- async function symbolicateWithBundleResolver(stack, resolveBundleStore) {
32
+ async function symbolicateWithBundleResolver(stack, resolveBundleStore, options) {
32
33
  const symbolicatedStack = await Promise.all(stack.map(async (frame) => {
33
34
  const bundleStore = frame.file?.startsWith("http") ? await resolveBundleStore(frame) : void 0;
34
35
  const sourceMapConsumer = await bundleStore?.sourceMapConsumer;
35
36
  return {
36
37
  bundleStore,
37
- frame: collapseFrame(sourceMapConsumer ? originalPositionFor(sourceMapConsumer, frame) : frame),
38
+ frame: collapseFrame(sourceMapConsumer ? originalPositionFor(sourceMapConsumer, frame, options) : frame),
38
39
  sourceMapConsumer
39
40
  };
40
41
  }));
@@ -43,12 +44,17 @@ async function symbolicateWithBundleResolver(stack, resolveBundleStore) {
43
44
  codeFrame: getCodeFrame(symbolicatedStack)
44
45
  };
45
46
  }
46
- function originalPositionFor(sourceMapConsumer, frame) {
47
+ function originalPositionFor(sourceMapConsumer, frame, options) {
47
48
  if (frame.column == null || frame.lineNumber == null) return frame;
48
- const originalPosition = sourceMapConsumer.originalPositionFor({
49
+ let originalPosition = sourceMapConsumer.originalPositionFor({
49
50
  column: frame.column,
50
51
  line: frame.lineNumber
51
52
  });
53
+ if (originalPosition.source == null && options?.fallbackToNextMapping) originalPosition = sourceMapConsumer.originalPositionFor({
54
+ column: frame.column,
55
+ line: frame.lineNumber,
56
+ bias: SourceMapConsumer.LEAST_UPPER_BOUND
57
+ });
52
58
  return Object.entries(originalPosition).reduce((frame, [key, value]) => {
53
59
  const targetKey = convertFrameKey(key);
54
60
  return {
@@ -22,6 +22,11 @@ export interface ServerOptions {
22
22
  key?: string;
23
23
  cert?: string;
24
24
  buildOptions?: Pick<BuildOptions, 'cache'>;
25
+ /** Override the inspector middleware and WebSocket endpoints for a host's debugging protocol. */
26
+ inspector?: {
27
+ middleware: fastifyMiddie.Handler;
28
+ websocketEndpoints: Record<string, ws.Server>;
29
+ };
25
30
  }
26
31
  export interface DevServerContext {
27
32
  /**
@@ -28,7 +28,7 @@ var FileStorage = class FileStorage {
28
28
  this.dataFilePath = path.join(FileStorage.getPath(basePath, { prepare: true }), DATA_FILENAME);
29
29
  if (fs.existsSync(this.dataFilePath)) {
30
30
  const loadedData = JSON.parse(fs.readFileSync(this.dataFilePath, "utf-8"));
31
- if ("version" in loadedData && loadedData.version === "1.0.0-beta.1") this.data = loadedData;
31
+ if ("version" in loadedData && loadedData.version === "1.0.0-beta.2") this.data = loadedData;
32
32
  else {
33
33
  this.data = createDefaultData();
34
34
  this.flush();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rollipop",
3
- "version": "1.0.0-beta.1",
3
+ "version": "1.0.0-beta.2",
4
4
  "homepage": "https://github.com/rollipop-dev/rollipop#readme",
5
5
  "bugs": {
6
6
  "url": "https://github.com/rollipop-dev/rollipop/issues"
@@ -59,57 +59,60 @@
59
59
  "@babel/code-frame": "8.0.6",
60
60
  "@babel/core": "8.0.6",
61
61
  "@commander-js/extra-typings": "15.0.0",
62
- "@devframes/hub": "1.0.0",
63
- "@devframes/hub-ui": "1.0.0",
64
- "@fastify/middie": "9.3.4",
65
- "@fastify/static": "10.1.4",
66
- "@inquirer/prompts": "8.7.2",
62
+ "@devframes/hub": "1.2.6",
63
+ "@devframes/hub-ui": "1.2.6",
64
+ "@fastify/middie": "9.3.5",
65
+ "@fastify/static": "10.1.6",
66
+ "@inquirer/prompts": "8.7.4",
67
67
  "@react-native-community/cli-server-api": "20.2.0",
68
68
  "@react-native-community/cli-types": "20.2.0",
69
- "@react-native/dev-middleware": "0.87.1",
70
- "@rollipop/dashboard": "1.0.0-beta.1",
71
- "@rollipop/rolldown": "1.1.0",
69
+ "@react-native/dev-middleware": "0.88.0",
70
+ "@rollipop/dashboard": "1.0.0-beta.2",
71
+ "@rollipop/rolldown": "1.1.1",
72
72
  "@swc/core": "1.16.13",
73
73
  "@swc/helpers": "0.5.23",
74
- "@types/ws": "8.18.1",
75
- "arktype": "2.2.3",
74
+ "@types/ws": "8.18.2",
75
+ "arktype": "2.2.8",
76
76
  "c12": "3.3.4",
77
- "chalk": "6.0.0",
77
+ "chalk": "6.0.1",
78
78
  "commander": "15.0.0",
79
79
  "dayjs": "1.11.23",
80
80
  "dedent": "1.7.2",
81
- "devframe": "1.0.0",
82
- "dotenv": "17.4.2",
81
+ "devframe": "1.2.6",
82
+ "dotenv": "18.0.8",
83
83
  "dotenv-expand": "13.0.0",
84
84
  "es-toolkit": "1.52.0",
85
85
  "fast-flow-transform": "0.0.3",
86
- "fastify": "5.12.5",
87
- "fastify-plugin": "6.0.0",
86
+ "fastify": "5.12.7",
87
+ "fastify-plugin": "6.0.1",
88
88
  "gradient-string": "3.0.0",
89
89
  "image-size": "2.0.4",
90
90
  "json-schema-to-ts": "3.1.1",
91
- "mime": "4.1.0",
91
+ "mime": "4.1.1",
92
92
  "mitt": "3.0.1",
93
93
  "open": "11.0.4",
94
94
  "pretty-format": "30.5.1",
95
95
  "rolldown-analyzer": "0.3.1",
96
+ "semver": "7.8.5",
96
97
  "source-map": "0.8.0",
97
98
  "strip-ansi": "7.2.0",
98
99
  "wrap-ansi": "10.0.2",
99
- "ws": "8.21.3"
100
+ "ws": "8.22.0"
100
101
  },
101
102
  "devDependencies": {
102
- "@devframes/agentic": "1.0.0",
103
+ "@devframes/agentic": "1.2.6",
103
104
  "@swc/plugin-remove-console": "15.0.0",
104
105
  "@types/react-refresh": "0.14.7",
105
- "@vitest/coverage-v8": "4.1.11",
106
+ "@types/semver": "7.8.0",
107
+ "@vitest/coverage-v8": "5.0.5",
106
108
  "react-refresh": "0.19.0",
107
109
  "typescript": "7.0.2",
108
- "vite-plus": "0.3.3",
109
- "vitest": "4.1.11"
110
+ "vite": "@voidzero-dev/vite-plus-core@1.3.0",
111
+ "vite-plus": "1.3.0",
112
+ "vitest": "5.0.5"
110
113
  },
111
114
  "peerDependencies": {
112
- "@devframes/agentic": "1.0.0"
115
+ "@devframes/agentic": "^1"
113
116
  },
114
117
  "peerDependenciesMeta": {
115
118
  "@devframes/agentic": {
@@ -18,7 +18,7 @@ Use https://rollipop.dev/docs/features/env.md when changing env file loading, pr
18
18
 
19
19
  ## Experimental Features
20
20
 
21
- Use https://rollipop.dev/docs/experimental/overview.md before enabling experimental options. Keep the change explicit and mention stability/version risk. For worklets specifically, read https://rollipop.dev/docs/experimental/reanimated-worklets.md.
21
+ Use https://rollipop.dev/docs/get-started/configuration.md#experimental before enabling experimental options. Keep the change explicit and mention stability/version risk. For worklets specifically, read https://rollipop.dev/docs/experimental/reanimated-worklets.md.
22
22
 
23
23
  ## Resolve Changes
24
24
 
package/skills/plugins.md CHANGED
@@ -28,7 +28,7 @@ Use the built-in analyzer config when the task is to inspect bundle size or modu
28
28
 
29
29
  ### Rozenite
30
30
 
31
- Use the Rozenite plugin when the app needs Rozenite DevTools middleware integrated into the Rollipop dev server. Keep it development-focused and follow Rozenite's app-side setup guidance for companion plugins. Read https://www.rozenite.dev.
31
+ Use the Rozenite plugin when the app needs Rozenite DevTools middleware integrated into the Rollipop dev server. Keep it development-focused and follow Rozenite's app-side setup guidance for companion plugins. Read https://rollipop.dev/docs/features/rozenite.md.
32
32
 
33
33
  ## Watchpoints
34
34
 
@@ -1,24 +0,0 @@
1
- (function() {
2
- var e = /* @__PURE__ */ new Uint8Array(128);
3
- for (var r = 0; r < 64; r++) e[r < 26 ? r + 65 : r < 52 ? r + 71 : r < 62 ? r - 4 : r * 4 - 205] = r;
4
- return function(r) {
5
- var t = r.length, o = new Uint8Array((t - (r[t - 1] == "=") - (r[t - 2] == "=")) * 3 / 4 | 0);
6
- for (var n = 0, u = 0; n < t;) {
7
- var _ = e[r.charCodeAt(n++)], p = e[r.charCodeAt(n++)];
8
- var a = e[r.charCodeAt(n++)], f = e[r.charCodeAt(n++)];
9
- o[u++] = _ << 2 | p >> 4;
10
- o[u++] = p << 4 | a >> 2;
11
- o[u++] = a << 6 | f;
12
- }
13
- return o;
14
- };
15
- })();
16
- (function(e) {
17
- return typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(e, { get: function e(e, r) {
18
- return (typeof require !== "undefined" ? require : e)[r];
19
- } }) : e;
20
- })(function(e) {
21
- if (typeof require !== "undefined") return require.apply(this, arguments);
22
- throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
23
- });
24
- //#endregion