rollipop 1.0.0-beta.1 → 1.0.0-beta.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 +4 -0
- package/dist/config/defaults.js +6 -4
- package/dist/config/types.d.ts +3 -2
- package/dist/constants.js +1 -1
- package/dist/core/plugins/babel-plugin.js +1 -1
- package/dist/core/plugins/types.d.ts +2 -1
- package/dist/core/rolldown.js +3 -10
- package/dist/events/types.d.ts +2 -1
- package/dist/hmr-runtime.iife.js +302 -195
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/internal/react-native/legacy.js +14 -0
- package/dist/internal/react-native/polyfills.js +28 -0
- package/dist/internal/react-native/public-assets.js +14 -0
- package/dist/internal/react-native/public.js +14 -0
- package/dist/internal/react-native/runtime.js +25 -0
- package/dist/internal/react-native.js +2 -41
- package/dist/node/commands/agent/index.js +1 -2
- package/dist/node/commands/bundle/command.js +8 -0
- package/dist/node/commands/bundle/index.js +1 -2
- package/dist/node/commands/start/index.js +1 -2
- package/dist/package.js +1 -1
- package/dist/rolldown-runtime-DXE2a-Yu.js +27 -0
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.js +1 -1
- package/dist/server/bundle.d.ts +2 -1
- package/dist/server/create-dev-server.js +1 -1
- package/dist/server/devframe/events.js +4 -1
- package/dist/server/devframe/index.js +31 -8
- package/dist/server/devframe/setup.js +4 -1
- package/dist/server/hot-update-store.d.ts +7 -0
- package/dist/server/hot-update-store.js +24 -2
- package/dist/server/symbolicate.js +12 -6
- package/dist/server/types.d.ts +5 -0
- package/dist/storage/file-storage.js +1 -1
- package/dist/utils/transform.js +2 -1
- package/dist/utils/worklets.d.ts +7 -0
- package/dist/utils/worklets.js +32 -0
- package/package.json +26 -23
- package/skills/configuration.md +1 -1
- package/skills/plugins.md +1 -1
- package/src/runtime/__tests__/hmr-runtime.spec.ts +171 -72
- package/src/runtime/hmr-client.ts +1 -1
- package/src/runtime/hmr-runtime.ts +76 -0
- package/dist/rolldown-runtime-BHXq-rbM.js +0 -24
package/README.md
CHANGED
package/dist/config/defaults.js
CHANGED
|
@@ -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 {
|
|
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:
|
|
30
|
-
polyfills: await Promise.all(
|
|
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:
|
|
43
|
+
assetRegistryPath: runtime.assetRegistryPath,
|
|
42
44
|
hmrClientPath: DEFAULT_HMR_CLIENT_PATH
|
|
43
45
|
},
|
|
44
46
|
dev: {
|
package/dist/config/types.d.ts
CHANGED
|
@@ -6,11 +6,12 @@ import { InteractiveCommand } from "../node/commands/start/setup-interactive-mod
|
|
|
6
6
|
import "../node/cli-utils.js";
|
|
7
7
|
import { Plugin } from "../core/plugins/types.js";
|
|
8
8
|
import * as swc from "@swc/core";
|
|
9
|
-
import { DevWatchOptions, RollipopReactNativeFlowConfig as FlowConfig, RollipopReactNativeReactConfig, RollipopReactNativeSwcConfig as SwcConfig, RollipopReactNativeWorkletsConfig
|
|
9
|
+
import { DevWatchOptions, RollipopReactNativeFlowConfig as FlowConfig, RollipopReactNativeReactConfig, RollipopReactNativeSwcConfig as SwcConfig, RollipopReactNativeWorkletsConfig } from "@rollipop/rolldown/experimental";
|
|
10
10
|
import * as rolldown from "@rollipop/rolldown";
|
|
11
11
|
import { TopLevelFilterExpression } from "@rollipop/rolldown/filter";
|
|
12
12
|
import * as babel from "@babel/core";
|
|
13
13
|
//#region src/config/types.d.ts
|
|
14
|
+
type WorkletsConfig = Partial<RollipopReactNativeWorkletsConfig>;
|
|
14
15
|
type RolldownExperimentalOptions = NonNullable<rolldown.InputOptions['experimental']>;
|
|
15
16
|
type RolldownTransformOptions = NonNullable<rolldown.InputOptions['transform']>;
|
|
16
17
|
type RolldownJsxOptions = ExtractObject<NonNullable<RolldownTransformOptions['jsx']>>;
|
|
@@ -227,7 +228,7 @@ export interface TransformRule<T = unknown> {
|
|
|
227
228
|
}
|
|
228
229
|
export interface ExperimentalConfig extends RolldownExperimentalOptions {
|
|
229
230
|
/**
|
|
230
|
-
*
|
|
231
|
+
* Worklets or Reanimated 3 transformation configuration. Installed versions are detected by default.
|
|
231
232
|
*/
|
|
232
233
|
worklets?: WorkletsConfig;
|
|
233
234
|
}
|
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.
|
|
23
|
+
const ROLLIPOP_VERSION = "1.0.0-beta.3";
|
|
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`;
|
|
@@ -62,7 +62,7 @@ function transform(code, id, options) {
|
|
|
62
62
|
sourceMaps: true,
|
|
63
63
|
...options
|
|
64
64
|
});
|
|
65
|
-
invariant(result?.code, `Failed to transform with babel: ${id}`);
|
|
65
|
+
invariant(result?.code != null, `Failed to transform with babel: ${id}`);
|
|
66
66
|
const map = result.map && {
|
|
67
67
|
...result.map,
|
|
68
68
|
names: [...result.map.names],
|
|
@@ -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 {};
|
package/dist/core/rolldown.js
CHANGED
|
@@ -2,7 +2,7 @@ import { ROLLIPOP_VIRTUAL_ENTRY_ID } from "../constants.js";
|
|
|
2
2
|
import { isDebugEnabled } from "../common/env.js";
|
|
3
3
|
import { CompatStatusReporter, ProgressBarStatusReporter } from "../events/builtin-reporters.js";
|
|
4
4
|
import { asLiteral, iife, nodeEnvironment } from "../common/code.js";
|
|
5
|
-
import { resolveFrom
|
|
5
|
+
import { resolveFrom } from "../utils/node-resolve.js";
|
|
6
6
|
import { getGlobalVariables } from "../internal/react-native.js";
|
|
7
7
|
import { printPluginLog } from "./plugins/context.js";
|
|
8
8
|
import { applyRolldownOptionsConfig } from "../config/compose-override.js";
|
|
@@ -12,6 +12,7 @@ import { resolveHmrConfig } from "../utils/config.js";
|
|
|
12
12
|
import { defineEnvFromObject } from "../utils/env.js";
|
|
13
13
|
import { getBaseUrl } from "../utils/server.js";
|
|
14
14
|
import { getBuildTotalModules, setBuildTotalModules } from "../utils/storage.js";
|
|
15
|
+
import { resolveWorkletsConfig } from "../utils/worklets.js";
|
|
15
16
|
import { transformWithRollipop } from "../utils/transform.js";
|
|
16
17
|
import { loadEnv } from "./env.js";
|
|
17
18
|
import { withTransformBoundary } from "./plugins/utils/transform-utils.js";
|
|
@@ -218,17 +219,9 @@ function resolveReactNativeBuiltinPluginConfig(config) {
|
|
|
218
219
|
runtimeTarget: config.runtimeTarget,
|
|
219
220
|
flow: config.transform.flow,
|
|
220
221
|
swc: resolveNativeSwcConfig(config.transform),
|
|
221
|
-
worklets: resolveWorkletsConfig(config)
|
|
222
|
+
worklets: resolveWorkletsConfig(config.experimental.worklets, config)
|
|
222
223
|
};
|
|
223
224
|
}
|
|
224
|
-
function resolveWorkletsConfig(config) {
|
|
225
|
-
const { worklets } = config.experimental ?? {};
|
|
226
|
-
if (worklets == null) return;
|
|
227
|
-
return toMerged({
|
|
228
|
-
isRelease: config.mode === "production",
|
|
229
|
-
pluginVersion: resolvePackageJson(config.root, "react-native-worklets")?.version
|
|
230
|
-
}, worklets);
|
|
231
|
-
}
|
|
232
225
|
function resolveRolldownTransformConfig(config) {
|
|
233
226
|
const { flow: _flow, babel: _babel, swc: _swc, ...transform } = config;
|
|
234
227
|
if (transform.jsx != null && typeof transform.jsx === "object") {
|
package/dist/events/types.d.ts
CHANGED