diff --git a/.changeset/clever-wasps-battle.md b/.changeset/clever-wasps-battle.md
new file mode 100644
index 000000000..a3bd725c2
--- /dev/null
+++ b/.changeset/clever-wasps-battle.md
@@ -0,0 +1,5 @@
+---
+"@farmfe/core": major
+---
+
+export loadenv api
diff --git a/.changeset/happy-mice-visit.md b/.changeset/happy-mice-visit.md
deleted file mode 100644
index 633c7c761..000000000
--- a/.changeset/happy-mice-visit.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-"@farmfe/core": patch
----
-
-fix plugin circle call between Runtime & LazyCompilation, fix runtime & lazyCompilation conflict
diff --git a/.changeset/shiny-guests-deliver.md b/.changeset/shiny-guests-deliver.md
new file mode 100644
index 000000000..347ef30e4
--- /dev/null
+++ b/.changeset/shiny-guests-deliver.md
@@ -0,0 +1,5 @@
+---
+"@farmfe/core": major
+---
+
+build cjs script
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index e9fe348e8..1df2bf3a8 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -131,6 +131,11 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 18
+ - uses: actions/download-artifact@v4
+ id: download-plugin-replace-dirname
+ with:
+ name: ${{ github.sha }}-${{ matrix.settings.abi }}-plugin-replace-dirname
+ path: ./rust-plugins/replace-dirname/npm/${{ matrix.settings.abi }}
- name: Install Dependencies
run: npm install -g pnpm@9.1.0 && pnpm i --frozen-lockfile
- name: Build CLI and Core
@@ -189,6 +194,7 @@ jobs:
settings:
- name: plugin-sass
- name: plugin-react
+ - name: plugin-replace-dirname
steps:
- uses: actions/download-artifact@v4
with:
@@ -199,34 +205,3 @@ jobs:
do
test -f /tmp/artifacts/${{ github.sha }}-${abi}-${{ matrix.settings.name }}/index.farm
done
-
- benchmarks:
- needs: [call-rust-build]
- runs-on: ${{ matrix.settings.os }}
- strategy:
- fail-fast: false
- matrix:
- settings:
- - os: ubuntu-latest
- abi: linux-x64-gnu
- steps:
- - uses: "actions/checkout@v3"
- - uses: actions/setup-node@v3
- with:
- node-version: 18
- - name: Install Dependencies
- run: npm install -g pnpm@9.1.0 && pnpm i --frozen-lockfile
- - name: Build CLI and Core
- run: pnpm --filter @farmfe/cli run build
- - uses: actions/download-artifact@v4
- id: download
- with:
- name: ${{ github.sha }}-${{ matrix.settings.abi }}
- path: ./packages/core/binding
- - name: Build Core CJS
- run: cd packages/core && pnpm run build:cjs
- # - name: Run benchmarks
- # uses: CodSpeedHQ/action@v3
- # with:
- # run: npm exec vitest bench
- # token: ${{ secrets.CODSPEED_TOKEN }}
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
index cb8f0f44b..9b0fa3bbb 100644
--- a/.github/workflows/release.yaml
+++ b/.github/workflows/release.yaml
@@ -35,12 +35,14 @@ jobs:
do
mv /tmp/artifacts/${{ github.sha }}-${abi}/* ./packages/core/npm/${abi}
mv /tmp/artifacts/${{ github.sha }}-${abi}-plugin-react/* ./rust-plugins/react/npm/${abi}
+ mv /tmp/artifacts/${{ github.sha }}-${abi}-plugin-replace-dirname/* ./rust-plugins/replace-dirname/npm/${abi}
mv /tmp/artifacts/${{ github.sha }}-${abi}-plugin-sass/* ./rust-plugins/sass/npm/${abi}
mv /tmp/artifacts/${{ github.sha }}-${abi}-create-farm/* ./packages/create-farm/npm/${abi}
test -f ./packages/core/npm/${abi}/farm.${abi}.node
test -f ./packages/create-farm/npm/${abi}/create-farm.${abi}.node
test -f ./rust-plugins/react/npm/${abi}/index.farm
+ test -f ./rust-plugins/replace-dirname/npm/${abi}/index.farm
test -f ./rust-plugins/sass/npm/${abi}/index.farm
done
for abi in android-arm-eabi linux-arm-gnueabihf android-arm64
diff --git a/Cargo.lock b/Cargo.lock
index ebc087b8f..578ed8f5b 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1856,6 +1856,7 @@ name = "farmfe_plugin_runtime"
version = "0.0.12"
dependencies = [
"farmfe_core",
+ "farmfe_plugin_bundle",
"farmfe_testing_helpers",
"farmfe_toolkit",
"farmfe_utils 0.1.6",
@@ -1956,6 +1957,7 @@ dependencies = [
"farmfe_testing_helpers",
"farmfe_toolkit_plugin_types",
"farmfe_utils 0.1.6",
+ "itertools 0.13.0",
"lazy_static",
"preset_env_base",
"sourcemap",
diff --git a/README.md b/README.md
index e577c56cb..f302afba6 100644
--- a/README.md
+++ b/README.md
@@ -22,6 +22,9 @@
+
+
+
diff --git a/crates/compiler/src/build/mod.rs b/crates/compiler/src/build/mod.rs
index 0f0aaf266..a27cdbd3e 100644
--- a/crates/compiler/src/build/mod.rs
+++ b/crates/compiler/src/build/mod.rs
@@ -488,6 +488,14 @@ impl Compiler {
return;
}
+ if let ResolveKind::Entry(ref name) = resolve_param.kind {
+ context
+ .module_graph
+ .write()
+ .entries
+ .insert(module.id.clone(), name.to_string());
+ }
+
match Self::build_module(
resolve_module_id_result.resolve_result,
&mut module,
diff --git a/crates/compiler/src/generate/render_resource_pots.rs b/crates/compiler/src/generate/render_resource_pots.rs
index 2ae30b9d8..dcfbfd02e 100644
--- a/crates/compiler/src/generate/render_resource_pots.rs
+++ b/crates/compiler/src/generate/render_resource_pots.rs
@@ -84,8 +84,9 @@ pub fn render_resource_pots_and_generate_resources(
&mut resource_pot_info,
)?;
- let r = &mut res.resource;
let resource_pot_info: ResourcePotInfo = resource_pot_info.unwrap();
+ res.resource.info = Some(resource_pot_info);
+ let r = &mut res.resource;
// ignore runtime resource
if !matches!(r.resource_type, ResourceType::Runtime) {
@@ -149,7 +150,6 @@ pub fn render_resource_pots_and_generate_resources(
resource_pot.add_resource(res.resource.name.clone());
- res.resource.info = Some(resource_pot_info);
resources.lock().push(res.resource);
Ok::<(), CompilationError>(())
diff --git a/crates/compiler/src/generate/snapshots/generate_resource_pot_map-2.snap b/crates/compiler/src/generate/snapshots/generate_resource_pot_map-2.snap
index 2d7fdedfc..e3b870fc0 100644
--- a/crates/compiler/src/generate/snapshots/generate_resource_pot_map-2.snap
+++ b/crates/compiler/src/generate/snapshots/generate_resource_pot_map-2.snap
@@ -1,59 +1,65 @@
---
source: crates/compiler/src/generate/partial_bundling.rs
-input_file: crates/compiler/src/generate/partial_bundling.rs
+input_file: crates/testing_helpers/src/lib.rs
---
-(
- (
- "immutable",
- false,
- ),
- (
- "modules",
- [
- ModuleId {
- relative_path: "B",
- query_string: "",
- },
- ModuleId {
- relative_path: "E",
- query_string: "",
- },
- ],
- ),
- (
- "resource_pot_type",
- Custom(
- "__farm_unknown",
- ),
- ),
- (
- "name",
- "B_2f5d",
- ),
- (
- "id",
- "B_2f5d",
- ),
- (
- "entry",
- Some(
- ModuleId {
- relative_path: "B",
- query_string: "",
- },
- ),
- ),
- (
- "resources",
- [],
- ),
- (
- "module_groups",
- [
- ModuleId {
- relative_path: "B",
- query_string: "",
- },
- ],
- ),
+name: A_66be
+id: A_66be
+immutable: false
+resource_pot_type: Js
+entry: Some(
+ ModuleId {
+ relative_path: "A",
+ query_string: "",
+ },
)
+module_groups: [
+ ModuleId {
+ relative_path: "A",
+ query_string: "",
+ },
+ ModuleId {
+ relative_path: "F",
+ query_string: "",
+ },
+]
+modules: [
+ ModuleId {
+ relative_path: "A",
+ query_string: "",
+ },
+ ModuleId {
+ relative_path: "C",
+ query_string: "",
+ },
+]
+resources: []
+
+-------
+
+name: B_2f5d
+id: B_2f5d
+immutable: false
+resource_pot_type: Js
+entry: Some(
+ ModuleId {
+ relative_path: "B",
+ query_string: "",
+ },
+)
+module_groups: [
+ ModuleId {
+ relative_path: "B",
+ query_string: "",
+ },
+]
+modules: [
+ ModuleId {
+ relative_path: "B",
+ query_string: "",
+ },
+ ModuleId {
+ relative_path: "E",
+ query_string: "",
+ },
+]
+resources: []
diff --git a/crates/compiler/src/generate/snapshots/generate_resource_pot_map-3.snap b/crates/compiler/src/generate/snapshots/generate_resource_pot_map-3.snap
index 0f4dee256..17c211f26 100644
--- a/crates/compiler/src/generate/snapshots/generate_resource_pot_map-3.snap
+++ b/crates/compiler/src/generate/snapshots/generate_resource_pot_map-3.snap
@@ -1,54 +1,90 @@
---
source: crates/compiler/src/generate/partial_bundling.rs
-input_file: crates/compiler/src/generate/partial_bundling.rs
+input_file: crates/testing_helpers/src/lib.rs
---
-(
- (
- "immutable",
- false,
- ),
- (
- "modules",
- [
- ModuleId {
- relative_path: "D",
- query_string: "",
- },
- ],
- ),
- (
- "resource_pot_type",
- Custom(
- "__farm_unknown",
- ),
- ),
- (
- "name",
- "B_3f39",
- ),
- (
- "id",
- "B_3f39",
- ),
- (
- "entry",
- None,
- ),
- (
- "resources",
- [],
- ),
- (
- "module_groups",
- [
- ModuleId {
- relative_path: "B",
- query_string: "",
- },
- ModuleId {
- relative_path: "D",
- query_string: "",
- },
- ],
- ),
+name: A_66be
+id: A_66be
+immutable: false
+resource_pot_type: Js
+entry: Some(
+ ModuleId {
+ relative_path: "A",
+ query_string: "",
+ },
)
+module_groups: [
+ ModuleId {
+ relative_path: "A",
+ query_string: "",
+ },
+ ModuleId {
+ relative_path: "F",
+ query_string: "",
+ },
+]
+modules: [
+ ModuleId {
+ relative_path: "A",
+ query_string: "",
+ },
+ ModuleId {
+ relative_path: "C",
+ query_string: "",
+ },
+]
+resources: []
+
+-------
+
+name: B_2f5d
+id: B_2f5d
+immutable: false
+resource_pot_type: Js
+entry: Some(
+ ModuleId {
+ relative_path: "B",
+ query_string: "",
+ },
+)
+module_groups: [
+ ModuleId {
+ relative_path: "B",
+ query_string: "",
+ },
+]
+modules: [
+ ModuleId {
+ relative_path: "B",
+ query_string: "",
+ },
+ ModuleId {
+ relative_path: "E",
+ query_string: "",
+ },
+]
+resources: []
+
+-------
+
+name: B_3f39
+id: B_3f39
+immutable: false
+resource_pot_type: Js
+entry: None
+module_groups: [
+ ModuleId {
+ relative_path: "B",
+ query_string: "",
+ },
+ ModuleId {
+ relative_path: "D",
+ query_string: "",
+ },
+]
+modules: [
+ ModuleId {
+ relative_path: "D",
+ query_string: "",
+ },
+]
+resources: []
diff --git a/crates/compiler/src/generate/snapshots/generate_resource_pot_map-4.snap b/crates/compiler/src/generate/snapshots/generate_resource_pot_map-4.snap
index fadc33416..4534cfb5b 100644
--- a/crates/compiler/src/generate/snapshots/generate_resource_pot_map-4.snap
+++ b/crates/compiler/src/generate/snapshots/generate_resource_pot_map-4.snap
@@ -1,50 +1,111 @@
---
source: crates/compiler/src/generate/partial_bundling.rs
-input_file: crates/compiler/src/generate/partial_bundling.rs
+input_file: crates/testing_helpers/src/lib.rs
---
-(
- (
- "immutable",
- false,
- ),
- (
- "modules",
- [
- ModuleId {
- relative_path: "G",
- query_string: "",
- },
- ],
- ),
- (
- "resource_pot_type",
- Custom(
- "__farm_unknown",
- ),
- ),
- (
- "name",
- "G_333e",
- ),
- (
- "id",
- "G_333e",
- ),
- (
- "entry",
- None,
- ),
- (
- "resources",
- [],
- ),
- (
- "module_groups",
- [
- ModuleId {
- relative_path: "G",
- query_string: "",
- },
- ],
- ),
+name: A_66be
+id: A_66be
+immutable: false
+resource_pot_type: Js
+entry: Some(
+ ModuleId {
+ relative_path: "A",
+ query_string: "",
+ },
)
+module_groups: [
+ ModuleId {
+ relative_path: "A",
+ query_string: "",
+ },
+ ModuleId {
+ relative_path: "F",
+ query_string: "",
+ },
+]
+modules: [
+ ModuleId {
+ relative_path: "A",
+ query_string: "",
+ },
+ ModuleId {
+ relative_path: "C",
+ query_string: "",
+ },
+]
+resources: []
+
+-------
+
+name: B_2f5d
+id: B_2f5d
+immutable: false
+resource_pot_type: Js
+entry: Some(
+ ModuleId {
+ relative_path: "B",
+ query_string: "",
+ },
+)
+module_groups: [
+ ModuleId {
+ relative_path: "B",
+ query_string: "",
+ },
+]
+modules: [
+ ModuleId {
+ relative_path: "B",
+ query_string: "",
+ },
+ ModuleId {
+ relative_path: "E",
+ query_string: "",
+ },
+]
+resources: []
+
+-------
+
+name: B_3f39
+id: B_3f39
+immutable: false
+resource_pot_type: Js
+entry: None
+module_groups: [
+ ModuleId {
+ relative_path: "B",
+ query_string: "",
+ },
+ ModuleId {
+ relative_path: "D",
+ query_string: "",
+ },
+]
+modules: [
+ ModuleId {
+ relative_path: "D",
+ query_string: "",
+ },
+]
+resources: []
+
+-------
+
+name: G_333e
+id: G_333e
+immutable: false
+resource_pot_type: Js
+entry: None
+module_groups: [
+ ModuleId {
+ relative_path: "G",
+ query_string: "",
+ },
+]
+modules: [
+ ModuleId {
+ relative_path: "G",
+ query_string: "",
+ },
+]
+resources: []
diff --git a/crates/compiler/src/generate/snapshots/generate_resource_pot_map-5.snap b/crates/compiler/src/generate/snapshots/generate_resource_pot_map-5.snap
index 52473273b..6f4597436 100644
--- a/crates/compiler/src/generate/snapshots/generate_resource_pot_map-5.snap
+++ b/crates/compiler/src/generate/snapshots/generate_resource_pot_map-5.snap
@@ -1,66 +1,148 @@
---
source: crates/compiler/src/generate/partial_bundling.rs
-input_file: crates/compiler/src/generate/partial_bundling.rs
+input_file: crates/testing_helpers/src/lib.rs
---
-(
- (
- "immutable",
- false,
- ),
- (
- "modules",
- [
- ModuleId {
- relative_path: "F",
- query_string: "",
- },
- ModuleId {
- relative_path: "H",
- query_string: "",
- },
- ],
- ),
- (
- "resource_pot_type",
- Custom(
- "__farm_unknown",
- ),
- ),
- (
- "name",
- "test",
- ),
- (
- "id",
- "test_custom(\"__farm_unknown\")",
- ),
- (
- "entry",
- None,
- ),
- (
- "resources",
- [],
- ),
- (
- "module_groups",
- [
- ModuleId {
- relative_path: "B",
- query_string: "",
- },
- ModuleId {
- relative_path: "D",
- query_string: "",
- },
- ModuleId {
- relative_path: "F",
- query_string: "",
- },
- ModuleId {
- relative_path: "G",
- query_string: "",
- },
- ],
- ),
+name: A_66be
+id: A_66be
+immutable: false
+resource_pot_type: Js
+entry: Some(
+ ModuleId {
+ relative_path: "A",
+ query_string: "",
+ },
)
+module_groups: [
+ ModuleId {
+ relative_path: "A",
+ query_string: "",
+ },
+ ModuleId {
+ relative_path: "F",
+ query_string: "",
+ },
+]
+modules: [
+ ModuleId {
+ relative_path: "A",
+ query_string: "",
+ },
+ ModuleId {
+ relative_path: "C",
+ query_string: "",
+ },
+]
+resources: []
+
+-------
+
+name: B_2f5d
+id: B_2f5d
+immutable: false
+resource_pot_type: Js
+entry: Some(
+ ModuleId {
+ relative_path: "B",
+ query_string: "",
+ },
+)
+module_groups: [
+ ModuleId {
+ relative_path: "B",
+ query_string: "",
+ },
+]
+modules: [
+ ModuleId {
+ relative_path: "B",
+ query_string: "",
+ },
+ ModuleId {
+ relative_path: "E",
+ query_string: "",
+ },
+]
+resources: []
+
+-------
+
+name: B_3f39
+id: B_3f39
+immutable: false
+resource_pot_type: Js
+entry: None
+module_groups: [
+ ModuleId {
+ relative_path: "B",
+ query_string: "",
+ },
+ ModuleId {
+ relative_path: "D",
+ query_string: "",
+ },
+]
+modules: [
+ ModuleId {
+ relative_path: "D",
+ query_string: "",
+ },
+]
+resources: []
+
+-------
+
+name: G_333e
+id: G_333e
+immutable: false
+resource_pot_type: Js
+entry: None
+module_groups: [
+ ModuleId {
+ relative_path: "G",
+ query_string: "",
+ },
+]
+modules: [
+ ModuleId {
+ relative_path: "G",
+ query_string: "",
+ },
+]
+resources: []
+
+-------
+
+name: test
+id: test_js
+immutable: false
+resource_pot_type: Js
+entry: None
+module_groups: [
+ ModuleId {
+ relative_path: "B",
+ query_string: "",
+ },
+ ModuleId {
+ relative_path: "D",
+ query_string: "",
+ },
+ ModuleId {
+ relative_path: "F",
+ query_string: "",
+ },
+ ModuleId {
+ relative_path: "G",
+ query_string: "",
+ },
+]
+modules: [
+ ModuleId {
+ relative_path: "F",
+ query_string: "",
+ },
+ ModuleId {
+ relative_path: "H",
+ query_string: "",
+ },
+]
+resources: []
diff --git a/crates/compiler/src/generate/snapshots/generate_resource_pot_map.snap b/crates/compiler/src/generate/snapshots/generate_resource_pot_map.snap
index 48258406c..6ba9809bf 100644
--- a/crates/compiler/src/generate/snapshots/generate_resource_pot_map.snap
+++ b/crates/compiler/src/generate/snapshots/generate_resource_pot_map.snap
@@ -1,63 +1,35 @@
---
source: crates/compiler/src/generate/partial_bundling.rs
-input_file: crates/compiler/src/generate/partial_bundling.rs
+input_file: crates/testing_helpers/src/lib.rs
---
-(
- (
- "immutable",
- false,
- ),
- (
- "modules",
- [
- ModuleId {
- relative_path: "A",
- query_string: "",
- },
- ModuleId {
- relative_path: "C",
- query_string: "",
- },
- ],
- ),
- (
- "resource_pot_type",
- Custom(
- "__farm_unknown",
- ),
- ),
- (
- "name",
- "A_66be",
- ),
- (
- "id",
- "A_66be",
- ),
- (
- "entry",
- Some(
- ModuleId {
- relative_path: "A",
- query_string: "",
- },
- ),
- ),
- (
- "resources",
- [],
- ),
- (
- "module_groups",
- [
- ModuleId {
- relative_path: "A",
- query_string: "",
- },
- ModuleId {
- relative_path: "F",
- query_string: "",
- },
- ],
- ),
+name: A_66be
+id: A_66be
+immutable: false
+resource_pot_type: Js
+entry: Some(
+ ModuleId {
+ relative_path: "A",
+ query_string: "",
+ },
)
+module_groups: [
+ ModuleId {
+ relative_path: "A",
+ query_string: "",
+ },
+ ModuleId {
+ relative_path: "F",
+ query_string: "",
+ },
+]
+modules: [
+ ModuleId {
+ relative_path: "A",
+ query_string: "",
+ },
+ ModuleId {
+ relative_path: "C",
+ query_string: "",
+ },
+]
+resources: []
diff --git a/crates/compiler/src/generate/snapshots/generate_resource_pot_map_external-2.snap b/crates/compiler/src/generate/snapshots/generate_resource_pot_map_external-2.snap
index 2d7fdedfc..e3b870fc0 100644
--- a/crates/compiler/src/generate/snapshots/generate_resource_pot_map_external-2.snap
+++ b/crates/compiler/src/generate/snapshots/generate_resource_pot_map_external-2.snap
@@ -1,59 +1,65 @@
---
source: crates/compiler/src/generate/partial_bundling.rs
-input_file: crates/compiler/src/generate/partial_bundling.rs
+input_file: crates/testing_helpers/src/lib.rs
---
-(
- (
- "immutable",
- false,
- ),
- (
- "modules",
- [
- ModuleId {
- relative_path: "B",
- query_string: "",
- },
- ModuleId {
- relative_path: "E",
- query_string: "",
- },
- ],
- ),
- (
- "resource_pot_type",
- Custom(
- "__farm_unknown",
- ),
- ),
- (
- "name",
- "B_2f5d",
- ),
- (
- "id",
- "B_2f5d",
- ),
- (
- "entry",
- Some(
- ModuleId {
- relative_path: "B",
- query_string: "",
- },
- ),
- ),
- (
- "resources",
- [],
- ),
- (
- "module_groups",
- [
- ModuleId {
- relative_path: "B",
- query_string: "",
- },
- ],
- ),
+name: A_66be
+id: A_66be
+immutable: false
+resource_pot_type: Js
+entry: Some(
+ ModuleId {
+ relative_path: "A",
+ query_string: "",
+ },
)
+module_groups: [
+ ModuleId {
+ relative_path: "A",
+ query_string: "",
+ },
+ ModuleId {
+ relative_path: "F",
+ query_string: "",
+ },
+]
+modules: [
+ ModuleId {
+ relative_path: "A",
+ query_string: "",
+ },
+ ModuleId {
+ relative_path: "C",
+ query_string: "",
+ },
+]
+resources: []
+
+-------
+
+name: B_2f5d
+id: B_2f5d
+immutable: false
+resource_pot_type: Js
+entry: Some(
+ ModuleId {
+ relative_path: "B",
+ query_string: "",
+ },
+)
+module_groups: [
+ ModuleId {
+ relative_path: "B",
+ query_string: "",
+ },
+]
+modules: [
+ ModuleId {
+ relative_path: "B",
+ query_string: "",
+ },
+ ModuleId {
+ relative_path: "E",
+ query_string: "",
+ },
+]
+resources: []
diff --git a/crates/compiler/src/generate/snapshots/generate_resource_pot_map_external-3.snap b/crates/compiler/src/generate/snapshots/generate_resource_pot_map_external-3.snap
index 0f4dee256..17c211f26 100644
--- a/crates/compiler/src/generate/snapshots/generate_resource_pot_map_external-3.snap
+++ b/crates/compiler/src/generate/snapshots/generate_resource_pot_map_external-3.snap
@@ -1,54 +1,90 @@
---
source: crates/compiler/src/generate/partial_bundling.rs
-input_file: crates/compiler/src/generate/partial_bundling.rs
+input_file: crates/testing_helpers/src/lib.rs
---
-(
- (
- "immutable",
- false,
- ),
- (
- "modules",
- [
- ModuleId {
- relative_path: "D",
- query_string: "",
- },
- ],
- ),
- (
- "resource_pot_type",
- Custom(
- "__farm_unknown",
- ),
- ),
- (
- "name",
- "B_3f39",
- ),
- (
- "id",
- "B_3f39",
- ),
- (
- "entry",
- None,
- ),
- (
- "resources",
- [],
- ),
- (
- "module_groups",
- [
- ModuleId {
- relative_path: "B",
- query_string: "",
- },
- ModuleId {
- relative_path: "D",
- query_string: "",
- },
- ],
- ),
+name: A_66be
+id: A_66be
+immutable: false
+resource_pot_type: Js
+entry: Some(
+ ModuleId {
+ relative_path: "A",
+ query_string: "",
+ },
)
+module_groups: [
+ ModuleId {
+ relative_path: "A",
+ query_string: "",
+ },
+ ModuleId {
+ relative_path: "F",
+ query_string: "",
+ },
+]
+modules: [
+ ModuleId {
+ relative_path: "A",
+ query_string: "",
+ },
+ ModuleId {
+ relative_path: "C",
+ query_string: "",
+ },
+]
+resources: []
+
+-------
+
+name: B_2f5d
+id: B_2f5d
+immutable: false
+resource_pot_type: Js
+entry: Some(
+ ModuleId {
+ relative_path: "B",
+ query_string: "",
+ },
+)
+module_groups: [
+ ModuleId {
+ relative_path: "B",
+ query_string: "",
+ },
+]
+modules: [
+ ModuleId {
+ relative_path: "B",
+ query_string: "",
+ },
+ ModuleId {
+ relative_path: "E",
+ query_string: "",
+ },
+]
+resources: []
+
+-------
+
+name: B_3f39
+id: B_3f39
+immutable: false
+resource_pot_type: Js
+entry: None
+module_groups: [
+ ModuleId {
+ relative_path: "B",
+ query_string: "",
+ },
+ ModuleId {
+ relative_path: "D",
+ query_string: "",
+ },
+]
+modules: [
+ ModuleId {
+ relative_path: "D",
+ query_string: "",
+ },
+]
+resources: []
diff --git a/crates/compiler/src/generate/snapshots/generate_resource_pot_map_external-4.snap b/crates/compiler/src/generate/snapshots/generate_resource_pot_map_external-4.snap
index 02b861b4a..0a98b81b3 100644
--- a/crates/compiler/src/generate/snapshots/generate_resource_pot_map_external-4.snap
+++ b/crates/compiler/src/generate/snapshots/generate_resource_pot_map_external-4.snap
@@ -1,50 +1,111 @@
---
source: crates/compiler/src/generate/partial_bundling.rs
-input_file: crates/compiler/src/generate/partial_bundling.rs
+input_file: crates/testing_helpers/src/lib.rs
---
-(
- (
- "immutable",
- false,
- ),
- (
- "modules",
- [
- ModuleId {
- relative_path: "F",
- query_string: "",
- },
- ],
- ),
- (
- "resource_pot_type",
- Custom(
- "__farm_unknown",
- ),
- ),
- (
- "name",
- "F_f67a",
- ),
- (
- "id",
- "F_f67a",
- ),
- (
- "entry",
- None,
- ),
- (
- "resources",
- [],
- ),
- (
- "module_groups",
- [
- ModuleId {
- relative_path: "F",
- query_string: "",
- },
- ],
- ),
+name: A_66be
+id: A_66be
+immutable: false
+resource_pot_type: Js
+entry: Some(
+ ModuleId {
+ relative_path: "A",
+ query_string: "",
+ },
)
+module_groups: [
+ ModuleId {
+ relative_path: "A",
+ query_string: "",
+ },
+ ModuleId {
+ relative_path: "F",
+ query_string: "",
+ },
+]
+modules: [
+ ModuleId {
+ relative_path: "A",
+ query_string: "",
+ },
+ ModuleId {
+ relative_path: "C",
+ query_string: "",
+ },
+]
+resources: []
+
+-------
+
+name: B_2f5d
+id: B_2f5d
+immutable: false
+resource_pot_type: Js
+entry: Some(
+ ModuleId {
+ relative_path: "B",
+ query_string: "",
+ },
+)
+module_groups: [
+ ModuleId {
+ relative_path: "B",
+ query_string: "",
+ },
+]
+modules: [
+ ModuleId {
+ relative_path: "B",
+ query_string: "",
+ },
+ ModuleId {
+ relative_path: "E",
+ query_string: "",
+ },
+]
+resources: []
+
+-------
+
+name: B_3f39
+id: B_3f39
+immutable: false
+resource_pot_type: Js
+entry: None
+module_groups: [
+ ModuleId {
+ relative_path: "B",
+ query_string: "",
+ },
+ ModuleId {
+ relative_path: "D",
+ query_string: "",
+ },
+]
+modules: [
+ ModuleId {
+ relative_path: "D",
+ query_string: "",
+ },
+]
+resources: []
+
+-------
+
+name: F_f67a
+id: F_f67a
+immutable: false
+resource_pot_type: Js
+entry: None
+module_groups: [
+ ModuleId {
+ relative_path: "F",
+ query_string: "",
+ },
+]
+modules: [
+ ModuleId {
+ relative_path: "F",
+ query_string: "",
+ },
+]
+resources: []
diff --git a/crates/compiler/src/generate/snapshots/generate_resource_pot_map_external-5.snap b/crates/compiler/src/generate/snapshots/generate_resource_pot_map_external-5.snap
index fadc33416..d085692de 100644
--- a/crates/compiler/src/generate/snapshots/generate_resource_pot_map_external-5.snap
+++ b/crates/compiler/src/generate/snapshots/generate_resource_pot_map_external-5.snap
@@ -1,50 +1,132 @@
---
source: crates/compiler/src/generate/partial_bundling.rs
-input_file: crates/compiler/src/generate/partial_bundling.rs
+input_file: crates/testing_helpers/src/lib.rs
---
-(
- (
- "immutable",
- false,
- ),
- (
- "modules",
- [
- ModuleId {
- relative_path: "G",
- query_string: "",
- },
- ],
- ),
- (
- "resource_pot_type",
- Custom(
- "__farm_unknown",
- ),
- ),
- (
- "name",
- "G_333e",
- ),
- (
- "id",
- "G_333e",
- ),
- (
- "entry",
- None,
- ),
- (
- "resources",
- [],
- ),
- (
- "module_groups",
- [
- ModuleId {
- relative_path: "G",
- query_string: "",
- },
- ],
- ),
+name: A_66be
+id: A_66be
+immutable: false
+resource_pot_type: Js
+entry: Some(
+ ModuleId {
+ relative_path: "A",
+ query_string: "",
+ },
)
+module_groups: [
+ ModuleId {
+ relative_path: "A",
+ query_string: "",
+ },
+ ModuleId {
+ relative_path: "F",
+ query_string: "",
+ },
+]
+modules: [
+ ModuleId {
+ relative_path: "A",
+ query_string: "",
+ },
+ ModuleId {
+ relative_path: "C",
+ query_string: "",
+ },
+]
+resources: []
+
+-------
+
+name: B_2f5d
+id: B_2f5d
+immutable: false
+resource_pot_type: Js
+entry: Some(
+ ModuleId {
+ relative_path: "B",
+ query_string: "",
+ },
+)
+module_groups: [
+ ModuleId {
+ relative_path: "B",
+ query_string: "",
+ },
+]
+modules: [
+ ModuleId {
+ relative_path: "B",
+ query_string: "",
+ },
+ ModuleId {
+ relative_path: "E",
+ query_string: "",
+ },
+]
+resources: []
+
+-------
+
+name: B_3f39
+id: B_3f39
+immutable: false
+resource_pot_type: Js
+entry: None
+module_groups: [
+ ModuleId {
+ relative_path: "B",
+ query_string: "",
+ },
+ ModuleId {
+ relative_path: "D",
+ query_string: "",
+ },
+]
+modules: [
+ ModuleId {
+ relative_path: "D",
+ query_string: "",
+ },
+]
+resources: []
+
+-------
+
+name: F_f67a
+id: F_f67a
+immutable: false
+resource_pot_type: Js
+entry: None
+module_groups: [
+ ModuleId {
+ relative_path: "F",
+ query_string: "",
+ },
+]
+modules: [
+ ModuleId {
+ relative_path: "F",
+ query_string: "",
+ },
+]
+resources: []
+
+-------
+
+name: G_333e
+id: G_333e
+immutable: false
+resource_pot_type: Js
+entry: None
+module_groups: [
+ ModuleId {
+ relative_path: "G",
+ query_string: "",
+ },
+]
+modules: [
+ ModuleId {
+ relative_path: "G",
+ query_string: "",
+ },
+]
+resources: []
diff --git a/crates/compiler/src/generate/snapshots/generate_resource_pot_map_external.snap b/crates/compiler/src/generate/snapshots/generate_resource_pot_map_external.snap
index 48258406c..6ba9809bf 100644
--- a/crates/compiler/src/generate/snapshots/generate_resource_pot_map_external.snap
+++ b/crates/compiler/src/generate/snapshots/generate_resource_pot_map_external.snap
@@ -1,63 +1,35 @@
---
source: crates/compiler/src/generate/partial_bundling.rs
-input_file: crates/compiler/src/generate/partial_bundling.rs
+input_file: crates/testing_helpers/src/lib.rs
---
-(
- (
- "immutable",
- false,
- ),
- (
- "modules",
- [
- ModuleId {
- relative_path: "A",
- query_string: "",
- },
- ModuleId {
- relative_path: "C",
- query_string: "",
- },
- ],
- ),
- (
- "resource_pot_type",
- Custom(
- "__farm_unknown",
- ),
- ),
- (
- "name",
- "A_66be",
- ),
- (
- "id",
- "A_66be",
- ),
- (
- "entry",
- Some(
- ModuleId {
- relative_path: "A",
- query_string: "",
- },
- ),
- ),
- (
- "resources",
- [],
- ),
- (
- "module_groups",
- [
- ModuleId {
- relative_path: "A",
- query_string: "",
- },
- ModuleId {
- relative_path: "F",
- query_string: "",
- },
- ],
- ),
+name: A_66be
+id: A_66be
+immutable: false
+resource_pot_type: Js
+entry: Some(
+ ModuleId {
+ relative_path: "A",
+ query_string: "",
+ },
)
+module_groups: [
+ ModuleId {
+ relative_path: "A",
+ query_string: "",
+ },
+ ModuleId {
+ relative_path: "F",
+ query_string: "",
+ },
+]
+modules: [
+ ModuleId {
+ relative_path: "A",
+ query_string: "",
+ },
+ ModuleId {
+ relative_path: "C",
+ query_string: "",
+ },
+]
+resources: []
diff --git a/crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/snapshots/generate_and_diff_resource_pots-10.snap b/crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/snapshots/generate_and_diff_resource_pots-10.snap
index 729599936..fac352c38 100644
--- a/crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/snapshots/generate_and_diff_resource_pots-10.snap
+++ b/crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/snapshots/generate_and_diff_resource_pots-10.snap
@@ -1,59 +1,31 @@
---
source: crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/test_generate_and_diff_resource_pots.rs
-input_file: crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/test_generate_and_diff_resource_pots.rs
+input_file: crates/testing_helpers/src/lib.rs
---
-(
- (
- "immutable",
- false,
- ),
- (
- "modules",
- [
- ModuleId {
- relative_path: "A",
- query_string: "",
- },
- ModuleId {
- relative_path: "C",
- query_string: "",
- },
- ],
- ),
- (
- "resource_pot_type",
- Custom(
- "__farm_unknown",
- ),
- ),
- (
- "name",
- "A_66be",
- ),
- (
- "id",
- "A_66be",
- ),
- (
- "entry",
- Some(
- ModuleId {
- relative_path: "A",
- query_string: "",
- },
- ),
- ),
- (
- "resources",
- [],
- ),
- (
- "module_groups",
- [
- ModuleId {
- relative_path: "A",
- query_string: "",
- },
- ],
- ),
+name: A_66be
+id: A_66be
+immutable: false
+resource_pot_type: Js
+entry: Some(
+ ModuleId {
+ relative_path: "A",
+ query_string: "",
+ },
)
+module_groups: [
+ ModuleId {
+ relative_path: "A",
+ query_string: "",
+ },
+]
+modules: [
+ ModuleId {
+ relative_path: "A",
+ query_string: "",
+ },
+ ModuleId {
+ relative_path: "C",
+ query_string: "",
+ },
+]
+resources: []
diff --git a/crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/snapshots/generate_and_diff_resource_pots-11.snap b/crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/snapshots/generate_and_diff_resource_pots-11.snap
index 99b0ee8c5..8ae01fea3 100644
--- a/crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/snapshots/generate_and_diff_resource_pots-11.snap
+++ b/crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/snapshots/generate_and_diff_resource_pots-11.snap
@@ -1,59 +1,61 @@
---
source: crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/test_generate_and_diff_resource_pots.rs
-input_file: crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/test_generate_and_diff_resource_pots.rs
+input_file: crates/testing_helpers/src/lib.rs
---
-(
- (
- "immutable",
- false,
- ),
- (
- "modules",
- [
- ModuleId {
- relative_path: "B",
- query_string: "",
- },
- ModuleId {
- relative_path: "E",
- query_string: "",
- },
- ],
- ),
- (
- "resource_pot_type",
- Custom(
- "__farm_unknown",
- ),
- ),
- (
- "name",
- "B_2f5d",
- ),
- (
- "id",
- "B_2f5d",
- ),
- (
- "entry",
- Some(
- ModuleId {
- relative_path: "B",
- query_string: "",
- },
- ),
- ),
- (
- "resources",
- [],
- ),
- (
- "module_groups",
- [
- ModuleId {
- relative_path: "B",
- query_string: "",
- },
- ],
- ),
+name: A_66be
+id: A_66be
+immutable: false
+resource_pot_type: Js
+entry: Some(
+ ModuleId {
+ relative_path: "A",
+ query_string: "",
+ },
)
+module_groups: [
+ ModuleId {
+ relative_path: "A",
+ query_string: "",
+ },
+]
+modules: [
+ ModuleId {
+ relative_path: "A",
+ query_string: "",
+ },
+ ModuleId {
+ relative_path: "C",
+ query_string: "",
+ },
+]
+resources: []
+
+-------
+
+name: B_2f5d
+id: B_2f5d
+immutable: false
+resource_pot_type: Js
+entry: Some(
+ ModuleId {
+ relative_path: "B",
+ query_string: "",
+ },
+)
+module_groups: [
+ ModuleId {
+ relative_path: "B",
+ query_string: "",
+ },
+]
+modules: [
+ ModuleId {
+ relative_path: "B",
+ query_string: "",
+ },
+ ModuleId {
+ relative_path: "E",
+ query_string: "",
+ },
+]
+resources: []
diff --git a/crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/snapshots/generate_and_diff_resource_pots-12.snap b/crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/snapshots/generate_and_diff_resource_pots-12.snap
index b83015b73..2e0d39f3b 100644
--- a/crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/snapshots/generate_and_diff_resource_pots-12.snap
+++ b/crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/snapshots/generate_and_diff_resource_pots-12.snap
@@ -1,54 +1,86 @@
---
source: crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/test_generate_and_diff_resource_pots.rs
-input_file: crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/test_generate_and_diff_resource_pots.rs
+input_file: crates/testing_helpers/src/lib.rs
---
-(
- (
- "immutable",
- false,
- ),
- (
- "modules",
- [
- ModuleId {
- relative_path: "D",
- query_string: "",
- },
- ],
- ),
- (
- "resource_pot_type",
- Custom(
- "__farm_unknown",
- ),
- ),
- (
- "name",
- "B_3f39",
- ),
- (
- "id",
- "B_3f39",
- ),
- (
- "entry",
- None,
- ),
- (
- "resources",
- [],
- ),
- (
- "module_groups",
- [
- ModuleId {
- relative_path: "B",
- query_string: "",
- },
- ModuleId {
- relative_path: "D",
- query_string: "",
- },
- ],
- ),
+name: A_66be
+id: A_66be
+immutable: false
+resource_pot_type: Js
+entry: Some(
+ ModuleId {
+ relative_path: "A",
+ query_string: "",
+ },
)
+module_groups: [
+ ModuleId {
+ relative_path: "A",
+ query_string: "",
+ },
+]
+modules: [
+ ModuleId {
+ relative_path: "A",
+ query_string: "",
+ },
+ ModuleId {
+ relative_path: "C",
+ query_string: "",
+ },
+]
+resources: []
+
+-------
+
+name: B_2f5d
+id: B_2f5d
+immutable: false
+resource_pot_type: Js
+entry: Some(
+ ModuleId {
+ relative_path: "B",
+ query_string: "",
+ },
+)
+module_groups: [
+ ModuleId {
+ relative_path: "B",
+ query_string: "",
+ },
+]
+modules: [
+ ModuleId {
+ relative_path: "B",
+ query_string: "",
+ },
+ ModuleId {
+ relative_path: "E",
+ query_string: "",
+ },
+]
+resources: []
+
+-------
+
+name: B_3f39
+id: B_3f39
+immutable: false
+resource_pot_type: Js
+entry: None
+module_groups: [
+ ModuleId {
+ relative_path: "B",
+ query_string: "",
+ },
+ ModuleId {
+ relative_path: "D",
+ query_string: "",
+ },
+]
+modules: [
+ ModuleId {
+ relative_path: "D",
+ query_string: "",
+ },
+]
+resources: []
diff --git a/crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/snapshots/generate_and_diff_resource_pots-13.snap b/crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/snapshots/generate_and_diff_resource_pots-13.snap
index 63f02ffbb..70890a654 100644
--- a/crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/snapshots/generate_and_diff_resource_pots-13.snap
+++ b/crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/snapshots/generate_and_diff_resource_pots-13.snap
@@ -1,58 +1,107 @@
---
source: crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/test_generate_and_diff_resource_pots.rs
-input_file: crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/test_generate_and_diff_resource_pots.rs
+input_file: crates/testing_helpers/src/lib.rs
---
-(
- (
- "immutable",
- false,
- ),
- (
- "modules",
- [
- ModuleId {
- relative_path: "F",
- query_string: "",
- },
- ModuleId {
- relative_path: "H",
- query_string: "",
- },
- ],
- ),
- (
- "resource_pot_type",
- Custom(
- "__farm_unknown",
- ),
- ),
- (
- "name",
- "test",
- ),
- (
- "id",
- "test_custom(\"__farm_unknown\")",
- ),
- (
- "entry",
- None,
- ),
- (
- "resources",
- [],
- ),
- (
- "module_groups",
- [
- ModuleId {
- relative_path: "B",
- query_string: "",
- },
- ModuleId {
- relative_path: "F",
- query_string: "",
- },
- ],
- ),
+name: A_66be
+id: A_66be
+immutable: false
+resource_pot_type: Js
+entry: Some(
+ ModuleId {
+ relative_path: "A",
+ query_string: "",
+ },
)
+module_groups: [
+ ModuleId {
+ relative_path: "A",
+ query_string: "",
+ },
+]
+modules: [
+ ModuleId {
+ relative_path: "A",
+ query_string: "",
+ },
+ ModuleId {
+ relative_path: "C",
+ query_string: "",
+ },
+]
+resources: []
+
+-------
+
+name: B_2f5d
+id: B_2f5d
+immutable: false
+resource_pot_type: Js
+entry: Some(
+ ModuleId {
+ relative_path: "B",
+ query_string: "",
+ },
+)
+module_groups: [
+ ModuleId {
+ relative_path: "B",
+ query_string: "",
+ },
+]
+modules: [
+ ModuleId {
+ relative_path: "B",
+ query_string: "",
+ },
+ ModuleId {
+ relative_path: "E",
+ query_string: "",
+ },
+]
+resources: []
+
+-------
+
+name: B_3f39
+id: B_3f39
+immutable: false
+resource_pot_type: Js
+entry: None
+module_groups: [
+ ModuleId {
+ relative_path: "B",
+ query_string: "",
+ },
+ ModuleId {
+ relative_path: "D",
+ query_string: "",
+ },
+]
+modules: [
+ ModuleId {
+ relative_path: "D",
+ query_string: "",
+ },
+]
+resources: []
+
+-------
+
+name: test
+id: test_custom("__farm_unknown")
+immutable: false
+resource_pot_type: Custom("__farm_unknown")
+entry: None
+module_groups: [
+ ModuleId {
+ relative_path: "B",
+ query_string: "",
+ },
+]
+modules: [
+ ModuleId {
+ relative_path: "H",
+ query_string: "",
+ },
+]
+resources: []
diff --git a/crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/snapshots/generate_and_diff_resource_pots-14.snap b/crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/snapshots/generate_and_diff_resource_pots-14.snap
new file mode 100644
index 000000000..b05dbf147
--- /dev/null
+++ b/crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/snapshots/generate_and_diff_resource_pots-14.snap
@@ -0,0 +1,132 @@
+---
+source: crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/test_generate_and_diff_resource_pots.rs
+input_file: crates/testing_helpers/src/lib.rs
+---
+name: A_66be
+id: A_66be
+immutable: false
+resource_pot_type: Js
+entry: Some(
+ ModuleId {
+ relative_path: "A",
+ query_string: "",
+ },
+)
+module_groups: [
+ ModuleId {
+ relative_path: "A",
+ query_string: "",
+ },
+]
+modules: [
+ ModuleId {
+ relative_path: "A",
+ query_string: "",
+ },
+ ModuleId {
+ relative_path: "C",
+ query_string: "",
+ },
+]
+resources: []
+
+-------
+
+name: B_2f5d
+id: B_2f5d
+immutable: false
+resource_pot_type: Js
+entry: Some(
+ ModuleId {
+ relative_path: "B",
+ query_string: "",
+ },
+)
+module_groups: [
+ ModuleId {
+ relative_path: "B",
+ query_string: "",
+ },
+]
+modules: [
+ ModuleId {
+ relative_path: "B",
+ query_string: "",
+ },
+ ModuleId {
+ relative_path: "E",
+ query_string: "",
+ },
+]
+resources: []
+
+-------
+
+name: B_3f39
+id: B_3f39
+immutable: false
+resource_pot_type: Js
+entry: None
+module_groups: [
+ ModuleId {
+ relative_path: "B",
+ query_string: "",
+ },
+ ModuleId {
+ relative_path: "D",
+ query_string: "",
+ },
+]
+modules: [
+ ModuleId {
+ relative_path: "D",
+ query_string: "",
+ },
+]
+resources: []
+
+-------
+
+name: test
+id: test_custom("__farm_unknown")
+immutable: false
+resource_pot_type: Custom("__farm_unknown")
+entry: None
+module_groups: [
+ ModuleId {
+ relative_path: "B",
+ query_string: "",
+ },
+]
+modules: [
+ ModuleId {
+ relative_path: "H",
+ query_string: "",
+ },
+]
+resources: []
+
+-------
+
+name: test
+id: test_js
+immutable: false
+resource_pot_type: Js
+entry: None
+module_groups: [
+ ModuleId {
+ relative_path: "B",
+ query_string: "",
+ },
+ ModuleId {
+ relative_path: "F",
+ query_string: "",
+ },
+]
+modules: [
+ ModuleId {
+ relative_path: "F",
+ query_string: "",
+ },
+]
+resources: []
diff --git a/crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/snapshots/generate_and_diff_resource_pots-3.snap b/crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/snapshots/generate_and_diff_resource_pots-3.snap
index f757f9607..11e21b036 100644
--- a/crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/snapshots/generate_and_diff_resource_pots-3.snap
+++ b/crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/snapshots/generate_and_diff_resource_pots-3.snap
@@ -1,9 +1,10 @@
---
source: crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/test_generate_and_diff_resource_pots.rs
-input_file: crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/test_generate_and_diff_resource_pots.rs
+input_file: crates/testing_helpers/src/lib.rs
---
[
"B_2f5d",
"B_3f39",
"test_custom(\"__farm_unknown\")",
+ "test_js",
]
diff --git a/crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/snapshots/generate_and_diff_resource_pots-5.snap b/crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/snapshots/generate_and_diff_resource_pots-5.snap
index b706ee71c..c04ee311d 100644
--- a/crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/snapshots/generate_and_diff_resource_pots-5.snap
+++ b/crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/snapshots/generate_and_diff_resource_pots-5.snap
@@ -1,7 +1,7 @@
---
source: crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/test_generate_and_diff_resource_pots.rs
-input_file: crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/test_generate_and_diff_resource_pots.rs
+input_file: crates/testing_helpers/src/lib.rs
---
[
- "test_custom(\"__farm_unknown\")",
+ "test_js",
]
diff --git a/crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/snapshots/generate_and_diff_resource_pots-6.snap b/crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/snapshots/generate_and_diff_resource_pots-6.snap
index 200d659e7..674b2da51 100644
--- a/crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/snapshots/generate_and_diff_resource_pots-6.snap
+++ b/crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/snapshots/generate_and_diff_resource_pots-6.snap
@@ -1,5 +1,5 @@
---
source: crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/test_generate_and_diff_resource_pots.rs
-input_file: crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/test_generate_and_diff_resource_pots.rs
+input_file: crates/testing_helpers/src/lib.rs
---
-"test_custom(\"__farm_unknown\")"
+"test_js"
diff --git a/crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/snapshots/generate_and_diff_resource_pots.snap b/crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/snapshots/generate_and_diff_resource_pots.snap
index b706ee71c..f88bfb4f2 100644
--- a/crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/snapshots/generate_and_diff_resource_pots.snap
+++ b/crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/snapshots/generate_and_diff_resource_pots.snap
@@ -1,7 +1,9 @@
---
source: crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/test_generate_and_diff_resource_pots.rs
+assertion_line: 105
input_file: crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/test_generate_and_diff_resource_pots.rs
---
[
"test_custom(\"__farm_unknown\")",
+ "test_js",
]
diff --git a/crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/test_handle_enforce_resource_pots.rs b/crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/test_handle_enforce_resource_pots.rs
index 9a143735f..101057d10 100644
--- a/crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/test_handle_enforce_resource_pots.rs
+++ b/crates/compiler/src/update/regenerate_resources/generate_and_diff_resource_pots/test_handle_enforce_resource_pots.rs
@@ -6,7 +6,7 @@ use farmfe_core::{
config_regex::ConfigRegex, partial_bundling::PartialBundlingEnforceResourceConfig, Config,
}, context::CompilationContext, farm_profile_function, module::{
module_graph::{ModuleGraphEdge, ModuleGraphEdgeDataItem},
- Module,
+ Module, ModuleType,
}, plugin::{Plugin, PluginHookContext, ResolveKind}
};
use farmfe_plugin_partial_bundling::module_group_graph_from_entries;
@@ -30,7 +30,13 @@ fn test_handle_enforce_resource_pots() {
update_module_graph
.remove_edge(&"F".into(), &"A".into())
.unwrap();
- update_module_graph.add_module(Module::new("H".into()));
+ update_module_graph.add_module({
+ let mut m = Module::new("H".into());
+
+ m.module_type = ModuleType::Js;
+
+ m
+ });
update_module_graph
.add_edge(&"B".into(), &"H".into(), Default::default())
.unwrap();
@@ -124,7 +130,7 @@ fn test_handle_enforce_resource_pots() {
assert_eq!(
enforce_resource_pots,
- vec!["test_custom(\"__farm_unknown\")".to_string()]
+ vec!["test_js".to_string()]
);
un_enforce_resource_pots.sort();
assert_eq!(
diff --git a/crates/compiler/tests/bundle.rs b/crates/compiler/tests/bundle.rs
index 5ec5b8149..93d9eb4e4 100644
--- a/crates/compiler/tests/bundle.rs
+++ b/crates/compiler/tests/bundle.rs
@@ -1,21 +1,21 @@
use std::{collections::HashMap, path::PathBuf};
-use farmfe_core::config::{bool_or_obj::BoolOrObj, config_regex::ConfigRegex, Mode, TargetEnv};
+use farmfe_core::config::{
+ bool_or_obj::BoolOrObj, config_regex::ConfigRegex,
+ partial_bundling::PartialBundlingEnforceResourceConfig, Mode, TargetEnv,
+};
mod common;
use crate::common::{
assert_compiler_result_with_config, create_compiler_with_args, AssertCompilerResultConfig,
};
+use farmfe_core::config::Config;
#[allow(dead_code)]
#[cfg(test)]
-fn test(file: String, crate_path: String) {
- use std::fs;
-
- use common::get_config_field;
+fn test(file: String, crate_path: String, f: Option) {
+ use common::{format_output_name, get_dir_config_files, try_merge_config_file};
use farmfe_core::config::partial_bundling::PartialBundlingEnforceResourceConfig;
- use crate::common::try_read_config_from_json;
-
let file_path_buf = PathBuf::from(file.clone());
let create_path_buf = PathBuf::from(crate_path);
let cwd = file_path_buf.parent().unwrap();
@@ -23,42 +23,15 @@ fn test(file: String, crate_path: String) {
let entry_name = "index".to_string();
+ let files = get_dir_config_files(cwd);
let runtime_entry = cwd.to_path_buf().join("runtime.ts");
- let files = fs::read_dir(cwd)
- .unwrap()
- .filter_map(|item| item.map(|item| Some(item)).unwrap_or(None))
- .filter_map(|item| {
- let filename = item
- .path()
- .file_name()
- .unwrap_or_default()
- .to_string_lossy()
- .to_string();
-
- if filename.starts_with("config") || filename.ends_with(".json") {
- Some((
- item.path(),
- filename
- .trim_start_matches("config")
- .trim_start_matches(".")
- .trim_end_matches("json")
- .trim_end_matches(".")
- .to_string(),
- ))
- } else {
- None
- }
- })
- .collect::>();
-
- for (config_entry, config_named) in files {
- let config_from_file = try_read_config_from_json(config_entry);
+ for (name, config_entry) in files {
let compiler = create_compiler_with_args(
cwd.to_path_buf(),
create_path_buf.clone(),
|mut config, plugins| {
- config.mode = Mode::Production;
+ config.mode = Mode::Development;
if runtime_entry.is_file() {
let runtime_entry = runtime_entry.to_string_lossy().to_string();
@@ -71,7 +44,8 @@ fn test(file: String, crate_path: String) {
config.tree_shaking = Box::new(BoolOrObj::Bool(false));
config.external = vec![ConfigRegex::new("(^node:.*)"), ConfigRegex::new("^fs$")];
- config.output.target_env = TargetEnv::Node;
+ config.output.target_env = TargetEnv::Custom("library-node".to_string());
+ config.resolve.auto_external_failed_resolve = true;
// config.output.format = ModuleFormat::CommonJs;
// TODO: multiple bundle
@@ -80,18 +54,10 @@ fn test(file: String, crate_path: String) {
name: "index".to_string(),
}];
- if let Some(config_from_file) = config_from_file {
- if let Some(mode) = get_config_field(&config_from_file, &["mode"]) {
- config.mode = mode;
- }
+ config = try_merge_config_file(config, config_entry);
- if let Some(format) = get_config_field(&config_from_file, &["output", "format"]) {
- config.output.format = format;
- }
-
- if let Some(target_env) = get_config_field(&config_from_file, &["output", "targetEnv"]) {
- config.output.target_env = target_env;
- }
+ if let Some(f) = f.as_ref() {
+ f(&mut config);
}
(config, plugins)
@@ -104,21 +70,37 @@ fn test(file: String, crate_path: String) {
&compiler,
AssertCompilerResultConfig {
entry_name: Some(entry_name.clone()),
+ output_file: Some(format_output_name(name)),
ignore_emitted_field: false,
- output_file: Some(format!(
- "output.{}js",
- if config_named.is_empty() {
- "".into()
- } else {
- format!("{config_named}.")
- }
- )),
..Default::default()
},
);
}
}
-farmfe_testing::testing! {"tests/fixtures/bundle/library/**/index.ts", test}
-// farmfe_testing::testing! {"tests/fixtures/runtime/bundle/cjs/export/entryExportStar/**/index.ts", test}
-// farmfe_testing::testing! {"tests/fixtures/runtime/bundle/external/import/namespace/**/index.ts", test}
+fn single_bundle_test(file: String, crate_path: String) {
+ test(file, crate_path, None::);
+}
+
+fn multiple_bundle_test(file: String, crate_path: String) {
+ test(
+ file,
+ crate_path,
+ Some(|config: &mut Config| {
+ config.partial_bundling.enforce_resources = vec![PartialBundlingEnforceResourceConfig {
+ name: "bundle1".to_string(),
+ test: vec![ConfigRegex::new("^bundle2.+")],
+ }];
+ }),
+ );
+}
+
+// farmfe_testing::testing! {"tests/fixtures/bundle/library/reexport/reexport_hybrid_cjs/namespace/**/index.ts", single_bundle_test}
+
+farmfe_testing::testing! {
+ "tests/fixtures/bundle/**/index.ts",
+ // "tests/fixtures/bundle/library/reexport/use_external_reexport/**/index.ts",
+ // "tests/fixtures/bundle/library/reexport/reexport/**/index.ts",
+ // "tests/fixtures/bundle/library/reexport/reexport_hybrid_cjs/default/**/index.ts",
+ multiple_bundle_test
+}
diff --git a/crates/compiler/tests/common/mod.rs b/crates/compiler/tests/common/mod.rs
index 2c5c43cf2..5e8fd91c7 100644
--- a/crates/compiler/tests/common/mod.rs
+++ b/crates/compiler/tests/common/mod.rs
@@ -1,4 +1,9 @@
-use std::{collections::HashMap, path::PathBuf, sync::Arc};
+use std::{
+ collections::HashMap,
+ fs,
+ path::{Path, PathBuf},
+ sync::Arc,
+};
use farmfe_compiler::Compiler;
use farmfe_core::{
@@ -107,6 +112,48 @@ pub fn try_read_config_from_json(path: PathBuf) -> Option {
farmfe_core::serde_json::from_str(&content).unwrap()
}
+#[allow(dead_code)]
+pub fn merge_config(v1: Value, v2: Value) -> Value {
+ match (v1, v2) {
+ (Value::Array(mut a1), Value::Array(a2)) => {
+ for item in a2 {
+ a1.push(item);
+ }
+
+ Value::Array(a1)
+ }
+
+ (Value::Object(mut o1), Value::Object(o2)) => {
+ for (key, val) in o2 {
+ if let Some(left_value) = o1.remove(&key) {
+ o1.insert(key, merge_config(left_value, val));
+ } else {
+ o1.insert(key, val);
+ }
+ }
+
+ Value::Object(o1)
+ }
+
+ (_, v2) => v2,
+ }
+}
+
+#[allow(dead_code)]
+pub fn try_merge_config_file(origin: Config, file: PathBuf) -> Config {
+ let config_from_file = try_read_config_from_json(file);
+
+ if let Some(config_from_file) = config_from_file {
+ let origin: Value = serde_json::from_str(&serde_json::to_string(&origin).unwrap()).unwrap();
+
+ let origin = merge_config(origin, config_from_file);
+
+ return serde_json::from_value(origin).unwrap();
+ }
+
+ return origin;
+}
+
#[allow(dead_code)]
pub fn create_compiler_with_args(cwd: PathBuf, crate_path: PathBuf, handle: F) -> Compiler
where
@@ -309,15 +356,50 @@ pub fn assert_compiler_result(compiler: &Compiler, entry_name: Option<&String>)
}
#[allow(dead_code)]
-pub fn get_config_field(value: &Value, keys: &[&str]) -> Option {
- let mut v: &Value = value;
+pub fn get_dir_config_files(cwd: &Path) -> Vec<(String, PathBuf)> {
+ // println!("fs::read_dir(cwd): {:#?}", fs::read(format!("{}/", cwd.to_string_lossy().to_string())));
+ let mut files = fs::read_dir(cwd.to_path_buf())
+ .map(|item| {
+ item
+ .into_iter()
+ .filter_map(|file| match file {
+ Ok(v) => Some(v),
+ Err(_) => None,
+ })
+ .map(|v| v.path())
+ .filter(|v| v.is_file())
+ .filter(|v| {
+ let m = v.file_name().unwrap().to_string_lossy().to_string();
+ m.starts_with("config") && m.ends_with(".json")
+ })
+ .map(|v| {
+ let m = v.file_name().unwrap().to_string_lossy().to_string();
+
+ (
+ m.trim_start_matches("config")
+ .trim_start_matches(".")
+ .trim_end_matches("json")
+ .trim_end_matches(".")
+ .to_string(),
+ v,
+ )
+ })
+ .collect::>()
+ })
+ .unwrap_or_default();
- for key in keys.iter() {
- v = v.get(key)?;
+ if !files.iter().any(|(name, _)| name.is_empty()) {
+ files.push(("".to_string(), cwd.to_path_buf().join("config.json")));
}
- Some(
- serde_json::from_value(v.clone())
- .expect(format!("{} type is not correct", keys.join(".")).as_str()),
- )
+ files
+}
+
+#[allow(dead_code)]
+pub fn format_output_name(name: String) -> String {
+ if name.is_empty() {
+ return "output.js".to_string();
+ }
+
+ format!("output.{}.js", name)
}
diff --git a/crates/compiler/tests/fixtures/bundle/library/execute/bundle2.ts b/crates/compiler/tests/fixtures/bundle/library/execute/bundle2.ts
new file mode 100644
index 000000000..8f6945224
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/library/execute/bundle2.ts
@@ -0,0 +1,3 @@
+console.log('hello world');
+
+export default {}
\ No newline at end of file
diff --git a/crates/compiler/tests/fixtures/bundle/library/execute/index.ts b/crates/compiler/tests/fixtures/bundle/library/execute/index.ts
new file mode 100644
index 000000000..05885d4eb
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/library/execute/index.ts
@@ -0,0 +1 @@
+import './bundle2';
\ No newline at end of file
diff --git a/crates/compiler/tests/fixtures/bundle/library/execute/output.js b/crates/compiler/tests/fixtures/bundle/library/execute/output.js
new file mode 100644
index 000000000..21f3edd32
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/library/execute/output.js
@@ -0,0 +1,14 @@
+//bundle1.js:
+ // module_id: bundle2.ts
+console.log('hello world');
+var bundle2_default = {};
+export { bundle2_default };
+
+
+//farm_runtime.js:
+ // module_id: __FARM_BUNDLE_POLYFILL_SLOT__
+
+
+//index.js:
+ // module_id: index.ts
+import "./bundle1.js";
diff --git a/crates/compiler/tests/fixtures/bundle/library/external/importNamed/index.ts b/crates/compiler/tests/fixtures/bundle/library/external/importNamed/index.ts
new file mode 100644
index 000000000..1492523a8
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/library/external/importNamed/index.ts
@@ -0,0 +1,7 @@
+import { readFile as r1, readFileSync as r2 } from 'node:fs';
+
+
+const readFile = 1;
+const readFileSync = 2;
+
+console.log({ readFile, readFileSync, r1, r2 });
\ No newline at end of file
diff --git a/crates/compiler/tests/fixtures/bundle/library/external/importNamed/output.js b/crates/compiler/tests/fixtures/bundle/library/external/importNamed/output.js
new file mode 100644
index 000000000..0f8892197
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/library/external/importNamed/output.js
@@ -0,0 +1,15 @@
+//farm_runtime.js:
+ // module_id: __FARM_BUNDLE_POLYFILL_SLOT__
+
+
+//index.js:
+ // module_id: index.ts
+import { readFile as r1, readFileSync as r2 } from "node:fs";
+const readFile = 1;
+const readFileSync = 2;
+console.log({
+ readFile: readFile,
+ readFileSync: readFileSync,
+ r1: r1,
+ r2: r2
+});
diff --git a/crates/compiler/tests/fixtures/bundle/library/external/importNamespace/output.cjs.js b/crates/compiler/tests/fixtures/bundle/library/external/importNamespace/output.cjs.js
index 582bbe45a..9ecaeea13 100644
--- a/crates/compiler/tests/fixtures/bundle/library/external/importNamespace/output.cjs.js
+++ b/crates/compiler/tests/fixtures/bundle/library/external/importNamespace/output.cjs.js
@@ -1,21 +1,14 @@
-//index.js:
- function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
- }
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
+//farm_runtime.js:
+ // module_id: __FARM_BUNDLE_POLYFILL_SLOT__
+function _getRequireWildcardCache(nodeInterop) {
+ if (typeof WeakMap !== "function") return null;
+ var cacheBabelInterop = new WeakMap();
+ var cacheNodeInterop = new WeakMap();
+ return (_getRequireWildcardCache = function(nodeInterop) {
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
+ })(nodeInterop);
+}
+function _interop_require_wildcard(obj, nodeInterop) {
if (!nodeInterop && obj && obj.__esModule) return obj;
if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
default: obj
@@ -36,19 +29,32 @@
newObj.default = obj;
if (cache) cache.set(obj, newObj);
return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}var node_fs_ns = _interop_require_wildcard(require("node:fs"));
+}
+function _interop_require_default(obj) {
+ return obj && obj.__esModule ? obj : {
+ default: obj
+ };
+}
+module.exports._interop_require_default = _interop_require_default;
+module.exports._interop_require_wildcard = _interop_require_wildcard;
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+
+
+//index.js:
+ // module_id: a.ts
+var farm_runtime_js_ns = require("./farm_runtime.js");
+var _interop_require_default = farm_runtime_js_ns._interop_require_default, _interop_require_wildcard = farm_runtime_js_ns._interop_require_wildcard;
+var node_fs_ns = _interop_require_wildcard(require("node:fs"));
+var node_fs_ns = require("node:fs");
var fs$1 = _interop_require_default(node_fs_ns).default;
const fs = 'a.ts';
console.log(fs);
var a_default = 'a.ts';
+// module_id: b.ts
console.log('b.ts', node_fs_ns);
+// module_id: index.ts
console.log('index.ts', fs$1);
diff --git a/crates/compiler/tests/fixtures/bundle/library/external/importNamespace/output.js b/crates/compiler/tests/fixtures/bundle/library/external/importNamespace/output.js
index 35b6de91b..3f3db2e96 100644
--- a/crates/compiler/tests/fixtures/bundle/library/external/importNamespace/output.js
+++ b/crates/compiler/tests/fixtures/bundle/library/external/importNamespace/output.js
@@ -1,54 +1,17 @@
+//farm_runtime.js:
+ // module_id: __FARM_BUNDLE_POLYFILL_SLOT__
+
+
//index.js:
- function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
- }
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
- }
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}import * as node_fs_ns from "node:fs";
+ // module_id: a.ts
+import * as node_fs_ns from "node:fs";
import fs$1 from "node:fs";
const fs = 'a.ts';
console.log(fs);
var a_default = 'a.ts';
+// module_id: b.ts
console.log('b.ts', node_fs_ns);
+// module_id: index.ts
console.log('index.ts', fs$1);
diff --git a/crates/compiler/tests/fixtures/bundle/library/hybrid/defaultParams/bundle2-foo.ts b/crates/compiler/tests/fixtures/bundle/library/hybrid/defaultParams/bundle2-foo.ts
new file mode 100644
index 000000000..8eaf3cd75
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/library/hybrid/defaultParams/bundle2-foo.ts
@@ -0,0 +1,7 @@
+const foo = {
+ Provider: 'bundle2-foo',
+};
+
+export {
+ foo as ReactProvider
+};
\ No newline at end of file
diff --git a/crates/compiler/tests/fixtures/bundle/library/hybrid/defaultParams/foo.ts b/crates/compiler/tests/fixtures/bundle/library/hybrid/defaultParams/foo.ts
new file mode 100644
index 000000000..f4596d540
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/library/hybrid/defaultParams/foo.ts
@@ -0,0 +1 @@
+export const foo = 'foo';
\ No newline at end of file
diff --git a/crates/compiler/tests/fixtures/bundle/library/hybrid/defaultParams/index.ts b/crates/compiler/tests/fixtures/bundle/library/hybrid/defaultParams/index.ts
new file mode 100644
index 000000000..6ab0301ab
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/library/hybrid/defaultParams/index.ts
@@ -0,0 +1,35 @@
+import { foo as defaultFoo } from './foo';
+import { ReactProvider } from './bundle2-foo';
+
+
+function loadFoo(foo = defaultFoo) {
+ return
+}
+
+const loadFooArrowExpr = () => {
+ return (foo: string) => {
+ console.log(foo, ReactProvider.Provider);
+ }
+}
+
+class LoadFoo {
+ constructor(public foo = defaultFoo) {}
+
+ getFoo() {
+ return this.foo;
+ }
+}
+
+loadFoo();
+
+new LoadFoo();
+
+const bar = 2;
+
+function computed(bar = 1) {
+ return {
+ [bar]: 123,
+ [defaultFoo]: 234,
+ }
+}
+computed();
\ No newline at end of file
diff --git a/crates/compiler/tests/fixtures/bundle/library/hybrid/defaultParams/output.js b/crates/compiler/tests/fixtures/bundle/library/hybrid/defaultParams/output.js
new file mode 100644
index 000000000..e930df08e
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/library/hybrid/defaultParams/output.js
@@ -0,0 +1,45 @@
+//bundle1.js:
+ // module_id: bundle2-foo.ts
+const foo$5 = {
+ Provider: 'bundle2-foo'
+};
+export { foo$5 };
+
+
+//farm_runtime.js:
+ // module_id: __FARM_BUNDLE_POLYFILL_SLOT__
+
+
+//index.js:
+ // module_id: foo.ts
+import { foo$5 } from "./bundle1.js";
+const foo$1 = 'foo';
+
+// module_id: index.ts
+function loadFoo(foo = foo$1) {
+ return;
+}
+const loadFooArrowExpr = ()=>{
+ return (foo)=>{
+ console.log(foo, foo$5.Provider);
+ };
+};
+class LoadFoo {
+ foo;
+ constructor(foo = foo$1){
+ this.foo = foo;
+ }
+ getFoo() {
+ return this.foo;
+ }
+}
+loadFoo();
+new LoadFoo();
+const bar$1 = 2;
+function computed(bar = 1) {
+ return {
+ [bar]: 123,
+ [foo$1]: 234
+ };
+}
+computed();
diff --git a/crates/compiler/tests/fixtures/bundle/library/hybrid/importCjsNamespace/a.ts b/crates/compiler/tests/fixtures/bundle/library/hybrid/importCjsNamespace/a.ts
index 769d5241a..d25772398 100644
--- a/crates/compiler/tests/fixtures/bundle/library/hybrid/importCjsNamespace/a.ts
+++ b/crates/compiler/tests/fixtures/bundle/library/hybrid/importCjsNamespace/a.ts
@@ -1,5 +1,5 @@
const lodash = 'a.ts';
-console.log(lodash);
+console.log(lodash, 'a.ts');
export default 'a.ts';
\ No newline at end of file
diff --git a/crates/compiler/tests/fixtures/bundle/library/hybrid/importCjsNamespace/output.cjs.js b/crates/compiler/tests/fixtures/bundle/library/hybrid/importCjsNamespace/output.cjs.js
index f38d44cc6..62a6f1e6e 100644
--- a/crates/compiler/tests/fixtures/bundle/library/hybrid/importCjsNamespace/output.cjs.js
+++ b/crates/compiler/tests/fixtures/bundle/library/hybrid/importCjsNamespace/output.cjs.js
@@ -1,21 +1,31 @@
-//index.js:
- function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+//farm_runtime.js:
+ // module_id: __FARM_BUNDLE_POLYFILL_SLOT__
+function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
+ }
+ return module.exports;
+ };
+}
+function _getRequireWildcardCache(nodeInterop) {
+ if (typeof WeakMap !== "function") return null;
+ var cacheBabelInterop = new WeakMap();
+ var cacheNodeInterop = new WeakMap();
+ return (_getRequireWildcardCache = function(nodeInterop) {
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
+ })(nodeInterop);
+}
+function _interop_require_wildcard(obj, nodeInterop) {
if (!nodeInterop && obj && obj.__esModule) return obj;
if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
default: obj
@@ -36,39 +46,39 @@
newObj.default = obj;
if (cache) cache.set(obj, newObj);
return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+}
+function _interop_require_default(obj) {
+ return obj && obj.__esModule ? obj : {
+ default: obj
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
+}
+module.exports.__commonJs = __commonJs;
+module.exports._interop_require_default = _interop_require_default;
+module.exports._interop_require_wildcard = _interop_require_wildcard;
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+
+
+//index.js:
+ // module_id: lodash.ts
+var farm_runtime_js_ns = require("./farm_runtime.js");
+var __commonJs = farm_runtime_js_ns.__commonJs, _interop_require_default = farm_runtime_js_ns._interop_require_default, _interop_require_wildcard = farm_runtime_js_ns._interop_require_wildcard;
+var lodash_cjs = __commonJs({
+ "lodash.ts": (module, exports)=>{
+ module.exports.name = 'lodash';
+ module.exports.default = 'foo';
}
- return module.exports;
- };
-}var lodash_cjs = __commonJs((module, exports)=>{
- module.exports.name = 'lodash';
- module.exports.default = 'foo';
});
var lodash$1 = _interop_require_default(lodash_cjs()).default, lodash_ns = _interop_require_wildcard(lodash_cjs());
+// module_id: a.ts
const lodash = 'a.ts';
-console.log(lodash);
+console.log(lodash, 'a.ts');
var a_default = 'a.ts';
+// module_id: b.ts
console.log('b.ts', lodash_ns);
+// module_id: index.ts
console.log('index.ts', lodash$1);
diff --git a/crates/compiler/tests/fixtures/bundle/library/hybrid/importCjsNamespace/output.js b/crates/compiler/tests/fixtures/bundle/library/hybrid/importCjsNamespace/output.js
new file mode 100644
index 000000000..7777ea74c
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/library/hybrid/importCjsNamespace/output.js
@@ -0,0 +1,78 @@
+//farm_runtime.js:
+ // module_id: __FARM_BUNDLE_POLYFILL_SLOT__
+function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
+ }
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
+ }
+ return module.exports;
+ };
+}
+function _getRequireWildcardCache(nodeInterop) {
+ if (typeof WeakMap !== "function") return null;
+ var cacheBabelInterop = new WeakMap();
+ var cacheNodeInterop = new WeakMap();
+ return (_getRequireWildcardCache = function(nodeInterop) {
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
+ })(nodeInterop);
+}
+function _interop_require_wildcard(obj, nodeInterop) {
+ if (!nodeInterop && obj && obj.__esModule) return obj;
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
+ default: obj
+ };
+ var cache = _getRequireWildcardCache(nodeInterop);
+ if (cache && cache.has(obj)) return cache.get(obj);
+ var newObj = {
+ __proto__: null
+ };
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
+ for(var key in obj){
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
+ if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
+ else newObj[key] = obj[key];
+ }
+ }
+ newObj.default = obj;
+ if (cache) cache.set(obj, newObj);
+ return newObj;
+}
+function _interop_require_default(obj) {
+ return obj && obj.__esModule ? obj : {
+ default: obj
+ };
+}
+export { __commonJs, _interop_require_default, _interop_require_wildcard };
+
+
+//index.js:
+ // module_id: lodash.ts
+import { __commonJs, _interop_require_default, _interop_require_wildcard } from "./farm_runtime.js";
+var lodash_cjs = __commonJs({
+ "lodash.ts": (module, exports)=>{
+ module.exports.name = 'lodash';
+ module.exports.default = 'foo';
+ }
+});
+var lodash$1 = _interop_require_default(lodash_cjs()).default, lodash_ns = _interop_require_wildcard(lodash_cjs());
+
+// module_id: a.ts
+const lodash = 'a.ts';
+console.log(lodash, 'a.ts');
+var a_default = 'a.ts';
+
+// module_id: b.ts
+console.log('b.ts', lodash_ns);
+
+// module_id: index.ts
+console.log('index.ts', lodash$1);
diff --git a/crates/compiler/tests/fixtures/bundle/library/hybrid/importZip/bar.ts b/crates/compiler/tests/fixtures/bundle/library/hybrid/importZip/bar.ts
new file mode 100644
index 000000000..c69d49c0d
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/library/hybrid/importZip/bar.ts
@@ -0,0 +1,6 @@
+import cjs, { cjsName } from './cjs';
+import esm, { esmName } from './esm';
+import bundle2, { bundle2Name } from './bundle2';
+import { readFile } from 'node:fs';
+
+console.log({ cjs: { cjs, cjsName }, readFile, esm: { esm, esmName }, bundle2: { bundle2, bundle2Name } }, 'bar.ts');
\ No newline at end of file
diff --git a/crates/compiler/tests/fixtures/bundle/library/hybrid/importZip/bundle2.ts b/crates/compiler/tests/fixtures/bundle/library/hybrid/importZip/bundle2.ts
new file mode 100644
index 000000000..a05cf35e2
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/library/hybrid/importZip/bundle2.ts
@@ -0,0 +1,6 @@
+export const bundle2Name = 'bundle2';
+export const bundle2Age = 18;
+
+export default function bundle2() {
+
+}
\ No newline at end of file
diff --git a/crates/compiler/tests/fixtures/bundle/library/hybrid/importZip/cjs.ts b/crates/compiler/tests/fixtures/bundle/library/hybrid/importZip/cjs.ts
new file mode 100644
index 000000000..5e509d98b
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/library/hybrid/importZip/cjs.ts
@@ -0,0 +1,4 @@
+module.exports.cjsName = 'foo';
+module.exports.cjsAge = 18;
+
+export default function cjs() {}
\ No newline at end of file
diff --git a/crates/compiler/tests/fixtures/bundle/library/hybrid/importZip/esm.ts b/crates/compiler/tests/fixtures/bundle/library/hybrid/importZip/esm.ts
new file mode 100644
index 000000000..8808c9ed5
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/library/hybrid/importZip/esm.ts
@@ -0,0 +1,4 @@
+export const esmName = 'esm';
+export const esmAge = 19
+
+export default function esm() {}
\ No newline at end of file
diff --git a/crates/compiler/tests/fixtures/bundle/library/hybrid/importZip/foo.ts b/crates/compiler/tests/fixtures/bundle/library/hybrid/importZip/foo.ts
new file mode 100644
index 000000000..60cb7377e
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/library/hybrid/importZip/foo.ts
@@ -0,0 +1,7 @@
+import cjs, { cjsAge } from './cjs';
+import { readFile } from 'node:fs';
+import esm, { esmAge } from './esm';
+import bundle2, { bundle2Age } from './bundle2';
+
+
+console.log({ cjs: { cjs, cjsAge }, esm: { esm, esmAge }, bundle2: { bundle2, bundle2Age }, readFile }, 'foo.ts');
\ No newline at end of file
diff --git a/crates/compiler/tests/fixtures/bundle/library/hybrid/importZip/index.ts b/crates/compiler/tests/fixtures/bundle/library/hybrid/importZip/index.ts
new file mode 100644
index 000000000..a7fb77d09
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/library/hybrid/importZip/index.ts
@@ -0,0 +1,2 @@
+import './bar';
+import './foo';
\ No newline at end of file
diff --git a/crates/compiler/tests/fixtures/bundle/library/hybrid/importZip/output.js b/crates/compiler/tests/fixtures/bundle/library/hybrid/importZip/output.js
new file mode 100644
index 000000000..8cbe5705d
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/library/hybrid/importZip/output.js
@@ -0,0 +1,99 @@
+//bundle1.js:
+ // module_id: bundle2.ts
+const bundle2Name = 'bundle2';
+const bundle2Age = 18;
+function bundle2() {}
+export { bundle2, bundle2Age, bundle2Name };
+
+
+//farm_runtime.js:
+ // module_id: __FARM_BUNDLE_POLYFILL_SLOT__
+function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
+ }
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
+ }
+ return module.exports;
+ };
+}
+function _interop_require_default(obj) {
+ return obj && obj.__esModule ? obj : {
+ default: obj
+ };
+}
+export { __commonJs, _interop_require_default };
+
+
+//index.js:
+ // module_id: cjs.ts
+import { __commonJs, _interop_require_default } from "./farm_runtime.js";
+import { bundle2, bundle2Age, bundle2Name } from "./bundle1.js";
+import { readFile } from "node:fs";
+var cjs_cjs = __commonJs({
+ "cjs.ts": (module, exports)=>{
+ "use strict";
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+ Object.defineProperty(exports, "default", {
+ enumerable: true,
+ get: function() {
+ return cjs;
+ }
+ });
+ module.exports.cjsName = 'foo';
+ module.exports.cjsAge = 18;
+ function cjs() {}
+ }
+});
+var cjs = _interop_require_default(cjs_cjs()).default, cjsAge = cjs_cjs()["cjsAge"], cjsName = cjs_cjs()["cjsName"];
+
+// module_id: esm.ts
+const esmName = 'esm';
+const esmAge = 19;
+function esm() {}
+
+// module_id: bar.ts
+console.log({
+ cjs: {
+ cjs: cjs,
+ cjsName: cjsName
+ },
+ readFile: readFile,
+ esm: {
+ esm: esm,
+ esmName: esmName
+ },
+ bundle2: {
+ bundle2: bundle2,
+ bundle2Name: bundle2Name
+ }
+}, 'bar.ts');
+
+// module_id: foo.ts
+console.log({
+ cjs: {
+ cjs: cjs,
+ cjsAge: cjsAge
+ },
+ esm: {
+ esm: esm,
+ esmAge: esmAge
+ },
+ bundle2: {
+ bundle2: bundle2,
+ bundle2Age: bundle2Age
+ },
+ readFile: readFile
+}, 'foo.ts');
+
+// module_id: index.ts
diff --git a/crates/compiler/tests/fixtures/bundle/library/hybrid/noexport/output.js b/crates/compiler/tests/fixtures/bundle/library/hybrid/noexport/output.js
index af94bfa3d..265b3173e 100644
--- a/crates/compiler/tests/fixtures/bundle/library/hybrid/noexport/output.js
+++ b/crates/compiler/tests/fixtures/bundle/library/hybrid/noexport/output.js
@@ -1,69 +1,39 @@
-//index.js:
- import __farmNodeModule from 'module';
-global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+//farm_runtime.js:
+ // module_id: __FARM_BUNDLE_POLYFILL_SLOT__
+function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
+}
+import __farmNodeModule from 'module';
+var __nodeRequireInstance = __farmNodeModule.createRequire(import.meta.url);
+function _nodeRequire() {
+ return __nodeRequireInstance.apply(null, arguments);
+}
+export { __commonJs, _nodeRequire };
+
+
+//index.js:
+ // module_id: index.ts
+import { __commonJs, _nodeRequire } from "./farm_runtime.js";
+import fs from "node:fs";
+var index_cjs = __commonJs({
+ "index.ts": (module, exports)=>{
+ "use strict";
+ const os = _nodeRequire('node:os');
+ console.log(fs.read, os.cpus);
}
- return module.exports;
- };
-}import fs from "node:fs";
-var index_cjs = __commonJs((module, exports)=>{
- "use strict";
- const os = global.nodeRequire('node:os');
- console.log(fs.read, os.cpus);
});
index_cjs();
diff --git a/crates/compiler/tests/fixtures/bundle/library/hybrid/normal/output.js b/crates/compiler/tests/fixtures/bundle/library/hybrid/normal/output.js
index d5e79b13a..5b8a4b2c9 100644
--- a/crates/compiler/tests/fixtures/bundle/library/hybrid/normal/output.js
+++ b/crates/compiler/tests/fixtures/bundle/library/hybrid/normal/output.js
@@ -1,97 +1,71 @@
-//index.js:
- import __farmNodeModule from 'module';
-global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);function _interop_require_default(obj) {
+//farm_runtime.js:
+ // module_id: __FARM_BUNDLE_POLYFILL_SLOT__
+function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
+ }
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
+ }
+ return module.exports;
+ };
+}
+function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
+}
+import __farmNodeModule from 'module';
+var __nodeRequireInstance = __farmNodeModule.createRequire(import.meta.url);
+function _nodeRequire() {
+ return __nodeRequireInstance.apply(null, arguments);
+}
+export { __commonJs, _interop_require_default, _nodeRequire };
+
+
+//index.js:
+ // module_id: index.ts
+import { __commonJs, _interop_require_default, _nodeRequire } from "./farm_runtime.js";
+import fs from "node:fs";
+var index_cjs = __commonJs({
+ "index.ts": (module, exports)=>{
+ "use strict";
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+ function _export(target, all) {
+ for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
- get: function() {
- return from[k];
- }
+ get: all[name]
});
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
- }
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
- };
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}import fs from "node:fs";
-var index_cjs = __commonJs((module, exports)=>{
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- function _export(target, all) {
- for(var name in all)Object.defineProperty(target, name, {
- enumerable: true,
- get: all[name]
+ _export(exports, {
+ bar: function() {
+ return bar;
+ },
+ default: function() {
+ return _default;
+ },
+ foo: function() {
+ return foo;
+ }
});
+ const os = _nodeRequire('node:os');
+ console.log(fs.read, os.cpus);
+ var _default = {
+ read: fs.read,
+ c: 1
+ };
+ const foo = 'foo';
+ const bar = 'bar';
}
- _export(exports, {
- bar: function() {
- return bar;
- },
- default: function() {
- return _default;
- },
- foo: function() {
- return foo;
- }
- });
- const os = global.nodeRequire('node:os');
- console.log(fs.read, os.cpus);
- var _default = {
- read: fs.read,
- c: 1
- };
- const foo = 'foo';
- const bar = 'bar';
});
var index_default = _interop_require_default(index_cjs()).default, bar = index_cjs()["bar"], foo = index_cjs()["foo"];
-export { bar, foo };
-export default index_default;
+export { bar, foo, index_default as default };
diff --git a/crates/compiler/tests/fixtures/bundle/library/reexport/esm/default/output.js b/crates/compiler/tests/fixtures/bundle/library/reexport/esm/default/output.js
index 9cf3a7632..a2e8f323b 100644
--- a/crates/compiler/tests/fixtures/bundle/library/reexport/esm/default/output.js
+++ b/crates/compiler/tests/fixtures/bundle/library/reexport/esm/default/output.js
@@ -1,48 +1,10 @@
+//farm_runtime.js:
+ // module_id: __FARM_BUNDLE_POLYFILL_SLOT__
+
+
//index.js:
- function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
- }
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
- }
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}var foo_default = 'foo';
+ // module_id: foo.ts
+var foo_default = 'foo';
+// module_id: index.ts
export { foo_default as default };
diff --git a/crates/compiler/tests/fixtures/bundle/library/reexport/esm/named/output.js b/crates/compiler/tests/fixtures/bundle/library/reexport/esm/named/output.js
index c4feebfd5..be43adb9a 100644
--- a/crates/compiler/tests/fixtures/bundle/library/reexport/esm/named/output.js
+++ b/crates/compiler/tests/fixtures/bundle/library/reexport/esm/named/output.js
@@ -1,49 +1,11 @@
+//farm_runtime.js:
+ // module_id: __FARM_BUNDLE_POLYFILL_SLOT__
+
+
//index.js:
- function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
- }
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
- }
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}const foo = 'foo';
+ // module_id: foo.ts
+const foo = 'foo';
const bar = 'bar';
+// module_id: index.ts
export { bar, foo };
diff --git a/crates/compiler/tests/fixtures/bundle/library/reexport/esm/namespace/output.js b/crates/compiler/tests/fixtures/bundle/library/reexport/esm/namespace/output.js
index 4cb7c1d6b..ef05d3b9b 100644
--- a/crates/compiler/tests/fixtures/bundle/library/reexport/esm/namespace/output.js
+++ b/crates/compiler/tests/fixtures/bundle/library/reexport/esm/namespace/output.js
@@ -1,58 +1,20 @@
+//farm_runtime.js:
+ // module_id: __FARM_BUNDLE_POLYFILL_SLOT__
+
+
//index.js:
- function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
- }
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
- }
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}var foo_default = 'foo';
-const foo$1 = 'foo';
+ // module_id: foo.ts
+var foo_default = 'foo';
+const foo = 'foo';
const bar = 'bar';
var foo_ns = {
bar: bar,
- foo: foo$1,
+ foo: foo,
"default": foo_default,
__esModule: true
};
-const foo = 123;
-console.log(foo_ns.default, foo_ns.foo, foo);
+// module_id: index.ts
+const foo$1 = 123;
+console.log(foo_ns.default, foo_ns.foo, foo$1);
export { foo_ns as ns };
diff --git a/crates/compiler/tests/fixtures/bundle/library/reexport/esm/star/output.js b/crates/compiler/tests/fixtures/bundle/library/reexport/esm/star/output.js
index d33ca68f7..2906dc539 100644
--- a/crates/compiler/tests/fixtures/bundle/library/reexport/esm/star/output.js
+++ b/crates/compiler/tests/fixtures/bundle/library/reexport/esm/star/output.js
@@ -1,49 +1,10 @@
+//farm_runtime.js:
+ // module_id: __FARM_BUNDLE_POLYFILL_SLOT__
+
+
//index.js:
- function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
- }
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
- }
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}var foo_default = 'foo';
+ // module_id: foo.ts
+var foo_default = 'foo';
const foo = 'foo';
const bar = 'bar';
var foo_ns = {
@@ -53,5 +14,5 @@ var foo_ns = {
__esModule: true
};
-export { bar, foo };
-export default foo_default;
+// module_id: index.ts
+export { bar, foo, foo_default as default };
diff --git a/crates/compiler/tests/fixtures/bundle/library/reexport/reexport/index.ts b/crates/compiler/tests/fixtures/bundle/library/reexport/reexport/index.ts
new file mode 100644
index 000000000..194ef63e6
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/library/reexport/reexport/index.ts
@@ -0,0 +1,4 @@
+export * from './reexport';
+// TODO: external
+// TODO: improve reexport external
+const Foo1 = '123';
\ No newline at end of file
diff --git a/crates/compiler/tests/fixtures/bundle/library/reexport/reexport/output.js b/crates/compiler/tests/fixtures/bundle/library/reexport/reexport/output.js
new file mode 100644
index 000000000..22a4e6214
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/library/reexport/reexport/output.js
@@ -0,0 +1,18 @@
+//farm_runtime.js:
+ // module_id: __FARM_BUNDLE_POLYFILL_SLOT__
+
+
+//index.js:
+ // module_id: reexport.ts
+import { default as Foo1 } from "foo1";
+import { default as Foo2 } from "foo2";
+var reexport_ns = {
+ Foo2: Foo2,
+ Foo1: Foo1,
+ __esModule: true
+};
+
+// module_id: index.ts
+const Foo1 = '123';
+export { default as Foo1 } from "foo1";
+export { default as Foo2 } from "foo2";
diff --git a/crates/compiler/tests/fixtures/bundle/library/reexport/reexport/reexport.ts b/crates/compiler/tests/fixtures/bundle/library/reexport/reexport/reexport.ts
new file mode 100644
index 000000000..1ae4fa357
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/library/reexport/reexport/reexport.ts
@@ -0,0 +1,3 @@
+// @ts-nocheck
+export { default as Foo1 } from 'foo1'
+export { default as Foo2 } from 'foo2'
\ No newline at end of file
diff --git a/crates/compiler/tests/fixtures/bundle/library/reexport/reexport_hybrid_cjs/default/circle.ts b/crates/compiler/tests/fixtures/bundle/library/reexport/reexport_hybrid_cjs/default/circle.ts
new file mode 100644
index 000000000..20d6a2b6f
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/library/reexport/reexport_hybrid_cjs/default/circle.ts
@@ -0,0 +1,3 @@
+import * as ns from './reexport';
+
+console.log({ ns });
\ No newline at end of file
diff --git a/crates/compiler/tests/fixtures/bundle/library/reexport/reexport_hybrid_cjs/default/foo.ts b/crates/compiler/tests/fixtures/bundle/library/reexport/reexport_hybrid_cjs/default/foo.ts
index 8af2ad9ac..f618a4771 100644
--- a/crates/compiler/tests/fixtures/bundle/library/reexport/reexport_hybrid_cjs/default/foo.ts
+++ b/crates/compiler/tests/fixtures/bundle/library/reexport/reexport_hybrid_cjs/default/foo.ts
@@ -1,2 +1,3 @@
module.exports.cjs = true;
-export default 'foo';
\ No newline at end of file
+var a = 'foo';
+export default a;
\ No newline at end of file
diff --git a/crates/compiler/tests/fixtures/bundle/library/reexport/reexport_hybrid_cjs/default/index.ts b/crates/compiler/tests/fixtures/bundle/library/reexport/reexport_hybrid_cjs/default/index.ts
index 2f816c828..061b1c23c 100644
--- a/crates/compiler/tests/fixtures/bundle/library/reexport/reexport_hybrid_cjs/default/index.ts
+++ b/crates/compiler/tests/fixtures/bundle/library/reexport/reexport_hybrid_cjs/default/index.ts
@@ -1 +1,4 @@
-export { default } from './foo.ts';
+import _default_import from './reexport';
+
+export default _default_import;
+export * from './reexport';
\ No newline at end of file
diff --git a/crates/compiler/tests/fixtures/bundle/library/reexport/reexport_hybrid_cjs/default/output.js b/crates/compiler/tests/fixtures/bundle/library/reexport/reexport_hybrid_cjs/default/output.js
index e29a879d7..1fee85dc9 100644
--- a/crates/compiler/tests/fixtures/bundle/library/reexport/reexport_hybrid_cjs/default/output.js
+++ b/crates/compiler/tests/fixtures/bundle/library/reexport/reexport_hybrid_cjs/default/output.js
@@ -1,78 +1,20 @@
+//farm_runtime.js:
+ // module_id: __FARM_BUNDLE_POLYFILL_SLOT__
+
+
//index.js:
- function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
- }
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
- }
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
- };
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
+ // module_id: reexport.ts
+class foo {
+ constructor(){
+ console.log(this.constructor === foo);
}
- return module.exports;
- };
-}var foo_cjs = __commonJs((module, exports)=>{
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- Object.defineProperty(exports, "default", {
- enumerable: true,
- get: function() {
- return _default;
- }
- });
- module.exports.cjs = true;
- var _default = 'foo';
-});
-var foo_default = foo_cjs()["default"];
+}
+const bar = 'foo';
+var reexport_ns = {
+ bar: bar,
+ default: foo,
+ __esModule: true
+};
-export { foo_default as default };
+// module_id: index.ts
+export { bar, foo as default };
diff --git a/crates/compiler/tests/fixtures/bundle/library/reexport/reexport_hybrid_cjs/default/reexport.ts b/crates/compiler/tests/fixtures/bundle/library/reexport/reexport_hybrid_cjs/default/reexport.ts
new file mode 100644
index 000000000..50b615610
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/library/reexport/reexport_hybrid_cjs/default/reexport.ts
@@ -0,0 +1,12 @@
+// export { default } from './foo.ts';
+// import './circle';
+
+class foo {
+ constructor() {
+ console.log(this.constructor === foo);
+ }
+};
+
+export const bar = 'foo';
+
+export { foo as default };
\ No newline at end of file
diff --git a/crates/compiler/tests/fixtures/bundle/library/reexport/reexport_hybrid_cjs/named/output.js b/crates/compiler/tests/fixtures/bundle/library/reexport/reexport_hybrid_cjs/named/output.js
index f1996fe32..646fc6068 100644
--- a/crates/compiler/tests/fixtures/bundle/library/reexport/reexport_hybrid_cjs/named/output.js
+++ b/crates/compiler/tests/fixtures/bundle/library/reexport/reexport_hybrid_cjs/named/output.js
@@ -1,87 +1,54 @@
-//index.js:
- function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
+//farm_runtime.js:
+ // module_id: __FARM_BUNDLE_POLYFILL_SLOT__
+function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
+ }
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
+ }
+ return module.exports;
};
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
+}
+export { __commonJs };
+
+
+//index.js:
+ // module_id: foo.ts
+import { __commonJs } from "./farm_runtime.js";
+var foo_cjs = __commonJs({
+ "foo.ts": (module, exports)=>{
+ "use strict";
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+ function _export(target, all) {
+ for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
- get: function() {
- return from[k];
- }
+ get: all[name]
});
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
- }
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
- };
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}var foo_cjs = __commonJs((module, exports)=>{
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- function _export(target, all) {
- for(var name in all)Object.defineProperty(target, name, {
- enumerable: true,
- get: all[name]
+ _export(exports, {
+ bar: function() {
+ return bar;
+ },
+ foo: function() {
+ return foo;
+ }
});
+ const foo = 'foo';
+ const bar = 'bar';
+ module.exports.cjs = true;
}
- _export(exports, {
- bar: function() {
- return bar;
- },
- foo: function() {
- return foo;
- }
- });
- const foo = 'foo';
- const bar = 'bar';
- module.exports.cjs = true;
});
var bar = foo_cjs()["bar"], foo = foo_cjs()["foo"];
+// module_id: index.ts
export { bar, foo };
diff --git a/crates/compiler/tests/fixtures/bundle/library/reexport/reexport_hybrid_cjs/namespace/output.js b/crates/compiler/tests/fixtures/bundle/library/reexport/reexport_hybrid_cjs/namespace/output.js
index 46366be2b..319073cfe 100644
--- a/crates/compiler/tests/fixtures/bundle/library/reexport/reexport_hybrid_cjs/namespace/output.js
+++ b/crates/compiler/tests/fixtures/bundle/library/reexport/reexport_hybrid_cjs/namespace/output.js
@@ -1,21 +1,31 @@
-//index.js:
- function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+//farm_runtime.js:
+ // module_id: __FARM_BUNDLE_POLYFILL_SLOT__
+function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
+ }
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
+ return module.exports;
+ };
+}
+function _getRequireWildcardCache(nodeInterop) {
+ if (typeof WeakMap !== "function") return null;
+ var cacheBabelInterop = new WeakMap();
+ var cacheNodeInterop = new WeakMap();
+ return (_getRequireWildcardCache = function(nodeInterop) {
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
+ })(nodeInterop);
+}
+function _interop_require_wildcard(obj, nodeInterop) {
if (!nodeInterop && obj && obj.__esModule) return obj;
if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
default: obj
@@ -36,56 +46,43 @@
newObj.default = obj;
if (cache) cache.set(obj, newObj);
return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
- };
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}var foo_cjs = __commonJs((module, exports)=>{
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- function _export(target, all) {
- for(var name in all)Object.defineProperty(target, name, {
- enumerable: true,
- get: all[name]
+}
+export { __commonJs, _interop_require_wildcard };
+
+
+//index.js:
+ // module_id: foo.ts
+import { __commonJs, _interop_require_wildcard } from "./farm_runtime.js";
+var foo_cjs = __commonJs({
+ "foo.ts": (module, exports)=>{
+ "use strict";
+ Object.defineProperty(exports, "__esModule", {
+ value: true
});
- }
- _export(exports, {
- bar: function() {
- return bar;
- },
- default: function() {
- return _default;
- },
- foo: function() {
- return foo;
+ function _export(target, all) {
+ for(var name in all)Object.defineProperty(target, name, {
+ enumerable: true,
+ get: all[name]
+ });
}
- });
- var _default = 'foo';
- const foo = 'foo';
- const bar = 'bar';
- module.exports.cjs = true;
+ _export(exports, {
+ bar: function() {
+ return bar;
+ },
+ default: function() {
+ return _default;
+ },
+ foo: function() {
+ return foo;
+ }
+ });
+ var _default = 'foo';
+ const foo = 'foo';
+ const bar = 'bar';
+ module.exports.cjs = true;
+ }
});
var foo_ns = _interop_require_wildcard(foo_cjs());
+// module_id: index.ts
export { foo_ns as ns };
diff --git a/crates/compiler/tests/fixtures/bundle/library/reexport/reexport_hybrid_cjs/output.js b/crates/compiler/tests/fixtures/bundle/library/reexport/reexport_hybrid_cjs/output.js
new file mode 100644
index 000000000..b484195ee
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/library/reexport/reexport_hybrid_cjs/output.js
@@ -0,0 +1,20 @@
+//farm_runtime.js:
+ // module_id: __FARM_BUNDLE_POLYFILL_SLOT__
+
+
+//index.js:
+ // module_id: default/reexport.ts
+class foo {
+ constructor(){
+ console.log(this.constructor === foo);
+ }
+}
+const bar = 'foo';
+var reexport_ns = {
+ bar: bar,
+ default: foo,
+ __esModule: true
+};
+
+// module_id: default/index.ts
+export { bar, foo as default };
diff --git a/crates/compiler/tests/fixtures/bundle/library/reexport/reexport_hybrid_cjs/star/output.js b/crates/compiler/tests/fixtures/bundle/library/reexport/reexport_hybrid_cjs/star/output.js
index f2320e3c3..ca84b2381 100644
--- a/crates/compiler/tests/fixtures/bundle/library/reexport/reexport_hybrid_cjs/star/output.js
+++ b/crates/compiler/tests/fixtures/bundle/library/reexport/reexport_hybrid_cjs/star/output.js
@@ -1,92 +1,63 @@
-//index.js:
- function _interop_require_default(obj) {
+//farm_runtime.js:
+ // module_id: __FARM_BUNDLE_POLYFILL_SLOT__
+function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
+ }
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
+ }
+ return module.exports;
+ };
+}
+function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
+}
+export { __commonJs, _interop_require_default };
+
+
+//index.js:
+ // module_id: foo.ts
+import { __commonJs, _interop_require_default } from "./farm_runtime.js";
+var foo_cjs = __commonJs({
+ "foo.ts": (module, exports)=>{
+ "use strict";
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+ function _export(target, all) {
+ for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
- get: function() {
- return from[k];
- }
+ get: all[name]
});
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
- }
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
- };
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}var foo_cjs = __commonJs((module, exports)=>{
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- function _export(target, all) {
- for(var name in all)Object.defineProperty(target, name, {
- enumerable: true,
- get: all[name]
+ _export(exports, {
+ bar: function() {
+ return bar;
+ },
+ default: function() {
+ return _default;
+ },
+ foo: function() {
+ return foo;
+ }
});
+ var _default = 'foo';
+ const foo = 'foo';
+ const bar = 'bar';
+ module.exports.cjs = true;
}
- _export(exports, {
- bar: function() {
- return bar;
- },
- default: function() {
- return _default;
- },
- foo: function() {
- return foo;
- }
- });
- var _default = 'foo';
- const foo = 'foo';
- const bar = 'bar';
- module.exports.cjs = true;
});
var foo_default = _interop_require_default(foo_cjs()).default, bar = foo_cjs()["bar"], foo = foo_cjs()["foo"];
-export { bar, foo };
-export default foo_default;
+// module_id: index.ts
+export { bar, foo, foo_default as default };
diff --git a/crates/compiler/tests/fixtures/bundle/library/reexport/use_external_reexport/index.ts b/crates/compiler/tests/fixtures/bundle/library/reexport/use_external_reexport/index.ts
new file mode 100644
index 000000000..b65de0054
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/library/reexport/use_external_reexport/index.ts
@@ -0,0 +1,6 @@
+import r1, { foo, unstable_batchedUpdates as batch } from './reexport';
+
+const unstable_batchedUpdates = 123;
+console.log({ unstable_batchedUpdates });
+
+console.log({ r1, foo, batch });
\ No newline at end of file
diff --git a/crates/compiler/tests/fixtures/bundle/library/reexport/use_external_reexport/output.js b/crates/compiler/tests/fixtures/bundle/library/reexport/use_external_reexport/output.js
new file mode 100644
index 000000000..6d63e5d7f
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/library/reexport/use_external_reexport/output.js
@@ -0,0 +1,20 @@
+//farm_runtime.js:
+ // module_id: __FARM_BUNDLE_POLYFILL_SLOT__
+
+
+//index.js:
+ // module_id: reexport.ts
+import { foo } from "foo";
+import { readFile } from "node:fs";
+import { unstable_batchedUpdates as unstable_batchedUpdates$1 } from "react-dom";
+
+// module_id: index.ts
+const unstable_batchedUpdates = 123;
+console.log({
+ unstable_batchedUpdates: unstable_batchedUpdates
+});
+console.log({
+ r1: readFile,
+ foo: foo,
+ batch: unstable_batchedUpdates$1
+});
diff --git a/crates/compiler/tests/fixtures/bundle/library/reexport/use_external_reexport/reexport.ts b/crates/compiler/tests/fixtures/bundle/library/reexport/use_external_reexport/reexport.ts
new file mode 100644
index 000000000..44f74ada8
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/library/reexport/use_external_reexport/reexport.ts
@@ -0,0 +1,5 @@
+// @ts-nocheck
+export { readFile as default } from 'node:fs';
+export { foo } from 'foo';
+
+export { unstable_batchedUpdates } from 'react-dom';
\ No newline at end of file
diff --git a/crates/compiler/tests/fixtures/bundle/multiple_bundle/lodash_export/bundle2.ts b/crates/compiler/tests/fixtures/bundle/multiple_bundle/lodash_export/bundle2.ts
new file mode 100644
index 000000000..1ae84b933
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/multiple_bundle/lodash_export/bundle2.ts
@@ -0,0 +1,9 @@
+// @ts-nocheck
+
+function lodash() {}
+
+lodash.merge = function() {}
+
+const _ = lodash;
+
+(module.exports = _)._ = _;
\ No newline at end of file
diff --git a/crates/compiler/tests/fixtures/bundle/multiple_bundle/lodash_export/config.cjs.json b/crates/compiler/tests/fixtures/bundle/multiple_bundle/lodash_export/config.cjs.json
new file mode 100644
index 000000000..932c1085f
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/multiple_bundle/lodash_export/config.cjs.json
@@ -0,0 +1,6 @@
+{
+ "output": {
+ "targetEnv": "library-node",
+ "format": "cjs"
+ }
+}
\ No newline at end of file
diff --git a/crates/compiler/tests/fixtures/bundle/multiple_bundle/lodash_export/index.ts b/crates/compiler/tests/fixtures/bundle/multiple_bundle/lodash_export/index.ts
new file mode 100644
index 000000000..d7441d779
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/multiple_bundle/lodash_export/index.ts
@@ -0,0 +1,3 @@
+import lodash, { merge } from './bundle2';
+
+console.log(lodash, merge);
diff --git a/crates/compiler/tests/fixtures/bundle/multiple_bundle/lodash_export/output.cjs.js b/crates/compiler/tests/fixtures/bundle/multiple_bundle/lodash_export/output.cjs.js
new file mode 100644
index 000000000..387e51689
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/multiple_bundle/lodash_export/output.cjs.js
@@ -0,0 +1,54 @@
+//bundle1.js:
+ // module_id: bundle2.ts
+var farm_runtime_js_ns = require("./farm_runtime.js");
+var __commonJs = farm_runtime_js_ns.__commonJs;
+var bundle2_cjs = __commonJs({
+ "bundle2.ts": (module, exports)=>{
+ function lodash() {}
+ lodash.merge = function() {};
+ const _ = lodash;
+ (module.exports = _)._ = _;
+ }
+});
+module.exports.bundle2_cjs = bundle2_cjs;
+
+
+//farm_runtime.js:
+ // module_id: __FARM_BUNDLE_POLYFILL_SLOT__
+function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
+ }
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
+ }
+ return module.exports;
+ };
+}
+function _interop_require_default(obj) {
+ return obj && obj.__esModule ? obj : {
+ default: obj
+ };
+}
+module.exports.__commonJs = __commonJs;
+module.exports._interop_require_default = _interop_require_default;
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+
+
+//index.js:
+ // module_id: index.ts
+var farm_runtime_js_ns = require("./farm_runtime.js");
+var _interop_require_default = farm_runtime_js_ns._interop_require_default;
+var bundle1_js_ns = require("./bundle1.js");
+var bundle2_cjs = bundle1_js_ns.bundle2_cjs;
+var lodash = _interop_require_default(bundle2_cjs()).default, merge = bundle2_cjs()["merge"];
+console.log(lodash, merge);
diff --git a/crates/compiler/tests/fixtures/bundle/multiple_bundle/lodash_export/output.js b/crates/compiler/tests/fixtures/bundle/multiple_bundle/lodash_export/output.js
new file mode 100644
index 000000000..9f67ed91c
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/multiple_bundle/lodash_export/output.js
@@ -0,0 +1,47 @@
+//bundle1.js:
+ // module_id: bundle2.ts
+import { __commonJs } from "./farm_runtime.js";
+var bundle2_cjs = __commonJs({
+ "bundle2.ts": (module, exports)=>{
+ function lodash() {}
+ lodash.merge = function() {};
+ const _ = lodash;
+ (module.exports = _)._ = _;
+ }
+});
+export { bundle2_cjs };
+
+
+//farm_runtime.js:
+ // module_id: __FARM_BUNDLE_POLYFILL_SLOT__
+function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
+ }
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
+ }
+ return module.exports;
+ };
+}
+function _interop_require_default(obj) {
+ return obj && obj.__esModule ? obj : {
+ default: obj
+ };
+}
+export { __commonJs, _interop_require_default };
+
+
+//index.js:
+ // module_id: index.ts
+import { _interop_require_default } from "./farm_runtime.js";
+import { bundle2_cjs } from "./bundle1.js";
+var lodash = _interop_require_default(bundle2_cjs()).default, merge = bundle2_cjs()["merge"];
+console.log(lodash, merge);
diff --git a/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/cross_bundle/namespace/bundle2.ts b/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/cross_bundle/namespace/bundle2.ts
new file mode 100644
index 000000000..c96c4108f
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/cross_bundle/namespace/bundle2.ts
@@ -0,0 +1,2 @@
+export * as ns from './namespace';
+export { default } from './default';
\ No newline at end of file
diff --git a/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/cross_bundle/namespace/config.cjs.json b/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/cross_bundle/namespace/config.cjs.json
new file mode 100644
index 000000000..a54e6cace
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/cross_bundle/namespace/config.cjs.json
@@ -0,0 +1,5 @@
+{
+ "output": {
+ "format": "cjs"
+ }
+}
\ No newline at end of file
diff --git a/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/cross_bundle/namespace/default.ts b/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/cross_bundle/namespace/default.ts
new file mode 100644
index 000000000..517359f06
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/cross_bundle/namespace/default.ts
@@ -0,0 +1,3 @@
+const d = 'default';
+
+export default d;
\ No newline at end of file
diff --git a/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/cross_bundle/namespace/index.ts b/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/cross_bundle/namespace/index.ts
new file mode 100644
index 000000000..80a6223b5
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/cross_bundle/namespace/index.ts
@@ -0,0 +1,3 @@
+import bundle2, { ns } from './bundle2';
+
+console.log({ ns, bundle2 });
\ No newline at end of file
diff --git a/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/cross_bundle/namespace/namespace.ts b/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/cross_bundle/namespace/namespace.ts
new file mode 100644
index 000000000..3bf7f28e5
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/cross_bundle/namespace/namespace.ts
@@ -0,0 +1,4 @@
+export const ns_named = 'ns named';
+export const ns_default = 'ns default';
+
+module.exports.name = '123';
\ No newline at end of file
diff --git a/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/cross_bundle/namespace/output.cjs.js b/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/cross_bundle/namespace/output.cjs.js
new file mode 100644
index 000000000..bd25a3713
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/cross_bundle/namespace/output.cjs.js
@@ -0,0 +1,118 @@
+//bundle1.js:
+ // module_id: bundle2.ts
+var farm_runtime_js_ns = require("./farm_runtime.js");
+var _interop_require_wildcard = farm_runtime_js_ns._interop_require_wildcard;
+var index_1175_ns = require("./index.js");
+var d = index_1175_ns.d, namespace_cjs = index_1175_ns.namespace_cjs;
+var ns = _interop_require_wildcard(namespace_cjs());
+module.exports.d = d;
+module.exports.ns = ns;
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+
+
+//farm_runtime.js:
+ // module_id: __FARM_BUNDLE_POLYFILL_SLOT__
+function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
+ }
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
+ }
+ return module.exports;
+ };
+}
+function _getRequireWildcardCache(nodeInterop) {
+ if (typeof WeakMap !== "function") return null;
+ var cacheBabelInterop = new WeakMap();
+ var cacheNodeInterop = new WeakMap();
+ return (_getRequireWildcardCache = function(nodeInterop) {
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
+ })(nodeInterop);
+}
+function _interop_require_wildcard(obj, nodeInterop) {
+ if (!nodeInterop && obj && obj.__esModule) return obj;
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
+ default: obj
+ };
+ var cache = _getRequireWildcardCache(nodeInterop);
+ if (cache && cache.has(obj)) return cache.get(obj);
+ var newObj = {
+ __proto__: null
+ };
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
+ for(var key in obj){
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
+ if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
+ else newObj[key] = obj[key];
+ }
+ }
+ newObj.default = obj;
+ if (cache) cache.set(obj, newObj);
+ return newObj;
+}
+module.exports.__commonJs = __commonJs;
+module.exports._interop_require_wildcard = _interop_require_wildcard;
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+
+
+//index.js:
+ // module_id: namespace.ts
+var farm_runtime_js_ns = require("./farm_runtime.js");
+var __commonJs = farm_runtime_js_ns.__commonJs;
+var bundle1_js_ns = require("./bundle1.js");
+var ns = bundle1_js_ns.ns;
+var namespace_cjs = __commonJs({
+ "namespace.ts": (module, exports)=>{
+ "use strict";
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+ function _export(target, all) {
+ for(var name in all)Object.defineProperty(target, name, {
+ enumerable: true,
+ get: all[name]
+ });
+ }
+ _export(exports, {
+ ns_default: function() {
+ return ns_default;
+ },
+ ns_named: function() {
+ return ns_named;
+ }
+ });
+ const ns_named = 'ns named';
+ const ns_default = 'ns default';
+ module.exports.name = '123';
+ }
+});
+var ns_default = namespace_cjs()["ns_default"], ns_named = namespace_cjs()["ns_named"];
+
+// module_id: default.ts
+const d = 'default';
+
+// module_id: index.ts
+console.log({
+ ns: ns,
+ bundle2: d
+});
+module.exports.d = d;
+module.exports.namespace_cjs = namespace_cjs;
+module.exports.ns_default = ns_default;
+module.exports.ns_named = ns_named;
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
diff --git a/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/cross_bundle/namespace/output.js b/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/cross_bundle/namespace/output.js
new file mode 100644
index 000000000..11bc8ca0c
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/cross_bundle/namespace/output.js
@@ -0,0 +1,100 @@
+//bundle1.js:
+ // module_id: bundle2.ts
+import { _interop_require_wildcard } from "./farm_runtime.js";
+import { d, namespace_cjs } from "./index.js";
+var ns = _interop_require_wildcard(namespace_cjs());
+export { d, ns };
+
+
+//farm_runtime.js:
+ // module_id: __FARM_BUNDLE_POLYFILL_SLOT__
+function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
+ }
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
+ }
+ return module.exports;
+ };
+}
+function _getRequireWildcardCache(nodeInterop) {
+ if (typeof WeakMap !== "function") return null;
+ var cacheBabelInterop = new WeakMap();
+ var cacheNodeInterop = new WeakMap();
+ return (_getRequireWildcardCache = function(nodeInterop) {
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
+ })(nodeInterop);
+}
+function _interop_require_wildcard(obj, nodeInterop) {
+ if (!nodeInterop && obj && obj.__esModule) return obj;
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
+ default: obj
+ };
+ var cache = _getRequireWildcardCache(nodeInterop);
+ if (cache && cache.has(obj)) return cache.get(obj);
+ var newObj = {
+ __proto__: null
+ };
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
+ for(var key in obj){
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
+ if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
+ else newObj[key] = obj[key];
+ }
+ }
+ newObj.default = obj;
+ if (cache) cache.set(obj, newObj);
+ return newObj;
+}
+export { __commonJs, _interop_require_wildcard };
+
+
+//index.js:
+ // module_id: namespace.ts
+import { __commonJs } from "./farm_runtime.js";
+import { ns } from "./bundle1.js";
+var namespace_cjs = __commonJs({
+ "namespace.ts": (module, exports)=>{
+ "use strict";
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+ function _export(target, all) {
+ for(var name in all)Object.defineProperty(target, name, {
+ enumerable: true,
+ get: all[name]
+ });
+ }
+ _export(exports, {
+ ns_default: function() {
+ return ns_default;
+ },
+ ns_named: function() {
+ return ns_named;
+ }
+ });
+ const ns_named = 'ns named';
+ const ns_default = 'ns default';
+ module.exports.name = '123';
+ }
+});
+var ns_default = namespace_cjs()["ns_default"], ns_named = namespace_cjs()["ns_named"];
+
+// module_id: default.ts
+const d = 'default';
+
+// module_id: index.ts
+console.log({
+ ns: ns,
+ bundle2: d
+});
+export { d, namespace_cjs, ns_default, ns_named };
diff --git a/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/entry_export/bundle2.ts b/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/entry_export/bundle2.ts
new file mode 100644
index 000000000..3291b0ab2
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/entry_export/bundle2.ts
@@ -0,0 +1,2 @@
+export const named = 'bundle2 named';
+export default 'bundle2 default'
\ No newline at end of file
diff --git a/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/entry_export/index.ts b/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/entry_export/index.ts
new file mode 100644
index 000000000..b4dd6e9ef
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/entry_export/index.ts
@@ -0,0 +1,4 @@
+export { named, default } from './bundle2';
+
+// TODO: fix it
+// export * as ns from './bundle2';
\ No newline at end of file
diff --git a/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/entry_export/output.js b/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/entry_export/output.js
new file mode 100644
index 000000000..f630c8a37
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/entry_export/output.js
@@ -0,0 +1,15 @@
+//bundle1.js:
+ // module_id: bundle2.ts
+const named = 'bundle2 named';
+var bundle2_default = 'bundle2 default';
+export { bundle2_default, named };
+
+
+//farm_runtime.js:
+ // module_id: __FARM_BUNDLE_POLYFILL_SLOT__
+
+
+//index.js:
+ // module_id: index.ts
+import { bundle2_default, named } from "./bundle1.js";
+export { bundle2_default as default, named };
diff --git a/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/namespace/bundle2.ts b/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/namespace/bundle2.ts
new file mode 100644
index 000000000..5d870bd6a
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/namespace/bundle2.ts
@@ -0,0 +1 @@
+export * as ns from './bundle2_namespace';
\ No newline at end of file
diff --git a/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/namespace/bundle2_namespace.ts b/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/namespace/bundle2_namespace.ts
new file mode 100644
index 000000000..4e6fb1206
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/namespace/bundle2_namespace.ts
@@ -0,0 +1,2 @@
+export const ns_named = 'ns named';
+export const ns_default = 'ns default';
diff --git a/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/namespace/index.ts b/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/namespace/index.ts
new file mode 100644
index 000000000..01711ceb8
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/namespace/index.ts
@@ -0,0 +1,3 @@
+import { ns } from './bundle2';
+
+console.log({ ns });
\ No newline at end of file
diff --git a/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/namespace/output.js b/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/namespace/output.js
new file mode 100644
index 000000000..16c9eee9c
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/namespace/output.js
@@ -0,0 +1,24 @@
+//bundle1.js:
+ // module_id: bundle2_namespace.ts
+const ns_named = 'ns named';
+const ns_default = 'ns default';
+var bundle2_namespace_ns = {
+ ns_default: ns_default,
+ ns_named: ns_named,
+ __esModule: true
+};
+
+// module_id: bundle2.ts
+export { bundle2_namespace_ns };
+
+
+//farm_runtime.js:
+ // module_id: __FARM_BUNDLE_POLYFILL_SLOT__
+
+
+//index.js:
+ // module_id: index.ts
+import { bundle2_namespace_ns } from "./bundle1.js";
+console.log({
+ ns: bundle2_namespace_ns
+});
diff --git a/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/reexport_cross_bundle/bundle2-foo.ts b/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/reexport_cross_bundle/bundle2-foo.ts
new file mode 100644
index 000000000..d1c6b14bb
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/reexport_cross_bundle/bundle2-foo.ts
@@ -0,0 +1,5 @@
+const bundle_str1 = 'bundle2 str1';
+
+console.log(bundle_str1);
+
+export default 'bundle2 foo';
\ No newline at end of file
diff --git a/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/reexport_cross_bundle/bundle2.ts b/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/reexport_cross_bundle/bundle2.ts
new file mode 100644
index 000000000..822733fdf
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/reexport_cross_bundle/bundle2.ts
@@ -0,0 +1,7 @@
+import { foo_str1, foo_str2 } from './foo';
+import './bundle2-foo';
+
+console.log({ foo_str1, foo_str2 });
+
+export const bundle_str1 = 'bundle str1';
+export const bundle_str2 = 'bundle str2';
\ No newline at end of file
diff --git a/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/reexport_cross_bundle/foo.ts b/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/reexport_cross_bundle/foo.ts
new file mode 100644
index 000000000..2d6a02f3f
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/reexport_cross_bundle/foo.ts
@@ -0,0 +1,11 @@
+
+export const foo_str1 = 'foo str1';
+export const foo_str2 = 'foo str2';
+
+const foo_str3 = 'foo str3';
+
+const index_foo = 234;
+
+console.log(foo_str1, index_foo, foo_str3);
+
+export default 'foo default';
\ No newline at end of file
diff --git a/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/reexport_cross_bundle/index.ts b/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/reexport_cross_bundle/index.ts
new file mode 100644
index 000000000..45cf5fffb
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/reexport_cross_bundle/index.ts
@@ -0,0 +1,14 @@
+import { bundle_str1 } from './bundle2';
+
+console.log(bundle_str1);
+
+export const index_foo = 'index foo';
+export const index_bar = 'index bar';
+
+const foo_str1 = 123;
+const foo_str3 = 'index-foo_str3';
+console.log(foo_str1, foo_str3);
+
+export default 'index default';
+
+// export * from './bundle2';
\ No newline at end of file
diff --git a/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/reexport_cross_bundle/output.js b/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/reexport_cross_bundle/output.js
new file mode 100644
index 000000000..13cc90bba
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/reexport_cross_bundle/output.js
@@ -0,0 +1,41 @@
+//bundle1.js:
+ // module_id: bundle2-foo.ts
+import { foo_str1, foo_str2 } from "./index.js";
+const bundle_str1 = 'bundle2 str1';
+console.log(bundle_str1);
+var bundle2_foo_default = 'bundle2 foo';
+
+// module_id: bundle2.ts
+console.log({
+ foo_str1: foo_str1,
+ foo_str2: foo_str2
+});
+const bundle_str1$1 = 'bundle str1';
+const bundle_str2 = 'bundle str2';
+export { bundle_str1$1, bundle_str2 };
+
+
+//farm_runtime.js:
+ // module_id: __FARM_BUNDLE_POLYFILL_SLOT__
+
+
+//index.js:
+ // module_id: foo.ts
+import { bundle_str1$1 } from "./bundle1.js";
+const foo_str1 = 'foo str1';
+const foo_str2 = 'foo str2';
+const foo_str3 = 'foo str3';
+const index_foo = 234;
+console.log(foo_str1, index_foo, foo_str3);
+var foo_default = 'foo default';
+
+// module_id: index.ts
+console.log(bundle_str1$1);
+const index_foo$1 = 'index foo';
+const index_bar = 'index bar';
+const foo_str1$1 = 123;
+const foo_str3$1 = 'index-foo_str3';
+console.log(foo_str1$1, foo_str3$1);
+var index_default = 'index default';
+export { index_bar, index_foo$1 as index_foo, index_default as default };
+export { foo_default, foo_str1, foo_str2 };
diff --git a/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/reexport_cross_bundle_1/bundle2.ts b/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/reexport_cross_bundle_1/bundle2.ts
new file mode 100644
index 000000000..5afe39162
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/reexport_cross_bundle_1/bundle2.ts
@@ -0,0 +1,7 @@
+import bundle2_default from './default';
+import * as bundle2_namespace from './namespace';
+import { foo_named as bundle2_named } from './named';
+
+console.log({ bundle2_default, bundle2_namespace, bundle2_named });
+
+export { bundle2_default, bundle2_namespace, bundle2_named }
\ No newline at end of file
diff --git a/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/reexport_cross_bundle_1/config.cjs.json b/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/reexport_cross_bundle_1/config.cjs.json
new file mode 100644
index 000000000..a54e6cace
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/reexport_cross_bundle_1/config.cjs.json
@@ -0,0 +1,5 @@
+{
+ "output": {
+ "format": "cjs"
+ }
+}
\ No newline at end of file
diff --git a/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/reexport_cross_bundle_1/default.ts b/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/reexport_cross_bundle_1/default.ts
new file mode 100644
index 000000000..7df88d728
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/reexport_cross_bundle_1/default.ts
@@ -0,0 +1 @@
+export default '123';
\ No newline at end of file
diff --git a/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/reexport_cross_bundle_1/index.ts b/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/reexport_cross_bundle_1/index.ts
new file mode 100644
index 000000000..94a8d33ca
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/reexport_cross_bundle_1/index.ts
@@ -0,0 +1,5 @@
+import { bundle2_default, bundle2_named, bundle2_namespace } from './bundle2';
+
+console.log(bundle2_default, bundle2_named, bundle2_namespace);
+
+export default 'index';
\ No newline at end of file
diff --git a/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/reexport_cross_bundle_1/named.ts b/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/reexport_cross_bundle_1/named.ts
new file mode 100644
index 000000000..911b22928
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/reexport_cross_bundle_1/named.ts
@@ -0,0 +1 @@
+export const foo_named = '123';
\ No newline at end of file
diff --git a/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/reexport_cross_bundle_1/namespace.ts b/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/reexport_cross_bundle_1/namespace.ts
new file mode 100644
index 000000000..d7a5dde9b
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/reexport_cross_bundle_1/namespace.ts
@@ -0,0 +1,2 @@
+export const foo_ns = 'ns_foo';
+export default 'ns_default';
\ No newline at end of file
diff --git a/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/reexport_cross_bundle_1/output.cjs.js b/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/reexport_cross_bundle_1/output.cjs.js
new file mode 100644
index 000000000..aba014a29
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/reexport_cross_bundle_1/output.cjs.js
@@ -0,0 +1,49 @@
+//bundle1.js:
+ // module_id: bundle2.ts
+var index_c86a_ns = require("./index.js");
+var default_default$1 = index_c86a_ns.default_default$1, foo_named = index_c86a_ns.foo_named, namespace_ns = index_c86a_ns.namespace_ns;
+console.log({
+ bundle2_default: default_default$1,
+ bundle2_namespace: namespace_ns,
+ bundle2_named: foo_named
+});
+module.exports.default_default$1 = default_default$1;
+module.exports.foo_named = foo_named;
+module.exports.namespace_ns = namespace_ns;
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+
+
+//farm_runtime.js:
+ // module_id: __FARM_BUNDLE_POLYFILL_SLOT__
+
+
+//index.js:
+ // module_id: default.ts
+var default_default$1 = '123';
+
+// module_id: namespace.ts
+const foo_ns = 'ns_foo';
+var namespace_default = 'ns_default';
+var namespace_ns = {
+ foo_ns: foo_ns,
+ "default": namespace_default,
+ __esModule: true
+};
+
+// module_id: named.ts
+const foo_named = '123';
+
+// module_id: index.ts
+console.log(default_default$1, foo_named, namespace_ns);
+var index_default = 'index';
+module.exports.default = index_default;
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+module.exports.default_default$1 = default_default$1;
+module.exports.foo_named = foo_named;
+module.exports.foo_ns = foo_ns;
+module.exports.namespace_default = namespace_default;
+module.exports.namespace_ns = namespace_ns;
diff --git a/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/reexport_cross_bundle_1/output.js b/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/reexport_cross_bundle_1/output.js
new file mode 100644
index 000000000..117f69def
--- /dev/null
+++ b/crates/compiler/tests/fixtures/bundle/multiple_bundle/reexport/reexport_cross_bundle_1/output.js
@@ -0,0 +1,36 @@
+//bundle1.js:
+ // module_id: bundle2.ts
+import { default_default$1, foo_named, namespace_ns } from "./index.js";
+console.log({
+ bundle2_default: default_default$1,
+ bundle2_namespace: namespace_ns,
+ bundle2_named: foo_named
+});
+export { default_default$1, foo_named, namespace_ns };
+
+
+//farm_runtime.js:
+ // module_id: __FARM_BUNDLE_POLYFILL_SLOT__
+
+
+//index.js:
+ // module_id: default.ts
+var default_default$1 = '123';
+
+// module_id: namespace.ts
+const foo_ns = 'ns_foo';
+var namespace_default = 'ns_default';
+var namespace_ns = {
+ foo_ns: foo_ns,
+ "default": namespace_default,
+ __esModule: true
+};
+
+// module_id: named.ts
+const foo_named = '123';
+
+// module_id: index.ts
+console.log(default_default$1, foo_named, namespace_ns);
+var index_default = 'index';
+export { index_default as default };
+export { default_default$1, foo_named, foo_ns, namespace_default, namespace_ns };
diff --git a/crates/compiler/tests/fixtures/css/modules/composes/external_import/output.js b/crates/compiler/tests/fixtures/css/modules/composes/external_import/output.js
index 6625fca3a..606065d0d 100644
--- a/crates/compiler/tests/fixtures/css/modules/composes/external_import/output.js
+++ b/crates/compiler/tests/fixtures/css/modules/composes/external_import/output.js
@@ -1,69 +1,27 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_0467.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"8b6840d6":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
"";
diff --git a/crates/compiler/tests/fixtures/css/modules/composes/global_import/output.js b/crates/compiler/tests/fixtures/css/modules/composes/global_import/output.js
index ad80cca5c..176684dd5 100644
--- a/crates/compiler/tests/fixtures/css/modules/composes/global_import/output.js
+++ b/crates/compiler/tests/fixtures/css/modules/composes/global_import/output.js
@@ -1,69 +1,27 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_2544.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"95fe6ac5":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
"";
diff --git a/crates/compiler/tests/fixtures/css/modules/composes/local_import/output.js b/crates/compiler/tests/fixtures/css/modules/composes/local_import/output.js
index a7b5c01be..a5efdba77 100644
--- a/crates/compiler/tests/fixtures/css/modules/composes/local_import/output.js
+++ b/crates/compiler/tests/fixtures/css/modules/composes/local_import/output.js
@@ -1,69 +1,27 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_2544.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"95fe6ac5":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
"";
diff --git a/crates/compiler/tests/fixtures/css/modules/global/output.js b/crates/compiler/tests/fixtures/css/modules/global/output.js
index 269e4e6e3..1c8aa9a3c 100644
--- a/crates/compiler/tests/fixtures/css/modules/global/output.js
+++ b/crates/compiler/tests/fixtures/css/modules/global/output.js
@@ -1,69 +1,27 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_2544.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"95fe6ac5":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
"";
diff --git a/crates/compiler/tests/fixtures/css/modules/local/output.js b/crates/compiler/tests/fixtures/css/modules/local/output.js
index 7edd2e0d0..7548fec04 100644
--- a/crates/compiler/tests/fixtures/css/modules/local/output.js
+++ b/crates/compiler/tests/fixtures/css/modules/local/output.js
@@ -1,69 +1,27 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_2544.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"95fe6ac5":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
"";
diff --git a/crates/compiler/tests/fixtures/css/modules/normal/output.js b/crates/compiler/tests/fixtures/css/modules/normal/output.js
index 6fd40ed07..d5e639e2b 100644
--- a/crates/compiler/tests/fixtures/css/modules/normal/output.js
+++ b/crates/compiler/tests/fixtures/css/modules/normal/output.js
@@ -1,69 +1,27 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_2544.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"95fe6ac5":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
"";
diff --git a/crates/compiler/tests/fixtures/css/prefixer/normal/output.js b/crates/compiler/tests/fixtures/css/prefixer/normal/output.js
index 504a5152f..845eca938 100644
--- a/crates/compiler/tests/fixtures/css/prefixer/normal/output.js
+++ b/crates/compiler/tests/fixtures/css/prefixer/normal/output.js
@@ -1,69 +1,27 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_dcdc.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"b5d64806":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
"";
diff --git a/crates/compiler/tests/fixtures/css/url_replacer/absolute/output.js b/crates/compiler/tests/fixtures/css/url_replacer/absolute/output.js
index 6bc33eb99..6e9b6081f 100644
--- a/crates/compiler/tests/fixtures/css/url_replacer/absolute/output.js
+++ b/crates/compiler/tests/fixtures/css/url_replacer/absolute/output.js
@@ -1,69 +1,27 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_dcdc.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"b5d64806":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
"";
diff --git a/crates/compiler/tests/fixtures/css/url_replacer/ignored/output.js b/crates/compiler/tests/fixtures/css/url_replacer/ignored/output.js
index a8d91a1fc..78dc24acc 100644
--- a/crates/compiler/tests/fixtures/css/url_replacer/ignored/output.js
+++ b/crates/compiler/tests/fixtures/css/url_replacer/ignored/output.js
@@ -1,69 +1,27 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_dcdc.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"b5d64806":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
"";
diff --git a/crates/compiler/tests/fixtures/external/browser/normal/cjs/output.js b/crates/compiler/tests/fixtures/external/browser/normal/cjs/output.js
index 85332e7ab..16d563d19 100644
--- a/crates/compiler/tests/fixtures/external/browser/normal/cjs/output.js
+++ b/crates/compiler/tests/fixtures/external/browser/normal/cjs/output.js
@@ -1,69 +1,27 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());window['__farm_default_namespace__'].__farm_module_system__.setExternalModules({"jquery": window['jquery']||{}});(function(_){for(var r in _){_[r].__farm_resource_pot__='index_dcdc.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"b5d64806":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
var _f_jquery = module.i(farmRequire('jquery'));
diff --git a/crates/compiler/tests/fixtures/external/browser/normal/esm/output.js b/crates/compiler/tests/fixtures/external/browser/normal/esm/output.js
index 07bba9d11..40218a309 100644
--- a/crates/compiler/tests/fixtures/external/browser/normal/esm/output.js
+++ b/crates/compiler/tests/fixtures/external/browser/normal/esm/output.js
@@ -1,69 +1,27 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());window['__farm_default_namespace__'].__farm_module_system__.setExternalModules({"jquery": (window['jquery']||{}).default && !(window['jquery']||{}).__esModule ? {...(window['jquery']||{}),__esModule:true} : ({...window['jquery']||{}})});(function(_){for(var r in _){_[r].__farm_resource_pot__='index_dcdc.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"b5d64806":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
var _f_jquery = module.i(farmRequire('jquery'));
diff --git a/crates/compiler/tests/fixtures/external/browser/object/cjs/output.js b/crates/compiler/tests/fixtures/external/browser/object/cjs/output.js
index 0b9c5b37b..338e69a81 100644
--- a/crates/compiler/tests/fixtures/external/browser/object/cjs/output.js
+++ b/crates/compiler/tests/fixtures/external/browser/object/cjs/output.js
@@ -1,69 +1,27 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());window['__farm_default_namespace__'].__farm_module_system__.setExternalModules({"jquery": window['$']||{}});(function(_){for(var r in _){_[r].__farm_resource_pot__='index_dcdc.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"b5d64806":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
var _f_jquery = module.i(farmRequire('jquery'));
diff --git a/crates/compiler/tests/fixtures/external/browser/object/esm/output.js b/crates/compiler/tests/fixtures/external/browser/object/esm/output.js
index b93573402..f203198a6 100644
--- a/crates/compiler/tests/fixtures/external/browser/object/esm/output.js
+++ b/crates/compiler/tests/fixtures/external/browser/object/esm/output.js
@@ -1,69 +1,27 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());window['__farm_default_namespace__'].__farm_module_system__.setExternalModules({"jquery": (window['$']||{}).default && !(window['$']||{}).__esModule ? {...(window['$']||{}),__esModule:true} : ({...window['$']||{}})});(function(_){for(var r in _){_[r].__farm_resource_pot__='index_dcdc.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"b5d64806":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
var _f_jquery = module.i(farmRequire('jquery'));
diff --git a/crates/compiler/tests/fixtures/external/node/hosting/import/output.js b/crates/compiler/tests/fixtures/external/node/hosting/import/output.js
index 0a276bda9..c1c9e7f2e 100644
--- a/crates/compiler/tests/fixtures/external/node/hosting/import/output.js
+++ b/crates/compiler/tests/fixtures/external/node/hosting/import/output.js
@@ -1,69 +1,27 @@
//index.js:
- import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
global['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
import * as __farm_external_module_jquery from "jquery";global['__farm_default_namespace__'].__farm_module_system__.setExternalModules({"jquery": __farm_external_module_jquery && __farm_external_module_jquery.default && !__farm_external_module_jquery.__esModule ? {...__farm_external_module_jquery,__esModule:true} : {...__farm_external_module_jquery}});(function(_){for(var r in _){_[r].__farm_resource_pot__='index_dcdc.js';global['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"b5d64806":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
var _f_jquery = module.i(farmRequire('jquery'));
diff --git a/crates/compiler/tests/fixtures/external/node/hosting/require/output.js b/crates/compiler/tests/fixtures/external/node/hosting/require/output.js
index 74191645b..559c574d0 100644
--- a/crates/compiler/tests/fixtures/external/node/hosting/require/output.js
+++ b/crates/compiler/tests/fixtures/external/node/hosting/require/output.js
@@ -1,69 +1,27 @@
//index.js:
- import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
global['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
(function(_){for(var r in _){_[r].__farm_resource_pot__='index_dcdc.js';global['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"b5d64806":function (module, exports, farmRequire, farmDynamicRequire) {
const xxx = global.nodeRequire('jquery', true);
console.log({
diff --git a/crates/compiler/tests/fixtures/external/node/normala/cjs/output.js b/crates/compiler/tests/fixtures/external/node/normala/cjs/output.js
index 31a071647..d65131aee 100644
--- a/crates/compiler/tests/fixtures/external/node/normala/cjs/output.js
+++ b/crates/compiler/tests/fixtures/external/node/normala/cjs/output.js
@@ -1,69 +1,27 @@
//index.js:
- global.nodeRequire = require;global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ global.nodeRequire = require;global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
global['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
var __farm_external_module_jquery = require("jquery");global['__farm_default_namespace__'].__farm_module_system__.setExternalModules({"jquery": __farm_external_module_jquery});(function(_){for(var r in _){_[r].__farm_resource_pot__='file://'+__filename;global['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"b5d64806":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
var _f_jquery = module.i(farmRequire('jquery'));
diff --git a/crates/compiler/tests/fixtures/external/node/normala/esm/output.js b/crates/compiler/tests/fixtures/external/node/normala/esm/output.js
index d5f3e2bbb..c0d6c52a3 100644
--- a/crates/compiler/tests/fixtures/external/node/normala/esm/output.js
+++ b/crates/compiler/tests/fixtures/external/node/normala/esm/output.js
@@ -1,69 +1,27 @@
//index.js:
- import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
global['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
import * as __farm_external_module_jquery from "jquery";global['__farm_default_namespace__'].__farm_module_system__.setExternalModules({"jquery": __farm_external_module_jquery && __farm_external_module_jquery.default && !__farm_external_module_jquery.__esModule ? {...__farm_external_module_jquery,__esModule:true} : {...__farm_external_module_jquery}});(function(_){for(var r in _){_[r].__farm_resource_pot__='index_dcdc.js';global['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"b5d64806":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
var _f_jquery = module.i(farmRequire('jquery'));
diff --git a/crates/compiler/tests/fixtures/minify/css/basic/output.js b/crates/compiler/tests/fixtures/minify/css/basic/output.js
index a81c8090b..087eacdcc 100644
--- a/crates/compiler/tests/fixtures/minify/css/basic/output.js
+++ b/crates/compiler/tests/fixtures/minify/css/basic/output.js
@@ -1,5 +1,5 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};var e,s;e=(e,s)=>{"use strict";console.log("runtime/index.js"),window.__farm_default_namespace__.__farm_module_system__.setPlugins([]);},()=>(s||(s={exports:{}},"function"==typeof e?e(s,s.exports):e[Object.keys(e)[0]](s,s.exports)),s.exports);(function(_){for(var r in _){_[r].__farm_resource_pot__='index_dcdc.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"b5d64806":function n(n,c,f,i){n._m(c);},});window['__farm_default_namespace__'].__farm_module_system__.setInitialLoadedResources([]);window['__farm_default_namespace__'].__farm_module_system__.setDynamicModuleResourcesMap([],{ });var farmModuleSystem = window['__farm_default_namespace__'].__farm_module_system__;farmModuleSystem.bootstrap();var entry = farmModuleSystem.require("b5d64806");
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};var e,s;(e=(e,s)=>{"use strict";console.log("runtime/index.js"),window.__farm_default_namespace__.__farm_module_system__.setPlugins([]);},()=>(s||(s={exports:{}},"function"==typeof e?e(s,s.exports):e[Object.keys(e)[0]](s,s.exports)),s.exports))();(function(_){for(var r in _){_[r].__farm_resource_pot__='index_dcdc.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"b5d64806":function n(n,c,f,i){n._m(c);},});window['__farm_default_namespace__'].__farm_module_system__.setInitialLoadedResources([]);window['__farm_default_namespace__'].__farm_module_system__.setDynamicModuleResourcesMap([],{ });var farmModuleSystem = window['__farm_default_namespace__'].__farm_module_system__;farmModuleSystem.bootstrap();var entry = farmModuleSystem.require("b5d64806");
//index_6dd2.css:
#root{color:green}
diff --git a/crates/compiler/tests/fixtures/minify/html/output.js b/crates/compiler/tests/fixtures/minify/html/output.js
index 4b775816e..25abc6e01 100644
--- a/crates/compiler/tests/fixtures/minify/html/output.js
+++ b/crates/compiler/tests/fixtures/minify/html/output.js
@@ -1,2 +1,2 @@
//index.html:
- Document
\ No newline at end of file
+ Document
\ No newline at end of file
diff --git a/crates/compiler/tests/fixtures/minify/script/basic/output.js b/crates/compiler/tests/fixtures/minify/script/basic/output.js
index dfa83e788..dbdeff0b3 100644
--- a/crates/compiler/tests/fixtures/minify/script/basic/output.js
+++ b/crates/compiler/tests/fixtures/minify/script/basic/output.js
@@ -1,2 +1,2 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};var e,s;e=(e,s)=>{"use strict";console.log("runtime/index.js"),window.__farm_default_namespace__.__farm_module_system__.setPlugins([]);},()=>(s||(s={exports:{}},"function"==typeof e?e(s,s.exports):e[Object.keys(e)[0]](s,s.exports)),s.exports);(function(_){for(var r in _){_[r].__farm_resource_pot__='index_ddf1.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"05ee5ec7":function n(n,t,e,o){n._m(t),n.o(t,"dep_a",function(){return u;});let u=1;},"b5d64806":function e(e,n,a,c){e._m(n);var d=a("05ee5ec7");document.body.innerHTML="a = "+d.dep_a;},});window['__farm_default_namespace__'].__farm_module_system__.setInitialLoadedResources([]);window['__farm_default_namespace__'].__farm_module_system__.setDynamicModuleResourcesMap([],{ });var farmModuleSystem = window['__farm_default_namespace__'].__farm_module_system__;farmModuleSystem.bootstrap();var entry = farmModuleSystem.require("b5d64806");
\ No newline at end of file
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};var e,s;(e=(e,s)=>{"use strict";console.log("runtime/index.js"),window.__farm_default_namespace__.__farm_module_system__.setPlugins([]);},()=>(s||(s={exports:{}},"function"==typeof e?e(s,s.exports):e[Object.keys(e)[0]](s,s.exports)),s.exports))();(function(_){for(var r in _){_[r].__farm_resource_pot__='index_ddf1.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"05ee5ec7":function n(n,t,e,o){n._m(t),n.o(t,"dep_a",function(){return u;});let u=1;},"b5d64806":function e(e,n,a,c){e._m(n);var d=a("05ee5ec7");document.body.innerHTML="a = "+d.dep_a;},});window['__farm_default_namespace__'].__farm_module_system__.setInitialLoadedResources([]);window['__farm_default_namespace__'].__farm_module_system__.setDynamicModuleResourcesMap([],{ });var farmModuleSystem = window['__farm_default_namespace__'].__farm_module_system__;farmModuleSystem.bootstrap();var entry = farmModuleSystem.require("b5d64806");
\ No newline at end of file
diff --git a/crates/compiler/tests/fixtures/minify/script/function/output.js b/crates/compiler/tests/fixtures/minify/script/function/output.js
index f6137e2d0..b1a245771 100644
--- a/crates/compiler/tests/fixtures/minify/script/function/output.js
+++ b/crates/compiler/tests/fixtures/minify/script/function/output.js
@@ -1,2 +1,2 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};var e,s;e=(e,s)=>{"use strict";console.log("runtime/index.js"),window.__farm_default_namespace__.__farm_module_system__.setPlugins([]);},()=>(s||(s={exports:{}},"function"==typeof e?e(s,s.exports):e[Object.keys(e)[0]](s,s.exports)),s.exports);(function(_){for(var r in _){_[r].__farm_resource_pot__='index_ddf1.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"05ee5ec7":function t(t,e,n,i){function h(t){return"number"==typeof t&&!isNaN(t);}function r(t,e,n,i){var r=n,a=i;if(e){var d,o=(d=getComputedStyle(t),{width:(t.clientWidth||parseInt(d.width,10))-parseInt(d.paddingLeft,10)-parseInt(d.paddingRight,10),height:(t.clientHeight||parseInt(d.height,10))-parseInt(d.paddingTop,10)-parseInt(d.paddingBottom,10)});r=o.width?o.width:r,a=o.height?o.height:a;}return{width:Math.max(h(r)?r:1,1),height:Math.max(h(a)?a:1,1)};}function a(t){var e=t.parentNode;e&&e.removeChild(t);}t._m(e),t.o(e,"getChartSize",function(){return r;}),t.o(e,"removeDom",function(){return a;});},"b5d64806":function e(e,o,c,m){e._m(o);var n=c("05ee5ec7");console.log(n.getChartSize,n.removeDom);},});window['__farm_default_namespace__'].__farm_module_system__.setInitialLoadedResources([]);window['__farm_default_namespace__'].__farm_module_system__.setDynamicModuleResourcesMap([],{ });var farmModuleSystem = window['__farm_default_namespace__'].__farm_module_system__;farmModuleSystem.bootstrap();var entry = farmModuleSystem.require("b5d64806");
\ No newline at end of file
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};var e,s;(e=(e,s)=>{"use strict";console.log("runtime/index.js"),window.__farm_default_namespace__.__farm_module_system__.setPlugins([]);},()=>(s||(s={exports:{}},"function"==typeof e?e(s,s.exports):e[Object.keys(e)[0]](s,s.exports)),s.exports))();(function(_){for(var r in _){_[r].__farm_resource_pot__='index_ddf1.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"05ee5ec7":function t(t,e,n,i){function h(t){return"number"==typeof t&&!isNaN(t);}function r(t,e,n,i){var r=n,a=i;if(e){var d,o=(d=getComputedStyle(t),{width:(t.clientWidth||parseInt(d.width,10))-parseInt(d.paddingLeft,10)-parseInt(d.paddingRight,10),height:(t.clientHeight||parseInt(d.height,10))-parseInt(d.paddingTop,10)-parseInt(d.paddingBottom,10)});r=o.width?o.width:r,a=o.height?o.height:a;}return{width:Math.max(h(r)?r:1,1),height:Math.max(h(a)?a:1,1)};}function a(t){var e=t.parentNode;e&&e.removeChild(t);}t._m(e),t.o(e,"getChartSize",function(){return r;}),t.o(e,"removeDom",function(){return a;});},"b5d64806":function e(e,o,c,m){e._m(o);var n=c("05ee5ec7");console.log(n.getChartSize,n.removeDom);},});window['__farm_default_namespace__'].__farm_module_system__.setInitialLoadedResources([]);window['__farm_default_namespace__'].__farm_module_system__.setDynamicModuleResourcesMap([],{ });var farmModuleSystem = window['__farm_default_namespace__'].__farm_module_system__;farmModuleSystem.bootstrap();var entry = farmModuleSystem.require("b5d64806");
\ No newline at end of file
diff --git a/crates/compiler/tests/fixtures/partial_bundling/basic/output.js b/crates/compiler/tests/fixtures/partial_bundling/basic/output.js
index dfc875e09..42fac550e 100644
--- a/crates/compiler/tests/fixtures/partial_bundling/basic/output.js
+++ b/crates/compiler/tests/fixtures/partial_bundling/basic/output.js
@@ -1,69 +1,27 @@
//__farm_runtime.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());
//debounce_6f74.js:
diff --git a/crates/compiler/tests/fixtures/runtime/bundle/browser/external/output.js b/crates/compiler/tests/fixtures/runtime/bundle/browser/external/output.js
index ae97ee835..906b59387 100644
--- a/crates/compiler/tests/fixtures/runtime/bundle/browser/external/output.js
+++ b/crates/compiler/tests/fixtures/runtime/bundle/browser/external/output.js
@@ -1,49 +1,5 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
- }
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
- }
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}((function(){import fs from "node:fs.farm-runtime";
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){import fs from "node:fs.farm-runtime";
console.log(fs);
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_dcdc.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"b5d64806":function (module, exports, farmRequire, farmDynamicRequire) {}
diff --git a/crates/compiler/tests/fixtures/runtime/bundle/browser/normal/output.js b/crates/compiler/tests/fixtures/runtime/bundle/browser/normal/output.js
index 0e10cc9f3..f9badff4a 100644
--- a/crates/compiler/tests/fixtures/runtime/bundle/browser/normal/output.js
+++ b/crates/compiler/tests/fixtures/runtime/bundle/browser/normal/output.js
@@ -1,68 +1,26 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var runtime_ts_cjs = __commonJs((module, exports)=>{
+}
+var runtime_ts_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('hello world');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+runtime_ts_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_dcdc.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"b5d64806":function (module, exports, farmRequire, farmDynamicRequire) {}
,});window['__farm_default_namespace__'].__farm_module_system__.setInitialLoadedResources([]);window['__farm_default_namespace__'].__farm_module_system__.setDynamicModuleResourcesMap([],{ });var farmModuleSystem = window['__farm_default_namespace__'].__farm_module_system__;farmModuleSystem.bootstrap();var entry = farmModuleSystem.require("b5d64806");
\ No newline at end of file
diff --git a/crates/compiler/tests/fixtures/runtime/bundle/cjs/export/circlesImportCjs/output.js b/crates/compiler/tests/fixtures/runtime/bundle/cjs/export/circlesImportCjs/output.js
index 965ca4ffa..7b65d49b5 100644
--- a/crates/compiler/tests/fixtures/runtime/bundle/cjs/export/circlesImportCjs/output.js
+++ b/crates/compiler/tests/fixtures/runtime/bundle/cjs/export/circlesImportCjs/output.js
@@ -1,65 +1,22 @@
//index.js:
- import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}var cjs_ts_cjs = __commonJs((module, exports)=>{
+}
+var cjs_ts_cjs = __commonJs((module, exports)=>{
const foo = export_ts_cjs();
module.exports.name = "foo";
module.exports.age = 18;
diff --git a/crates/compiler/tests/fixtures/runtime/bundle/cjs/export/entryExportStar/output.js b/crates/compiler/tests/fixtures/runtime/bundle/cjs/export/entryExportStar/output.js
index 11d6d57ce..f9c13cbea 100644
--- a/crates/compiler/tests/fixtures/runtime/bundle/cjs/export/entryExportStar/output.js
+++ b/crates/compiler/tests/fixtures/runtime/bundle/cjs/export/entryExportStar/output.js
@@ -1,21 +1,30 @@
//index.js:
- global.nodeRequire = require;global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ global.nodeRequire = require;global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
+ }
+ return module.exports;
+ };
+}
+function _getRequireWildcardCache(nodeInterop) {
+ if (typeof WeakMap !== "function") return null;
+ var cacheBabelInterop = new WeakMap();
+ var cacheNodeInterop = new WeakMap();
+ return (_getRequireWildcardCache = function(nodeInterop) {
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
+ })(nodeInterop);
+}
+function _interop_require_wildcard(obj, nodeInterop) {
if (!nodeInterop && obj && obj.__esModule) return obj;
if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
default: obj
@@ -36,30 +45,8 @@
newObj.default = obj;
if (cache) cache.set(obj, newObj);
return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
- };
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}var node_fs_ns = _interop_require_wildcard(require("node:fs.farm-runtime"));
+}
+var node_fs_ns = _interop_require_wildcard(require("node:fs.farm-runtime"));
var cjsExport_ts_cjs = __commonJs((module, exports)=>{
"use strict";
Object.defineProperty(exports, "__esModule", {
diff --git a/crates/compiler/tests/fixtures/runtime/bundle/cjs/export/exportNamed/output.js b/crates/compiler/tests/fixtures/runtime/bundle/cjs/export/exportNamed/output.js
index 82c89068a..3f85b37c0 100644
--- a/crates/compiler/tests/fixtures/runtime/bundle/cjs/export/exportNamed/output.js
+++ b/crates/compiler/tests/fixtures/runtime/bundle/cjs/export/exportNamed/output.js
@@ -1,65 +1,22 @@
//index.js:
- import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};// module_id: dep.ts.farm-runtime
+function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}// module_id: dep.ts.farm-runtime
+}
var dep_ts_cjs = __commonJs({
"dep.ts.farm-runtime": (module, exports)=>{
module.exports.name = 'shulan';
diff --git a/crates/compiler/tests/fixtures/runtime/bundle/cjs/export/exportNamespace/output.js b/crates/compiler/tests/fixtures/runtime/bundle/cjs/export/exportNamespace/output.js
index 760b155a4..b9f7f8381 100644
--- a/crates/compiler/tests/fixtures/runtime/bundle/cjs/export/exportNamespace/output.js
+++ b/crates/compiler/tests/fixtures/runtime/bundle/cjs/export/exportNamespace/output.js
@@ -1,21 +1,30 @@
//index.js:
- import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
+ }
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
+ return module.exports;
+ };
+}
+function _getRequireWildcardCache(nodeInterop) {
+ if (typeof WeakMap !== "function") return null;
+ var cacheBabelInterop = new WeakMap();
+ var cacheNodeInterop = new WeakMap();
+ return (_getRequireWildcardCache = function(nodeInterop) {
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
+ })(nodeInterop);
+}
+function _interop_require_wildcard(obj, nodeInterop) {
if (!nodeInterop && obj && obj.__esModule) return obj;
if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
default: obj
@@ -36,30 +45,8 @@
newObj.default = obj;
if (cache) cache.set(obj, newObj);
return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
- };
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}var dep_ts_cjs = __commonJs((module, exports)=>{
+}
+var dep_ts_cjs = __commonJs((module, exports)=>{
module.exports.name = 'shulan';
module.exports.age = 18;
module.exports.default = 'default';
diff --git a/crates/compiler/tests/fixtures/runtime/bundle/cjs/export/exportStar/output.js b/crates/compiler/tests/fixtures/runtime/bundle/cjs/export/exportStar/output.js
index 2e0bcb65e..62524c70f 100644
--- a/crates/compiler/tests/fixtures/runtime/bundle/cjs/export/exportStar/output.js
+++ b/crates/compiler/tests/fixtures/runtime/bundle/cjs/export/exportStar/output.js
@@ -1,78 +1,38 @@
//index.js:
- import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function _mergeNamespaces(n, m) {
- m.forEach(function (e) {
- e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
+ return module.exports;
+ };
+}
+function _mergeNamespaces(n, m) {
+ m.forEach(function(e) {
+ e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function(k) {
if (k !== 'default' && !(k in n)) {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
- get: function () { return e[k]; }
+ get: function() {
+ return e[k];
+ }
});
}
});
});
return Object.freeze(n);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
- };
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}var cjsExport_ts_cjs = __commonJs((module, exports)=>{
+}
+var cjsExport_ts_cjs = __commonJs((module, exports)=>{
module.exports.name = 'shulan';
module.exports.age = 18;
module.exports.default = 'default';
diff --git a/crates/compiler/tests/fixtures/runtime/bundle/cjs/export/repeatUsingCjs/output.js b/crates/compiler/tests/fixtures/runtime/bundle/cjs/export/repeatUsingCjs/output.js
index c07d01b81..f89a30ad2 100644
--- a/crates/compiler/tests/fixtures/runtime/bundle/cjs/export/repeatUsingCjs/output.js
+++ b/crates/compiler/tests/fixtures/runtime/bundle/cjs/export/repeatUsingCjs/output.js
@@ -1,21 +1,30 @@
//index.js:
- import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
+ }
+ return module.exports;
+ };
+}
+function _getRequireWildcardCache(nodeInterop) {
+ if (typeof WeakMap !== "function") return null;
+ var cacheBabelInterop = new WeakMap();
+ var cacheNodeInterop = new WeakMap();
+ return (_getRequireWildcardCache = function(nodeInterop) {
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
+ })(nodeInterop);
+}
+function _interop_require_wildcard(obj, nodeInterop) {
if (!nodeInterop && obj && obj.__esModule) return obj;
if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
default: obj
@@ -36,30 +45,13 @@
newObj.default = obj;
if (cache) cache.set(obj, newObj);
return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+}
+function _interop_require_default(obj) {
+ return obj && obj.__esModule ? obj : {
+ default: obj
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}var cjs_ts_cjs = __commonJs((module, exports)=>{
+}
+var cjs_ts_cjs = __commonJs((module, exports)=>{
module.exports.name = "foo";
module.exports.age = 18;
});
diff --git a/crates/compiler/tests/fixtures/runtime/bundle/cjs/hybrid/exportStar/output.js b/crates/compiler/tests/fixtures/runtime/bundle/cjs/hybrid/exportStar/output.js
index 2c4c2a61d..ffcfe7567 100644
--- a/crates/compiler/tests/fixtures/runtime/bundle/cjs/hybrid/exportStar/output.js
+++ b/crates/compiler/tests/fixtures/runtime/bundle/cjs/hybrid/exportStar/output.js
@@ -1,78 +1,38 @@
//index.js:
- import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};// module_id: cjsExport.ts.farm-runtime
+function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function _mergeNamespaces(n, m) {
- m.forEach(function (e) {
- e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
+ return module.exports;
+ };
+}
+function _mergeNamespaces(n, m) {
+ m.forEach(function(e) {
+ e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function(k) {
if (k !== 'default' && !(k in n)) {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
- get: function () { return e[k]; }
+ get: function() {
+ return e[k];
+ }
});
}
});
});
return Object.freeze(n);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
- };
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}// module_id: cjsExport.ts.farm-runtime
+}
import * as node_fs_ns from "node:fs.farm-runtime";
var cjsExport_ts_cjs = __commonJs({
"cjsExport.ts.farm-runtime": (module, exports)=>{
diff --git a/crates/compiler/tests/fixtures/runtime/bundle/cjs/hybrid/nested_require/output.js b/crates/compiler/tests/fixtures/runtime/bundle/cjs/hybrid/nested_require/output.js
index 2ff61e1c9..06cc34f1a 100644
--- a/crates/compiler/tests/fixtures/runtime/bundle/cjs/hybrid/nested_require/output.js
+++ b/crates/compiler/tests/fixtures/runtime/bundle/cjs/hybrid/nested_require/output.js
@@ -1,65 +1,22 @@
//index.js:
- import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}function cjs_ts_default() {
+}
+function cjs_ts_default() {
console.log('foo');
}
var cjs_ts_ns = {
diff --git a/crates/compiler/tests/fixtures/runtime/bundle/cjs/hybrid/unresolved_variables/output.js b/crates/compiler/tests/fixtures/runtime/bundle/cjs/hybrid/unresolved_variables/output.js
index 9286e786e..0c3c0d4f5 100644
--- a/crates/compiler/tests/fixtures/runtime/bundle/cjs/hybrid/unresolved_variables/output.js
+++ b/crates/compiler/tests/fixtures/runtime/bundle/cjs/hybrid/unresolved_variables/output.js
@@ -1,65 +1,22 @@
//index.js:
- import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}var cjs_ts_cjs = __commonJs((module, exports)=>{
+}
+var cjs_ts_cjs = __commonJs((module, exports)=>{
module.exports.name = "shulan";
module.exports.age = 18;
foo = "unresolved_variable";
diff --git a/crates/compiler/tests/fixtures/runtime/bundle/cjs/normal/output.js b/crates/compiler/tests/fixtures/runtime/bundle/cjs/normal/output.js
index cf1d39cc8..ec1021473 100644
--- a/crates/compiler/tests/fixtures/runtime/bundle/cjs/normal/output.js
+++ b/crates/compiler/tests/fixtures/runtime/bundle/cjs/normal/output.js
@@ -1,21 +1,31 @@
//index.js:
- import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};// module_id: esmExport.ts.farm-runtime
+function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
+ }
+ return module.exports;
+ };
+}
+function _getRequireWildcardCache(nodeInterop) {
+ if (typeof WeakMap !== "function") return null;
+ var cacheBabelInterop = new WeakMap();
+ var cacheNodeInterop = new WeakMap();
+ return (_getRequireWildcardCache = function(nodeInterop) {
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
+ })(nodeInterop);
+}
+function _interop_require_wildcard(obj, nodeInterop) {
if (!nodeInterop && obj && obj.__esModule) return obj;
if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
default: obj
@@ -36,30 +46,12 @@
newObj.default = obj;
if (cache) cache.set(obj, newObj);
return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+}
+function _interop_require_default(obj) {
+ return obj && obj.__esModule ? obj : {
+ default: obj
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}// module_id: esmExport.ts.farm-runtime
+}
const name = 'name';
const age = 18;
var esmExport_ts_default = {
diff --git a/crates/compiler/tests/fixtures/runtime/bundle/decl/export_default_decl/no_ident/output.js b/crates/compiler/tests/fixtures/runtime/bundle/decl/export_default_decl/no_ident/output.js
index 04d12e6a0..93545f445 100644
--- a/crates/compiler/tests/fixtures/runtime/bundle/decl/export_default_decl/no_ident/output.js
+++ b/crates/compiler/tests/fixtures/runtime/bundle/decl/export_default_decl/no_ident/output.js
@@ -1,49 +1,5 @@
//index.js:
- import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
- }
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
- }
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}class export_class_ts_default {
+ import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};class export_class_ts_default {
constructor(){
console.log('class foo');
}
diff --git a/crates/compiler/tests/fixtures/runtime/bundle/decl/forward_export/output.js b/crates/compiler/tests/fixtures/runtime/bundle/decl/forward_export/output.js
index acb8dc156..a9966dd93 100644
--- a/crates/compiler/tests/fixtures/runtime/bundle/decl/forward_export/output.js
+++ b/crates/compiler/tests/fixtures/runtime/bundle/decl/forward_export/output.js
@@ -1,65 +1,22 @@
//index.js:
- import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}function Layout() {}
+}
+function Layout() {}
function wrap(fn) {
return ()=>{
return fn();
diff --git a/crates/compiler/tests/fixtures/runtime/bundle/decl/normal/output.js b/crates/compiler/tests/fixtures/runtime/bundle/decl/normal/output.js
index 3459764c4..36b87102c 100644
--- a/crates/compiler/tests/fixtures/runtime/bundle/decl/normal/output.js
+++ b/crates/compiler/tests/fixtures/runtime/bundle/decl/normal/output.js
@@ -1,65 +1,22 @@
//index.js:
- import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}var runtime_2_ts_cjs = __commonJs((module, exports)=>{
+}
+var runtime_2_ts_cjs = __commonJs((module, exports)=>{
"use strict";
const a = 3;
const b = 4;
diff --git a/crates/compiler/tests/fixtures/runtime/bundle/decl/self_ref/output.js b/crates/compiler/tests/fixtures/runtime/bundle/decl/self_ref/output.js
index a95747a0e..bf6354fe5 100644
--- a/crates/compiler/tests/fixtures/runtime/bundle/decl/self_ref/output.js
+++ b/crates/compiler/tests/fixtures/runtime/bundle/decl/self_ref/output.js
@@ -1,49 +1,5 @@
//index.js:
- import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
- }
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
- }
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function addClass() {
+ import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function addClass() {
console.log('addClass');
}
diff --git a/crates/compiler/tests/fixtures/runtime/bundle/decl/spread/output.js b/crates/compiler/tests/fixtures/runtime/bundle/decl/spread/output.js
index c3731dfbb..ab668dae2 100644
--- a/crates/compiler/tests/fixtures/runtime/bundle/decl/spread/output.js
+++ b/crates/compiler/tests/fixtures/runtime/bundle/decl/spread/output.js
@@ -1,65 +1,22 @@
//index.js:
- import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}const Row = ()=>{};
+}
+const Row = ()=>{};
const Col = ()=>{};
const Grid = {
Row: Row,
diff --git a/crates/compiler/tests/fixtures/runtime/bundle/decl/unresolved_variable/output.js b/crates/compiler/tests/fixtures/runtime/bundle/decl/unresolved_variable/output.js
index c5a26cdba..394ccccc1 100644
--- a/crates/compiler/tests/fixtures/runtime/bundle/decl/unresolved_variable/output.js
+++ b/crates/compiler/tests/fixtures/runtime/bundle/decl/unresolved_variable/output.js
@@ -1,49 +1,5 @@
//index.js:
- import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
- }
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
- }
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}const name = 100;
+ import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};const name = 100;
foo = "bar";
let foo$1 = 200;
diff --git a/crates/compiler/tests/fixtures/runtime/bundle/decl/var/output.js b/crates/compiler/tests/fixtures/runtime/bundle/decl/var/output.js
index 86f1742a1..9ed765324 100644
--- a/crates/compiler/tests/fixtures/runtime/bundle/decl/var/output.js
+++ b/crates/compiler/tests/fixtures/runtime/bundle/decl/var/output.js
@@ -1,49 +1,5 @@
//index.js:
- import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
- }
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
- }
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}const foo = 'foo', arrowFn = ()=>{}, fn = function() {}, obj = {
+ import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};const foo = 'foo', arrowFn = ()=>{}, fn = function() {}, obj = {
key: 'value'
}, arr = [];
diff --git a/crates/compiler/tests/fixtures/runtime/bundle/dynamic/normal/output.js b/crates/compiler/tests/fixtures/runtime/bundle/dynamic/normal/output.js
index fda4fee3d..35125c9ad 100644
--- a/crates/compiler/tests/fixtures/runtime/bundle/dynamic/normal/output.js
+++ b/crates/compiler/tests/fixtures/runtime/bundle/dynamic/normal/output.js
@@ -1,58 +1,14 @@
//index.js:
- import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
- }
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
- }
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function foo$1() {
+ import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function foo() {
console.log('foo');
}
var dynamic_ts_ns = {
- "default": foo$1,
+ "default": foo,
__esModule: true
};
Promise.resolve(dynamic_ts_ns).then((res)=>res.default());
-const foo = ()=>Promise.resolve(dynamic_ts_ns);
+const foo$1 = ()=>Promise.resolve(dynamic_ts_ns);
function loader(m) {}
loader(Promise.resolve(dynamic_ts_ns));
Promise.resolve(dynamic_ts_ns);
diff --git a/crates/compiler/tests/fixtures/runtime/bundle/export/emptyExport/output.js b/crates/compiler/tests/fixtures/runtime/bundle/export/emptyExport/output.js
index 30f683795..20bdf7104 100644
--- a/crates/compiler/tests/fixtures/runtime/bundle/export/emptyExport/output.js
+++ b/crates/compiler/tests/fixtures/runtime/bundle/export/emptyExport/output.js
@@ -1,49 +1,5 @@
//index.js:
- import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
- }
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
- }
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}
+ import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};
console.log(fs);
global['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
(function(_){for(var r in _){_[r].__farm_resource_pot__='index_dcdc.js';global['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"b5d64806":function (module, exports, farmRequire, farmDynamicRequire) {}
diff --git a/crates/compiler/tests/fixtures/runtime/bundle/export/entryExport1/output.js b/crates/compiler/tests/fixtures/runtime/bundle/export/entryExport1/output.js
index 8740330ad..b9acc1ce4 100644
--- a/crates/compiler/tests/fixtures/runtime/bundle/export/entryExport1/output.js
+++ b/crates/compiler/tests/fixtures/runtime/bundle/export/entryExport1/output.js
@@ -1,49 +1,5 @@
//index.js:
- import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
- }
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
- }
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}const a = 10;
+ import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};const a = 10;
function b() {
return 20;
}
diff --git a/crates/compiler/tests/fixtures/runtime/bundle/export/entryExport2/output.js b/crates/compiler/tests/fixtures/runtime/bundle/export/entryExport2/output.js
index 8740330ad..b9acc1ce4 100644
--- a/crates/compiler/tests/fixtures/runtime/bundle/export/entryExport2/output.js
+++ b/crates/compiler/tests/fixtures/runtime/bundle/export/entryExport2/output.js
@@ -1,49 +1,5 @@
//index.js:
- import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
- }
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
- }
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}const a = 10;
+ import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};const a = 10;
function b() {
return 20;
}
diff --git a/crates/compiler/tests/fixtures/runtime/bundle/export/entryExport3/output.js b/crates/compiler/tests/fixtures/runtime/bundle/export/entryExport3/output.js
index 02c08672f..98aefc650 100644
--- a/crates/compiler/tests/fixtures/runtime/bundle/export/entryExport3/output.js
+++ b/crates/compiler/tests/fixtures/runtime/bundle/export/entryExport3/output.js
@@ -1,49 +1,5 @@
//index.js:
- import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
- }
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
- }
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}const a = 3;
+ import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};const a = 3;
const b = 4;
const c = 5;
function BB() {
diff --git a/crates/compiler/tests/fixtures/runtime/bundle/export/exportDefault1/output.js b/crates/compiler/tests/fixtures/runtime/bundle/export/exportDefault1/output.js
index 738870765..0660fdbdb 100644
--- a/crates/compiler/tests/fixtures/runtime/bundle/export/exportDefault1/output.js
+++ b/crates/compiler/tests/fixtures/runtime/bundle/export/exportDefault1/output.js
@@ -1,49 +1,5 @@
//index.js:
- import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
- }
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
- }
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}const a = 3;
+ import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};const a = 3;
const a$1 = 3 + a;
diff --git a/crates/compiler/tests/fixtures/runtime/bundle/export/exportDefaultDecl/output.js b/crates/compiler/tests/fixtures/runtime/bundle/export/exportDefaultDecl/output.js
index b5e68733f..f3a4c9fcf 100644
--- a/crates/compiler/tests/fixtures/runtime/bundle/export/exportDefaultDecl/output.js
+++ b/crates/compiler/tests/fixtures/runtime/bundle/export/exportDefaultDecl/output.js
@@ -1,49 +1,5 @@
//index.js:
- import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
- }
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
- }
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}const a = 3;
+ import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};const a = 3;
class getA {
constructor(){}
getA() {
diff --git a/crates/compiler/tests/fixtures/runtime/bundle/export/exportDefaultExpr/output.js b/crates/compiler/tests/fixtures/runtime/bundle/export/exportDefaultExpr/output.js
index eebd281fd..f67eeb7d4 100644
--- a/crates/compiler/tests/fixtures/runtime/bundle/export/exportDefaultExpr/output.js
+++ b/crates/compiler/tests/fixtures/runtime/bundle/export/exportDefaultExpr/output.js
@@ -1,49 +1,5 @@
//index.js:
- import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
- }
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
- }
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}const a = 3;
+ import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};const a = 3;
var runtime_2_ts_default = a + 10;
var runtime_1_ts_default = runtime_2_ts_default + 20;
diff --git a/crates/compiler/tests/fixtures/runtime/bundle/export/exportNamed1/output.js b/crates/compiler/tests/fixtures/runtime/bundle/export/exportNamed1/output.js
index 8bcc8e56a..108362bdd 100644
--- a/crates/compiler/tests/fixtures/runtime/bundle/export/exportNamed1/output.js
+++ b/crates/compiler/tests/fixtures/runtime/bundle/export/exportNamed1/output.js
@@ -1,49 +1,5 @@
//index.js:
- import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
- }
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
- }
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}const a = 'a-runtime.2.ts';
+ import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};const a = 'a-runtime.2.ts';
const b = 'b-runtime.2.ts';
function BB() {
const a$1 = 5;
diff --git a/crates/compiler/tests/fixtures/runtime/bundle/export/exportNamed2/output.js b/crates/compiler/tests/fixtures/runtime/bundle/export/exportNamed2/output.js
index a6e11e141..8711ae877 100644
--- a/crates/compiler/tests/fixtures/runtime/bundle/export/exportNamed2/output.js
+++ b/crates/compiler/tests/fixtures/runtime/bundle/export/exportNamed2/output.js
@@ -1,49 +1,5 @@
//index.js:
- import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
- }
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
- }
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}const a = 'a-runtime2-a.ts';
+ import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};const a = 'a-runtime2-a.ts';
const b = 'b-runtime2-b.ts';
function BB() {
const a$1 = 5;
diff --git a/crates/compiler/tests/fixtures/runtime/bundle/export/exportNamed3/output.js b/crates/compiler/tests/fixtures/runtime/bundle/export/exportNamed3/output.js
index c3794c706..d63de9687 100644
--- a/crates/compiler/tests/fixtures/runtime/bundle/export/exportNamed3/output.js
+++ b/crates/compiler/tests/fixtures/runtime/bundle/export/exportNamed3/output.js
@@ -1,49 +1,5 @@
//index.js:
- import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
- }
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
- }
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}const isString = (v)=>{
+ import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};const isString = (v)=>{
console.log('isString1');
return typeof v === 'string';
};
diff --git a/crates/compiler/tests/fixtures/runtime/bundle/external/export/from_source/export_all/output.js b/crates/compiler/tests/fixtures/runtime/bundle/external/export/from_source/export_all/output.js
index 18d279600..981c50be7 100644
--- a/crates/compiler/tests/fixtures/runtime/bundle/external/export/from_source/export_all/output.js
+++ b/crates/compiler/tests/fixtures/runtime/bundle/external/export/from_source/export_all/output.js
@@ -1,62 +1,21 @@
//index.js:
- import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
- }
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
- }
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function _mergeNamespaces(n, m) {
- m.forEach(function (e) {
- e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
+ import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function _mergeNamespaces(n, m) {
+ m.forEach(function(e) {
+ e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function(k) {
if (k !== 'default' && !(k in n)) {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
- get: function () { return e[k]; }
+ get: function() {
+ return e[k];
+ }
});
}
});
});
return Object.freeze(n);
-}import * as node_fs_ns from "node:fs.farm-runtime";
+}
+import * as node_fs_ns from "node:fs.farm-runtime";
var exportAll_ts_ns = _mergeNamespaces({
__esModule: true
}, [
diff --git a/crates/compiler/tests/fixtures/runtime/bundle/external/export/from_source/export_as_namespace/output.js b/crates/compiler/tests/fixtures/runtime/bundle/external/export/from_source/export_as_namespace/output.js
index bcede061e..5fbebb06e 100644
--- a/crates/compiler/tests/fixtures/runtime/bundle/external/export/from_source/export_as_namespace/output.js
+++ b/crates/compiler/tests/fixtures/runtime/bundle/external/export/from_source/export_as_namespace/output.js
@@ -1,78 +1,39 @@
//index.js:
- import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function _mergeNamespaces(n, m) {
- m.forEach(function (e) {
- e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
+ return module.exports;
+ };
+}
+function _mergeNamespaces(n, m) {
+ m.forEach(function(e) {
+ e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function(k) {
if (k !== 'default' && !(k in n)) {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
- get: function () { return e[k]; }
+ get: function() {
+ return e[k];
+ }
});
}
});
});
return Object.freeze(n);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
- };
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}var exportCjs_ts_cjs = __commonJs((module, exports)=>{
+}
+import { readFile, readFileSync } from "node:fs.farm-runtime";
+var exportCjs_ts_cjs = __commonJs((module, exports)=>{
module.exports.name = "shulan";
module.exports.age = 18;
});
diff --git a/crates/compiler/tests/fixtures/runtime/bundle/external/export/from_source/export_named/output.js b/crates/compiler/tests/fixtures/runtime/bundle/external/export/from_source/export_named/output.js
index ab6be1157..637d0ea95 100644
--- a/crates/compiler/tests/fixtures/runtime/bundle/external/export/from_source/export_named/output.js
+++ b/crates/compiler/tests/fixtures/runtime/bundle/external/export/from_source/export_named/output.js
@@ -1,49 +1,5 @@
//index.js:
- import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
- }
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
- }
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}import { readFileSync, readSync } from "node:fs.farm-runtime";
+ import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};import { readFileSync, readSync } from "node:fs.farm-runtime";
const bundle2A = 'bundle2A';
const bundle2B = 'bundle2B';
diff --git a/crates/compiler/tests/fixtures/runtime/bundle/external/export/from_source/export_namespace/output.js b/crates/compiler/tests/fixtures/runtime/bundle/external/export/from_source/export_namespace/output.js
index 2c561f212..e4afd3104 100644
--- a/crates/compiler/tests/fixtures/runtime/bundle/external/export/from_source/export_namespace/output.js
+++ b/crates/compiler/tests/fixtures/runtime/bundle/external/export/from_source/export_namespace/output.js
@@ -1,21 +1,14 @@
//index.js:
- global.nodeRequire = require;global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
- }
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
+ global.nodeRequire = require;global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};// module_id: exportNamespace.ts.farm-runtime
+function _getRequireWildcardCache(nodeInterop) {
+ if (typeof WeakMap !== "function") return null;
+ var cacheBabelInterop = new WeakMap();
+ var cacheNodeInterop = new WeakMap();
+ return (_getRequireWildcardCache = function(nodeInterop) {
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
+ })(nodeInterop);
+}
+function _interop_require_wildcard(obj, nodeInterop) {
if (!nodeInterop && obj && obj.__esModule) return obj;
if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
default: obj
@@ -36,14 +29,7 @@
newObj.default = obj;
if (cache) cache.set(obj, newObj);
return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}// module_id: exportNamespace.ts.farm-runtime
+}
var node_fs_ns = _interop_require_wildcard(require("node:fs.farm-runtime"));
console.log('export namespace');
var exportNamespace_ts_ns = {
diff --git a/crates/compiler/tests/fixtures/runtime/bundle/external/import/default/output.js b/crates/compiler/tests/fixtures/runtime/bundle/external/import/default/output.js
index 62975266b..c6384ab79 100644
--- a/crates/compiler/tests/fixtures/runtime/bundle/external/import/default/output.js
+++ b/crates/compiler/tests/fixtures/runtime/bundle/external/import/default/output.js
@@ -1,49 +1,5 @@
//index.js:
- import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
- }
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
- }
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}import fs$1 from "fs.farm-runtime";
+ import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};import fs$1 from "fs.farm-runtime";
import fs from "node:fs.farm-runtime";
console.log('external 1', fs);
diff --git a/crates/compiler/tests/fixtures/runtime/bundle/external/import/named/output.js b/crates/compiler/tests/fixtures/runtime/bundle/external/import/named/output.js
index 64f4d02dd..56e28a812 100644
--- a/crates/compiler/tests/fixtures/runtime/bundle/external/import/named/output.js
+++ b/crates/compiler/tests/fixtures/runtime/bundle/external/import/named/output.js
@@ -1,49 +1,5 @@
//index.js:
- import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
- }
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
- }
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}import { read } from "node:fs.farm-runtime";
+ import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};import { read } from "node:fs.farm-runtime";
console.log('external 1', read);
console.log('external 2', read);
diff --git a/crates/compiler/tests/fixtures/runtime/bundle/external/import/namespace/output.js b/crates/compiler/tests/fixtures/runtime/bundle/external/import/namespace/output.js
index 318a6f168..a3a0204ba 100644
--- a/crates/compiler/tests/fixtures/runtime/bundle/external/import/namespace/output.js
+++ b/crates/compiler/tests/fixtures/runtime/bundle/external/import/namespace/output.js
@@ -1,49 +1,5 @@
//index.js:
- import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
- }
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
- }
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}import * as node_fs_ns from "node:fs.farm-runtime";
+ import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};import * as node_fs_ns from "node:fs.farm-runtime";
console.log('external 1', node_fs_ns);
console.log('external 1', node_fs_ns);
diff --git a/crates/compiler/tests/fixtures/runtime/bundle/function/output.js b/crates/compiler/tests/fixtures/runtime/bundle/function/output.js
index f0c71b49f..71363875b 100644
--- a/crates/compiler/tests/fixtures/runtime/bundle/function/output.js
+++ b/crates/compiler/tests/fixtures/runtime/bundle/function/output.js
@@ -1,49 +1,5 @@
//index.js:
- import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
- }
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
- }
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}const MIN_CHART_WIDTH = 1;
+ import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};const MIN_CHART_WIDTH = 1;
const MIN_CHART_HEIGHT = 1;
function getElementSize(ele) {
var style = getComputedStyle(ele);
diff --git a/crates/compiler/tests/fixtures/runtime/bundle/import/importDefault/output.js b/crates/compiler/tests/fixtures/runtime/bundle/import/importDefault/output.js
index 908edd27a..47915dbd3 100644
--- a/crates/compiler/tests/fixtures/runtime/bundle/import/importDefault/output.js
+++ b/crates/compiler/tests/fixtures/runtime/bundle/import/importDefault/output.js
@@ -1,49 +1,5 @@
//index.js:
- import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
- }
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
- }
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}class DC {
+ import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};class DC {
constructor(){}
}
diff --git a/crates/compiler/tests/fixtures/runtime/bundle/import/importNamed/output.js b/crates/compiler/tests/fixtures/runtime/bundle/import/importNamed/output.js
index 3accdfe32..2204e7e89 100644
--- a/crates/compiler/tests/fixtures/runtime/bundle/import/importNamed/output.js
+++ b/crates/compiler/tests/fixtures/runtime/bundle/import/importNamed/output.js
@@ -1,49 +1,5 @@
//index.js:
- import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
- }
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
- }
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}const a = 3;
+ import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};const a = 3;
const b = 4;
function BB() {
const a$1 = 5;
diff --git a/crates/compiler/tests/fixtures/runtime/bundle/import/importNamespace/output.js b/crates/compiler/tests/fixtures/runtime/bundle/import/importNamespace/output.js
index 3d7b19ad7..5cfe12ded 100644
--- a/crates/compiler/tests/fixtures/runtime/bundle/import/importNamespace/output.js
+++ b/crates/compiler/tests/fixtures/runtime/bundle/import/importNamespace/output.js
@@ -1,49 +1,5 @@
//index.js:
- import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
- }
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
- }
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}const a = 3;
+ import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};const a = 3;
const b = 4;
const c = 5;
function BB() {
diff --git a/crates/compiler/tests/fixtures/runtime/bundle/import/importedInScope/output.js b/crates/compiler/tests/fixtures/runtime/bundle/import/importedInScope/output.js
index a23d9bbb1..b9d8bb83a 100644
--- a/crates/compiler/tests/fixtures/runtime/bundle/import/importedInScope/output.js
+++ b/crates/compiler/tests/fixtures/runtime/bundle/import/importedInScope/output.js
@@ -1,65 +1,21 @@
//index.js:
- import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
- }
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
- }
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}const hello$5 = 'hello1';
+ import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};const hello = 'hello1';
const hello$1 = 'hello';
-console.log(hello$5, hello$1);
+console.log(hello, hello$1);
function export_nested() {
- const hello = 'hello';
- console.log(hello);
+ const hello$2 = 'hello';
+ console.log(hello$2);
}
-var hello$2 = hello$5;
+var hello$3 = hello;
function say() {
- var hello$3 = hello$5;
- var hello$1$1 = hello$5;
- console.log(hello$3);
+ var hello$4 = hello;
+ var hello$1$1 = hello;
+ console.log(hello$4);
function nested_say() {
- var hello$4 = hello$5;
- var hello$2$1 = hello$5;
- console.log(hello$4);
+ var hello$5 = hello;
+ var hello$2$1 = hello;
+ console.log(hello$5);
}
}
say();
diff --git a/crates/compiler/tests/fixtures/runtime/bundle/import/sameImport/output.js b/crates/compiler/tests/fixtures/runtime/bundle/import/sameImport/output.js
index 8e7e44bf3..0397ddb8f 100644
--- a/crates/compiler/tests/fixtures/runtime/bundle/import/sameImport/output.js
+++ b/crates/compiler/tests/fixtures/runtime/bundle/import/sameImport/output.js
@@ -1,65 +1,27 @@
//index.js:
- import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
+ };
+}
+function _interop_require_default(obj) {
+ return obj && obj.__esModule ? obj : {
+ default: obj
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}var export_ts_cjs = __commonJs((module, exports)=>{
+}
+var export_ts_cjs = __commonJs((module, exports)=>{
module.exports = function() {
console.log('safe import');
};
diff --git a/crates/compiler/tests/fixtures/runtime/bundle/interface/output.js b/crates/compiler/tests/fixtures/runtime/bundle/interface/output.js
index e34ab8459..1504171d5 100644
--- a/crates/compiler/tests/fixtures/runtime/bundle/interface/output.js
+++ b/crates/compiler/tests/fixtures/runtime/bundle/interface/output.js
@@ -1,49 +1,5 @@
//index.js:
- import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
- }
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
- }
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}
+ import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};
const foo = 10;
console.log(1, 10, foo);
global['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
diff --git a/crates/compiler/tests/fixtures/runtime/bundle/issues/merge_props/output.js b/crates/compiler/tests/fixtures/runtime/bundle/issues/merge_props/output.js
index 1b562e83c..3c7309cb4 100644
--- a/crates/compiler/tests/fixtures/runtime/bundle/issues/merge_props/output.js
+++ b/crates/compiler/tests/fixtures/runtime/bundle/issues/merge_props/output.js
@@ -1,49 +1,5 @@
//index.js:
- import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
- }
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
- }
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}var __assign = this && this.__assign || function() {
+ import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};var __assign = this && this.__assign || function() {
__assign = Object.assign || function(t) {
for(var s, i = 1, n = arguments.length; i < n; i++){
s = arguments[i];
@@ -53,15 +9,15 @@
};
return __assign.apply(this, arguments);
};
-function mergeProps$1(componentProps, defaultProps, globalComponentConfig) {
+function mergeProps(componentProps, defaultProps, globalComponentConfig) {
var _defaultProps = __assign(__assign({}, defaultProps), globalComponentConfig);
- var props = __assign({}, componentProps);
+ var props$1 = __assign({}, componentProps);
for(var propName in _defaultProps){
- if (props[propName] === undefined) {
- props[propName] = _defaultProps[propName];
+ if (props$1[propName] === undefined) {
+ props$1[propName] = _defaultProps[propName];
}
}
- return props;
+ return props$1;
}
var Trigger = function(_super) {
@@ -70,8 +26,8 @@ var Trigger = function(_super) {
var _this = _super.call(this, props, context) || this;
_this.getMergedProps = function(baseProps) {
var componentConfig = _this.context.componentConfig;
- var props$1 = mergeProps$1(baseProps || _this.props, defaultProps, componentConfig === null || componentConfig === void 0 ? void 0 : componentConfig.Trigger);
- return props$1;
+ var props$3 = mergeProps(baseProps || _this.props, defaultProps, componentConfig === null || componentConfig === void 0 ? void 0 : componentConfig.Trigger);
+ return props$3;
};
return _this;
}
@@ -86,59 +42,59 @@ var Trigger = function(_super) {
if (!popup) {
return null;
}
- var mergeProps = {};
+ var mergeProps$1 = {};
var popupEventProps = {
onMouseDown: this.onPopupMouseDown
};
if (this.isHoverTrigger() && !disabled) {
- mergeProps.onMouseEnter = this.onMouseEnter;
- mergeProps.onMouseLeave = this.onMouseLeave;
+ mergeProps$1.onMouseEnter = this.onMouseEnter;
+ mergeProps$1.onMouseLeave = this.onMouseLeave;
if (alignPoint) {
- mergeProps.onMouseMove = this.onMouseMove;
+ mergeProps$1.onMouseMove = this.onMouseMove;
}
if (!this.isPopupHoverHide()) {
popupEventProps.onMouseEnter = this.onPopupMouseEnter;
popupEventProps.onMouseLeave = this.onPopupMouseLeave;
}
} else {
- mergeProps.onMouseEnter = this.triggerOriginEvent('onMouseEnter');
- mergeProps.onMouseLeave = this.triggerOriginEvent('onMouseLeave');
+ mergeProps$1.onMouseEnter = this.triggerOriginEvent('onMouseEnter');
+ mergeProps$1.onMouseLeave = this.triggerOriginEvent('onMouseLeave');
}
if (this.isContextMenuTrigger() && !disabled) {
- mergeProps.onContextMenu = this.onContextMenu;
- mergeProps.onClick = this.hideContextMenu;
+ mergeProps$1.onContextMenu = this.onContextMenu;
+ mergeProps$1.onClick = this.hideContextMenu;
} else {
- mergeProps.onContextMenu = this.triggerOriginEvent('onContextMenu');
+ mergeProps$1.onContextMenu = this.triggerOriginEvent('onContextMenu');
}
if (this.isClickTrigger() && !disabled) {
- mergeProps.onClick = this.onClick;
+ mergeProps$1.onClick = this.onClick;
} else {
- mergeProps.onClick = mergeProps.onClick || this.triggerOriginEvent('onClick');
+ mergeProps$1.onClick = mergeProps$1.onClick || this.triggerOriginEvent('onClick');
}
if (this.isFocusTrigger() && !disabled) {
- mergeProps.onFocus = this.onFocus;
+ mergeProps$1.onFocus = this.onFocus;
if (this.isBlurToHide()) {
- mergeProps.onBlur = this.onBlur;
+ mergeProps$1.onBlur = this.onBlur;
}
} else {
- mergeProps.onFocus = this.triggerOriginEvent('onFocus');
- mergeProps.onBlur = this.triggerOriginEvent('onBlur');
+ mergeProps$1.onFocus = this.triggerOriginEvent('onFocus');
+ mergeProps$1.onBlur = this.triggerOriginEvent('onBlur');
}
if (!disabled) {
- mergeProps.onKeyDown = this.onKeyDown;
+ mergeProps$1.onKeyDown = this.onKeyDown;
} else {
- mergeProps.onKeyDown = this.triggerOriginEvent('onKeyDown');
+ mergeProps$1.onKeyDown = this.triggerOriginEvent('onKeyDown');
}
var child = this.getChild();
var popupChildren = React.Children.only(popup());
if (child.props.className) {
- mergeProps.className = child.props.className;
+ mergeProps$1.className = child.props.className;
}
if (childrenPrefix && popupVisible) {
- mergeProps.className = mergeProps.className ? mergeProps.className + " " + childrenPrefix + "-open" : childrenPrefix + "-open";
+ mergeProps$1.className = mergeProps$1.className ? mergeProps$1.className + " " + childrenPrefix + "-open" : childrenPrefix + "-open";
}
if (this.isFocusTrigger()) {
- mergeProps.tabIndex = disabled ? -1 : 0;
+ mergeProps$1.tabIndex = disabled ? -1 : 0;
}
};
return Trigger$1;
diff --git a/crates/compiler/tests/fixtures/runtime/bundle/lazy_compilation/output.js b/crates/compiler/tests/fixtures/runtime/bundle/lazy_compilation/output.js
index 544898b7d..650e0aad8 100644
--- a/crates/compiler/tests/fixtures/runtime/bundle/lazy_compilation/output.js
+++ b/crates/compiler/tests/fixtures/runtime/bundle/lazy_compilation/output.js
@@ -1,49 +1,5 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
- }
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
- }
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}((function(){const name = 'foo';
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){const name = 'foo';
var foo_ts_ns = {
name: name,
__esModule: true
diff --git a/crates/compiler/tests/fixtures/runtime/bundle/polyfill/reserved_word/cjs/output.js b/crates/compiler/tests/fixtures/runtime/bundle/polyfill/reserved_word/cjs/output.js
index fa370b982..84cf5cbd1 100644
--- a/crates/compiler/tests/fixtures/runtime/bundle/polyfill/reserved_word/cjs/output.js
+++ b/crates/compiler/tests/fixtures/runtime/bundle/polyfill/reserved_word/cjs/output.js
@@ -1,65 +1,22 @@
//index.js:
- import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}function foo() {}
+}
+function foo() {}
var dep_ts_ns = {
"default": foo,
__esModule: true
diff --git a/crates/compiler/tests/fixtures/runtime/bundle/polyfill/reserved_word/esm/output.js b/crates/compiler/tests/fixtures/runtime/bundle/polyfill/reserved_word/esm/output.js
index b32df6748..48a087ac7 100644
--- a/crates/compiler/tests/fixtures/runtime/bundle/polyfill/reserved_word/esm/output.js
+++ b/crates/compiler/tests/fixtures/runtime/bundle/polyfill/reserved_word/esm/output.js
@@ -1,49 +1,5 @@
//index.js:
- import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
- }
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
- }
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}const a = 10;
+ import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};const a = 10;
function foo() {}
var dep_ts_ns = {
a: a,
diff --git a/crates/compiler/tests/fixtures/runtime/bundle/rename/output.js b/crates/compiler/tests/fixtures/runtime/bundle/rename/output.js
index 2338bbed8..f5d40e69f 100644
--- a/crates/compiler/tests/fixtures/runtime/bundle/rename/output.js
+++ b/crates/compiler/tests/fixtures/runtime/bundle/rename/output.js
@@ -1,49 +1,5 @@
//index.js:
- import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
- }
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
- }
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}const namedA = 10;
+ import __farmNodeModule from 'node:module';global.nodeRequire = __farmNodeModule.createRequire(import.meta.url);global['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'node'};const namedA = 10;
const namedB = 20;
const namedC = 30;
const sameNameWithFile_ts = 1;
diff --git a/crates/compiler/tests/fixtures/script/accept_deps/output.js b/crates/compiler/tests/fixtures/script/accept_deps/output.js
index 0effa7790..e20bb0be0 100644
--- a/crates/compiler/tests/fixtures/script/accept_deps/output.js
+++ b/crates/compiler/tests/fixtures/script/accept_deps/output.js
@@ -1,69 +1,27 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_fb79.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"05ee5ec7":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
var _f_foo = farmRequire("59ebf907");
diff --git a/crates/compiler/tests/fixtures/script/comments/output.js b/crates/compiler/tests/fixtures/script/comments/output.js
index 93f02d3a8..a0e5ad297 100644
--- a/crates/compiler/tests/fixtures/script/comments/output.js
+++ b/crates/compiler/tests/fixtures/script/comments/output.js
@@ -1,69 +1,27 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_ddf1.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"05ee5ec7":/**
* @license MIT this comments should be preserved
*/ function (module, exports, farmRequire, farmDynamicRequire) {
diff --git a/crates/compiler/tests/fixtures/script/import_equals/output.js b/crates/compiler/tests/fixtures/script/import_equals/output.js
index ffc5f21bd..cec2ebc20 100644
--- a/crates/compiler/tests/fixtures/script/import_equals/output.js
+++ b/crates/compiler/tests/fixtures/script/import_equals/output.js
@@ -1,69 +1,27 @@
//__farm_runtime.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());
//index.js:
diff --git a/crates/compiler/tests/fixtures/script/import_meta_url_with_URL/absolute_public_path/lit_str/output.js b/crates/compiler/tests/fixtures/script/import_meta_url_with_URL/absolute_public_path/lit_str/output.js
index 35846f8cf..a2ae3e08d 100644
--- a/crates/compiler/tests/fixtures/script/import_meta_url_with_URL/absolute_public_path/lit_str/output.js
+++ b/crates/compiler/tests/fixtures/script/import_meta_url_with_URL/absolute_public_path/lit_str/output.js
@@ -2,71 +2,29 @@
foo
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_2f83.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"b5d64806":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
var _f_foo = module.i(farmRequire("e6cee430"));
diff --git a/crates/compiler/tests/fixtures/script/import_meta_url_with_URL/relative_public_path/tip/complate/output.js b/crates/compiler/tests/fixtures/script/import_meta_url_with_URL/relative_public_path/tip/complate/output.js
index 6b650d84c..1a5a1f717 100644
--- a/crates/compiler/tests/fixtures/script/import_meta_url_with_URL/relative_public_path/tip/complate/output.js
+++ b/crates/compiler/tests/fixtures/script/import_meta_url_with_URL/relative_public_path/tip/complate/output.js
@@ -2,71 +2,29 @@
foo_bar
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_dff7.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"b334ec2f":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
exports.default = "/foo_bar-47689c.txt?url";
diff --git a/crates/compiler/tests/fixtures/script/import_meta_url_with_URL/relative_public_path/tip/normal/output.js b/crates/compiler/tests/fixtures/script/import_meta_url_with_URL/relative_public_path/tip/normal/output.js
index 22c85ee01..88dd9d6a7 100644
--- a/crates/compiler/tests/fixtures/script/import_meta_url_with_URL/relative_public_path/tip/normal/output.js
+++ b/crates/compiler/tests/fixtures/script/import_meta_url_with_URL/relative_public_path/tip/normal/output.js
@@ -5,71 +5,29 @@
foo
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_5425.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"27eb6d1d":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
exports.default = "./foo-8bdf4c.txt?url";
diff --git a/crates/compiler/tests/fixtures/script/import_meta_url_with_URL/relative_public_path/tip/tip_star_star/output.js b/crates/compiler/tests/fixtures/script/import_meta_url_with_URL/relative_public_path/tip/tip_star_star/output.js
index 91c4c9517..803b3662d 100644
--- a/crates/compiler/tests/fixtures/script/import_meta_url_with_URL/relative_public_path/tip/tip_star_star/output.js
+++ b/crates/compiler/tests/fixtures/script/import_meta_url_with_URL/relative_public_path/tip/tip_star_star/output.js
@@ -2,71 +2,29 @@
foo
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_daf2.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"27eb6d1d":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
exports.default = "./foo-8bdf4c.txt?url";
diff --git a/crates/compiler/tests/fixtures/script/native_top_level_await/output.js b/crates/compiler/tests/fixtures/script/native_top_level_await/output.js
index bd8d2f520..0fc65fdae 100644
--- a/crates/compiler/tests/fixtures/script/native_top_level_await/output.js
+++ b/crates/compiler/tests/fixtures/script/native_top_level_await/output.js
@@ -1,69 +1,27 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_dcdc.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"b5d64806":async function (module, exports, farmRequire, farmDynamicRequire) {
const delay = (ms)=>new Promise((resolve)=>setTimeout(resolve, ms));
await delay(3000);
diff --git a/crates/compiler/tests/fixtures/tree_shake/basic/output.js b/crates/compiler/tests/fixtures/tree_shake/basic/output.js
index 3be34cf0c..931443614 100644
--- a/crates/compiler/tests/fixtures/tree_shake/basic/output.js
+++ b/crates/compiler/tests/fixtures/tree_shake/basic/output.js
@@ -1,69 +1,27 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_ddf1.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"05ee5ec7":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
module.o(exports, "a", function() {
diff --git a/crates/compiler/tests/fixtures/tree_shake/changed_ast/output.js b/crates/compiler/tests/fixtures/tree_shake/changed_ast/output.js
index fba29b7ca..f6de1183f 100644
--- a/crates/compiler/tests/fixtures/tree_shake/changed_ast/output.js
+++ b/crates/compiler/tests/fixtures/tree_shake/changed_ast/output.js
@@ -1,65 +1,22 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){// module_id: ../../_internal/runtime/index.js.farm-runtime
+function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){// module_id: ../../_internal/runtime/index.js.farm-runtime
+}
var index_js_cjs = __commonJs({
"../../_internal/runtime/index.js.farm-runtime": (module, exports)=>{
"use strict";
@@ -67,6 +24,7 @@ var index_js_cjs = __commonJs({
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
}
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_4924.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"comp.tsx":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
module.o(exports, "Description", function() {
diff --git a/crates/compiler/tests/fixtures/tree_shake/cjs/output.js b/crates/compiler/tests/fixtures/tree_shake/cjs/output.js
index 63992de59..42ccfacf5 100644
--- a/crates/compiler/tests/fixtures/tree_shake/cjs/output.js
+++ b/crates/compiler/tests/fixtures/tree_shake/cjs/output.js
@@ -1,69 +1,27 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_6889.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"3da733a3":function (module, exports, farmRequire, farmDynamicRequire) {
module.exports = function() {
return 'b';
diff --git a/crates/compiler/tests/fixtures/tree_shake/compiled-vue-comp/output.js b/crates/compiler/tests/fixtures/tree_shake/compiled-vue-comp/output.js
index 258d32f39..085759ca2 100644
--- a/crates/compiler/tests/fixtures/tree_shake/compiled-vue-comp/output.js
+++ b/crates/compiler/tests/fixtures/tree_shake/compiled-vue-comp/output.js
@@ -1,69 +1,27 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());window['__farm_default_namespace__'].__farm_module_system__.setExternalModules({"vue": (window['vue']||{}).default && !(window['vue']||{}).__esModule ? {...(window['vue']||{}),__esModule:true} : ({...window['vue']||{}})});(function(_){for(var r in _){_[r].__farm_resource_pot__='index_236f.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"8cea7e1d":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
exports.default = (a)=>a;
diff --git a/crates/compiler/tests/fixtures/tree_shake/css/output.js b/crates/compiler/tests/fixtures/tree_shake/css/output.js
index 883d8e9aa..32e648584 100644
--- a/crates/compiler/tests/fixtures/tree_shake/css/output.js
+++ b/crates/compiler/tests/fixtures/tree_shake/css/output.js
@@ -1,69 +1,27 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_cb11.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"44a34200":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
module.o(exports, "c", function() {
diff --git a/crates/compiler/tests/fixtures/tree_shake/cyclic_deps/output.js b/crates/compiler/tests/fixtures/tree_shake/cyclic_deps/output.js
index dfd1c01ec..c76253af6 100644
--- a/crates/compiler/tests/fixtures/tree_shake/cyclic_deps/output.js
+++ b/crates/compiler/tests/fixtures/tree_shake/cyclic_deps/output.js
@@ -1,69 +1,27 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_ddf1.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"05ee5ec7":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
module.o(exports, "a", function() {
diff --git a/crates/compiler/tests/fixtures/tree_shake/cyclic_export_all/output.js b/crates/compiler/tests/fixtures/tree_shake/cyclic_export_all/output.js
index 333f6e9fe..a22b44713 100644
--- a/crates/compiler/tests/fixtures/tree_shake/cyclic_export_all/output.js
+++ b/crates/compiler/tests/fixtures/tree_shake/cyclic_export_all/output.js
@@ -1,69 +1,27 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_dd58.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"569704c1":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
var _f_b = farmRequire("f380ea31");
diff --git a/crates/compiler/tests/fixtures/tree_shake/decl/self-ref/output.js b/crates/compiler/tests/fixtures/tree_shake/decl/self-ref/output.js
index aff53128c..7dd66c8f4 100644
--- a/crates/compiler/tests/fixtures/tree_shake/decl/self-ref/output.js
+++ b/crates/compiler/tests/fixtures/tree_shake/decl/self-ref/output.js
@@ -1,69 +1,27 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_d7d4.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"3e3af5b6":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
var rsAstralRange = '\\ud800-\\udfff', rsComboMarksRange = '\\u0300-\\u036f', reComboHalfMarksRange = '\\ufe20-\\ufe2f', rsComboSymbolsRange = '\\u20d0-\\u20ff', rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, rsVarRange = '\\ufe0e\\ufe0f';
diff --git a/crates/compiler/tests/fixtures/tree_shake/deep_dynamic_import/output.js b/crates/compiler/tests/fixtures/tree_shake/deep_dynamic_import/output.js
index 1b8d533b4..524c9ae5e 100644
--- a/crates/compiler/tests/fixtures/tree_shake/deep_dynamic_import/output.js
+++ b/crates/compiler/tests/fixtures/tree_shake/deep_dynamic_import/output.js
@@ -21,71 +21,29 @@
,});
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_5d9b.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"7c4a34c2":async function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
exports.default = await farmDynamicRequire("05ee5ec7");
diff --git a/crates/compiler/tests/fixtures/tree_shake/dynamic-import/output.js b/crates/compiler/tests/fixtures/tree_shake/dynamic-import/output.js
index fce01295c..c1af2eb05 100644
--- a/crates/compiler/tests/fixtures/tree_shake/dynamic-import/output.js
+++ b/crates/compiler/tests/fixtures/tree_shake/dynamic-import/output.js
@@ -21,71 +21,29 @@
,});
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_dcdc.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"b5d64806":function (module, exports, farmRequire, farmDynamicRequire) {
farmDynamicRequire("05ee5ec7").then((dep)=>{
console.log(dep);
diff --git a/crates/compiler/tests/fixtures/tree_shake/empty_module/output.js b/crates/compiler/tests/fixtures/tree_shake/empty_module/output.js
index b498ca445..9a8c9d628 100644
--- a/crates/compiler/tests/fixtures/tree_shake/empty_module/output.js
+++ b/crates/compiler/tests/fixtures/tree_shake/empty_module/output.js
@@ -1,69 +1,27 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_6b9f.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"569704c1":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
var _f_b = farmRequire("f380ea31");
diff --git a/crates/compiler/tests/fixtures/tree_shake/empty_specifier_export_all/output.js b/crates/compiler/tests/fixtures/tree_shake/empty_specifier_export_all/output.js
index e6d376261..83f0c0fae 100644
--- a/crates/compiler/tests/fixtures/tree_shake/empty_specifier_export_all/output.js
+++ b/crates/compiler/tests/fixtures/tree_shake/empty_specifier_export_all/output.js
@@ -1,69 +1,27 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_b85a.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"05ee5ec7":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
var _f_dep1 = farmRequire("ef0c4c9d");
diff --git a/crates/compiler/tests/fixtures/tree_shake/empty_specifiers/output.js b/crates/compiler/tests/fixtures/tree_shake/empty_specifiers/output.js
index e38a67d83..d38d69f5b 100644
--- a/crates/compiler/tests/fixtures/tree_shake/empty_specifiers/output.js
+++ b/crates/compiler/tests/fixtures/tree_shake/empty_specifiers/output.js
@@ -1,69 +1,27 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_5de5.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"6f462555":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
"";
diff --git a/crates/compiler/tests/fixtures/tree_shake/export_all/output.js b/crates/compiler/tests/fixtures/tree_shake/export_all/output.js
index 6919bef9e..54a474ff4 100644
--- a/crates/compiler/tests/fixtures/tree_shake/export_all/output.js
+++ b/crates/compiler/tests/fixtures/tree_shake/export_all/output.js
@@ -1,69 +1,27 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_6b9f.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"569704c1":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
var _f_b = farmRequire("f380ea31");
diff --git a/crates/compiler/tests/fixtures/tree_shake/farm_config/output.js b/crates/compiler/tests/fixtures/tree_shake/farm_config/output.js
index 15a465793..d0c455424 100644
--- a/crates/compiler/tests/fixtures/tree_shake/farm_config/output.js
+++ b/crates/compiler/tests/fixtures/tree_shake/farm_config/output.js
@@ -1,69 +1,27 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());window['__farm_default_namespace__'].__farm_module_system__.setExternalModules({"module": (window['module']||{}).default && !(window['module']||{}).__esModule ? {...(window['module']||{}),__esModule:true} : ({...window['module']||{}})});(function(_){for(var r in _){_[r].__farm_resource_pot__='index_7f1c.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"052dab48":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
exports.default = {
diff --git a/crates/compiler/tests/fixtures/tree_shake/html_entry/basic/output.js b/crates/compiler/tests/fixtures/tree_shake/html_entry/basic/output.js
index e8cd033b2..f6b0c818a 100644
--- a/crates/compiler/tests/fixtures/tree_shake/html_entry/basic/output.js
+++ b/crates/compiler/tests/fixtures/tree_shake/html_entry/basic/output.js
@@ -10,71 +10,29 @@
window['__farm_default_namespace__'] = {};
window['__farm_default_namespace__'] = {
__FARM_TARGET_ENV__: 'browser',
-};
diff --git a/crates/compiler/tests/fixtures/tree_shake/import-glob-eager/output.js b/crates/compiler/tests/fixtures/tree_shake/import-glob-eager/output.js
index fc0ee1806..ee2776eae 100644
--- a/crates/compiler/tests/fixtures/tree_shake/import-glob-eager/output.js
+++ b/crates/compiler/tests/fixtures/tree_shake/import-glob-eager/output.js
@@ -1,69 +1,27 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_de21.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"05ee5ec7":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
module.o(exports, "routes", function() {
diff --git a/crates/compiler/tests/fixtures/tree_shake/import_meta_hot/output.js b/crates/compiler/tests/fixtures/tree_shake/import_meta_hot/output.js
index 7e5591f32..20657e462 100644
--- a/crates/compiler/tests/fixtures/tree_shake/import_meta_hot/output.js
+++ b/crates/compiler/tests/fixtures/tree_shake/import_meta_hot/output.js
@@ -1,69 +1,27 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_ddf1.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"05ee5ec7":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
module.o(exports, "a", function() {
diff --git a/crates/compiler/tests/fixtures/tree_shake/import_namespace/output.js b/crates/compiler/tests/fixtures/tree_shake/import_namespace/output.js
index 0047ba52f..47b0349f2 100644
--- a/crates/compiler/tests/fixtures/tree_shake/import_namespace/output.js
+++ b/crates/compiler/tests/fixtures/tree_shake/import_namespace/output.js
@@ -1,69 +1,27 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_7104.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"b5d64806":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
var _f_b = module.w(farmRequire("f380ea31"));
diff --git a/crates/compiler/tests/fixtures/tree_shake/issue_1424/output.js b/crates/compiler/tests/fixtures/tree_shake/issue_1424/output.js
index 210986c22..4ce6ca698 100644
--- a/crates/compiler/tests/fixtures/tree_shake/issue_1424/output.js
+++ b/crates/compiler/tests/fixtures/tree_shake/issue_1424/output.js
@@ -1,69 +1,27 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_ddf1.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"05ee5ec7":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
module.o(exports, "Holder", function() {
diff --git a/crates/compiler/tests/fixtures/tree_shake/issue_337/output.js b/crates/compiler/tests/fixtures/tree_shake/issue_337/output.js
index dc2161827..609d3d926 100644
--- a/crates/compiler/tests/fixtures/tree_shake/issue_337/output.js
+++ b/crates/compiler/tests/fixtures/tree_shake/issue_337/output.js
@@ -1,69 +1,27 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_a93b.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"066a321b":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
module.o(exports, "default", function() {
diff --git a/crates/compiler/tests/fixtures/tree_shake/issue_344/output.js b/crates/compiler/tests/fixtures/tree_shake/issue_344/output.js
index e3a4ca977..5304c99e6 100644
--- a/crates/compiler/tests/fixtures/tree_shake/issue_344/output.js
+++ b/crates/compiler/tests/fixtures/tree_shake/issue_344/output.js
@@ -1,69 +1,27 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_51e4.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"4ef5be87":function (module, exports, farmRequire, farmDynamicRequire) {
module.exports = {
program: function() {}
diff --git a/crates/compiler/tests/fixtures/tree_shake/issue_625/output.js b/crates/compiler/tests/fixtures/tree_shake/issue_625/output.js
index 11329e1ed..ba9108b2f 100644
--- a/crates/compiler/tests/fixtures/tree_shake/issue_625/output.js
+++ b/crates/compiler/tests/fixtures/tree_shake/issue_625/output.js
@@ -1,69 +1,27 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_2c69.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"10c43cb2":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
module.o(exports, "registerTickMethod", function() {
diff --git a/crates/compiler/tests/fixtures/tree_shake/non_script/output.js b/crates/compiler/tests/fixtures/tree_shake/non_script/output.js
index d9e19948a..5fb1f53b2 100644
--- a/crates/compiler/tests/fixtures/tree_shake/non_script/output.js
+++ b/crates/compiler/tests/fixtures/tree_shake/non_script/output.js
@@ -1,69 +1,27 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_dcdc.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"b5d64806":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
"";
diff --git a/crates/compiler/tests/fixtures/tree_shake/partial_cyclic_deps/output.js b/crates/compiler/tests/fixtures/tree_shake/partial_cyclic_deps/output.js
index 1c1747b4b..11351420a 100644
--- a/crates/compiler/tests/fixtures/tree_shake/partial_cyclic_deps/output.js
+++ b/crates/compiler/tests/fixtures/tree_shake/partial_cyclic_deps/output.js
@@ -1,69 +1,27 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_6d6c.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"25593d80":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
var _f_b = module.i(farmRequire("f380ea31"));
diff --git a/crates/compiler/tests/fixtures/tree_shake/remove_module/output.js b/crates/compiler/tests/fixtures/tree_shake/remove_module/output.js
index 574378aea..5116c7a48 100644
--- a/crates/compiler/tests/fixtures/tree_shake/remove_module/output.js
+++ b/crates/compiler/tests/fixtures/tree_shake/remove_module/output.js
@@ -1,69 +1,27 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_ecb7.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"569704c1":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
module.o(exports, "appendA", function() {
diff --git a/crates/compiler/tests/fixtures/tree_shake/self-executed/assign/output.js b/crates/compiler/tests/fixtures/tree_shake/self-executed/assign/output.js
index 785dda96a..c7649868d 100644
--- a/crates/compiler/tests/fixtures/tree_shake/self-executed/assign/output.js
+++ b/crates/compiler/tests/fixtures/tree_shake/self-executed/assign/output.js
@@ -1,69 +1,27 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_6b9f.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"569704c1":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
var _f_b = module.i(farmRequire("f380ea31"));
diff --git a/crates/compiler/tests/fixtures/tree_shake/self-executed/axios/output.js b/crates/compiler/tests/fixtures/tree_shake/self-executed/axios/output.js
index 5567165fb..b2cad2d59 100644
--- a/crates/compiler/tests/fixtures/tree_shake/self-executed/axios/output.js
+++ b/crates/compiler/tests/fixtures/tree_shake/self-executed/axios/output.js
@@ -1,69 +1,27 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_ddf1.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"05ee5ec7":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
module.o(exports, "AxiosURLSearchParams2", function() {
diff --git a/crates/compiler/tests/fixtures/tree_shake/self-executed/class/static/output.js b/crates/compiler/tests/fixtures/tree_shake/self-executed/class/static/output.js
index 4ad572f1e..acdd88dd3 100644
--- a/crates/compiler/tests/fixtures/tree_shake/self-executed/class/static/output.js
+++ b/crates/compiler/tests/fixtures/tree_shake/self-executed/class/static/output.js
@@ -1,69 +1,27 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_e094.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"6d686e48":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
module.o(exports, "Foo", function() {
diff --git a/crates/compiler/tests/fixtures/tree_shake/self-executed/decl/basis/output.js b/crates/compiler/tests/fixtures/tree_shake/self-executed/decl/basis/output.js
index 9348e3196..1cb23d297 100644
--- a/crates/compiler/tests/fixtures/tree_shake/self-executed/decl/basis/output.js
+++ b/crates/compiler/tests/fixtures/tree_shake/self-executed/decl/basis/output.js
@@ -1,69 +1,27 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_ecb7.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"569704c1":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
var a1 = 11;
diff --git a/crates/compiler/tests/fixtures/tree_shake/self-executed/decl/class/output.js b/crates/compiler/tests/fixtures/tree_shake/self-executed/decl/class/output.js
index fae34232a..b24b05456 100644
--- a/crates/compiler/tests/fixtures/tree_shake/self-executed/decl/class/output.js
+++ b/crates/compiler/tests/fixtures/tree_shake/self-executed/decl/class/output.js
@@ -1,69 +1,27 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_ddf1.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"05ee5ec7":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
module.o(exports, "Foo", function() {
diff --git a/crates/compiler/tests/fixtures/tree_shake/self-executed/decl/function/output.js b/crates/compiler/tests/fixtures/tree_shake/self-executed/decl/function/output.js
index eb88a5809..97d00e74e 100644
--- a/crates/compiler/tests/fixtures/tree_shake/self-executed/decl/function/output.js
+++ b/crates/compiler/tests/fixtures/tree_shake/self-executed/decl/function/output.js
@@ -1,69 +1,27 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_ddf1.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"05ee5ec7":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
function foo() {}
diff --git a/crates/compiler/tests/fixtures/tree_shake/self-executed/decl/var_side_effect/output.js b/crates/compiler/tests/fixtures/tree_shake/self-executed/decl/var_side_effect/output.js
index 49f18d6d2..8f0769202 100644
--- a/crates/compiler/tests/fixtures/tree_shake/self-executed/decl/var_side_effect/output.js
+++ b/crates/compiler/tests/fixtures/tree_shake/self-executed/decl/var_side_effect/output.js
@@ -1,69 +1,27 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_5314.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"b5d64806":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
var _f_a = module.i(farmRequire("fa8c9120"));
diff --git a/crates/compiler/tests/fixtures/tree_shake/self-executed/decl/vars/output.js b/crates/compiler/tests/fixtures/tree_shake/self-executed/decl/vars/output.js
index 4cc753f78..77f736ab7 100644
--- a/crates/compiler/tests/fixtures/tree_shake/self-executed/decl/vars/output.js
+++ b/crates/compiler/tests/fixtures/tree_shake/self-executed/decl/vars/output.js
@@ -1,69 +1,27 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_ddf1.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"05ee5ec7":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
module.o(exports, "foo1", function() {
diff --git a/crates/compiler/tests/fixtures/tree_shake/self-executed/decl/vars_reverse_read/output.js b/crates/compiler/tests/fixtures/tree_shake/self-executed/decl/vars_reverse_read/output.js
index a63518370..ec209cbdc 100644
--- a/crates/compiler/tests/fixtures/tree_shake/self-executed/decl/vars_reverse_read/output.js
+++ b/crates/compiler/tests/fixtures/tree_shake/self-executed/decl/vars_reverse_read/output.js
@@ -1,69 +1,27 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_ddf1.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"05ee5ec7":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
module.o(exports, "a1", function() {
diff --git a/crates/compiler/tests/fixtures/tree_shake/self-executed/deep_side_effect/output.js b/crates/compiler/tests/fixtures/tree_shake/self-executed/deep_side_effect/output.js
index ab0f1f741..f807ca266 100644
--- a/crates/compiler/tests/fixtures/tree_shake/self-executed/deep_side_effect/output.js
+++ b/crates/compiler/tests/fixtures/tree_shake/self-executed/deep_side_effect/output.js
@@ -1,69 +1,27 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_d7f6.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"446ec84b":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
module.o(exports, "result", function() {
diff --git a/crates/compiler/tests/fixtures/tree_shake/self-executed/enum/output.js b/crates/compiler/tests/fixtures/tree_shake/self-executed/enum/output.js
index f7756695b..44b438c7d 100644
--- a/crates/compiler/tests/fixtures/tree_shake/self-executed/enum/output.js
+++ b/crates/compiler/tests/fixtures/tree_shake/self-executed/enum/output.js
@@ -1,69 +1,27 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_ecb7.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"569704c1":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
module.o(exports, "resolveValue", function() {
diff --git a/crates/compiler/tests/fixtures/tree_shake/self-executed/iife/output.js b/crates/compiler/tests/fixtures/tree_shake/self-executed/iife/output.js
index 89e018f10..4d6f222f8 100644
--- a/crates/compiler/tests/fixtures/tree_shake/self-executed/iife/output.js
+++ b/crates/compiler/tests/fixtures/tree_shake/self-executed/iife/output.js
@@ -1,69 +1,27 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_ecb7.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"569704c1":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
(function() {
diff --git a/crates/compiler/tests/fixtures/tree_shake/self-executed/import/output.js b/crates/compiler/tests/fixtures/tree_shake/self-executed/import/output.js
index 093398982..59f8feae7 100644
--- a/crates/compiler/tests/fixtures/tree_shake/self-executed/import/output.js
+++ b/crates/compiler/tests/fixtures/tree_shake/self-executed/import/output.js
@@ -1,69 +1,27 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_6b9f.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"569704c1":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
farmRequire("f380ea31");
diff --git a/crates/compiler/tests/fixtures/tree_shake/self-executed/new-call/output.js b/crates/compiler/tests/fixtures/tree_shake/self-executed/new-call/output.js
index 26bb6d71b..0deee71ae 100644
--- a/crates/compiler/tests/fixtures/tree_shake/self-executed/new-call/output.js
+++ b/crates/compiler/tests/fixtures/tree_shake/self-executed/new-call/output.js
@@ -1,69 +1,27 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_f1d9.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"4312d062":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
module.o(exports, "default", function() {
diff --git a/crates/compiler/tests/fixtures/tree_shake/self-executed/set/output.js b/crates/compiler/tests/fixtures/tree_shake/self-executed/set/output.js
index 3808c2fb4..0114658ec 100644
--- a/crates/compiler/tests/fixtures/tree_shake/self-executed/set/output.js
+++ b/crates/compiler/tests/fixtures/tree_shake/self-executed/set/output.js
@@ -1,69 +1,27 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_ecb7.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"569704c1":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
exports.default = function() {
diff --git a/crates/compiler/tests/fixtures/tree_shake/self-executed/side_effect/output.js b/crates/compiler/tests/fixtures/tree_shake/self-executed/side_effect/output.js
index 252d2f9ac..8f4ef748e 100644
--- a/crates/compiler/tests/fixtures/tree_shake/self-executed/side_effect/output.js
+++ b/crates/compiler/tests/fixtures/tree_shake/self-executed/side_effect/output.js
@@ -1,69 +1,27 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){var index_js_cjs = __commonJs((module, exports)=>{
+}
+var index_js_cjs = __commonJs((module, exports)=>{
"use strict";
console.log('runtime/index.js');
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_98b2.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"070fbe2d":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
let foo = 0;
diff --git a/crates/compiler/tests/fixtures/tree_shake_development/css/output.js b/crates/compiler/tests/fixtures/tree_shake_development/css/output.js
index 4fd1a34e3..10f914bc4 100644
--- a/crates/compiler/tests/fixtures/tree_shake_development/css/output.js
+++ b/crates/compiler/tests/fixtures/tree_shake_development/css/output.js
@@ -1,65 +1,22 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){// module_id: ../../_internal/runtime/index.js.farm-runtime
+function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){// module_id: ../../_internal/runtime/index.js.farm-runtime
+}
var index_js_cjs = __commonJs({
"../../_internal/runtime/index.js.farm-runtime": (module, exports)=>{
"use strict";
@@ -67,6 +24,7 @@ var index_js_cjs = __commonJs({
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
}
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_4246.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"index.ts":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
module.o(exports, "c", function() {
diff --git a/crates/compiler/tests/fixtures/tree_shake_development/import_meta_hot/output.js b/crates/compiler/tests/fixtures/tree_shake_development/import_meta_hot/output.js
index f827ce332..42051f0c4 100644
--- a/crates/compiler/tests/fixtures/tree_shake_development/import_meta_hot/output.js
+++ b/crates/compiler/tests/fixtures/tree_shake_development/import_meta_hot/output.js
@@ -1,65 +1,22 @@
//index.js:
- window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};function _interop_require_default(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
-}function _export_star(from, to) {
- Object.keys(from).forEach(function(k) {
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
- Object.defineProperty(to, k, {
- enumerable: true,
- get: function() {
- return from[k];
- }
- });
+ window['__farm_default_namespace__'] = {__FARM_TARGET_ENV__: 'browser'};;((function(){// module_id: ../../_internal/runtime/index.js.farm-runtime
+function __commonJs(mod) {
+ var module;
+ return ()=>{
+ if (module) {
+ return module.exports;
}
- });
- return from;
-}function _interop_require_wildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) return obj;
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
- default: obj
- };
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) return cache.get(obj);
- var newObj = {
- __proto__: null
- };
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for(var key in obj){
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
- else newObj[key] = obj[key];
+ module = {
+ exports: {}
+ };
+ if (typeof mod === "function") {
+ mod(module, module.exports);
+ } else {
+ mod[Object.keys(mod)[0]](module, module.exports);
}
- }
- newObj.default = obj;
- if (cache) cache.set(obj, newObj);
- return newObj;
-}function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}function __commonJs(mod) {
- var module;
- return () => {
- if (module) {
- return module.exports;
- }
- module = {
- exports: {},
+ return module.exports;
};
- if(typeof mod === "function") {
- mod(module, module.exports);
- }else {
- mod[Object.keys(mod)[0]](module, module.exports);
- }
- return module.exports;
- };
-}((function(){// module_id: ../../_internal/runtime/index.js.farm-runtime
+}
var index_js_cjs = __commonJs({
"../../_internal/runtime/index.js.farm-runtime": (module, exports)=>{
"use strict";
@@ -67,6 +24,7 @@ var index_js_cjs = __commonJs({
window['__farm_default_namespace__'].__farm_module_system__.setPlugins([]);
}
});
+index_js_cjs();
})());(function(_){for(var r in _){_[r].__farm_resource_pot__='index_ddf1.js';window['__farm_default_namespace__'].__farm_module_system__.register(r,_[r])}})({"dep.ts":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
module.o(exports, "a", function() {
diff --git a/crates/compiler/tests/fixtures/update/lazy-compilation/update0.output.js b/crates/compiler/tests/fixtures/update/lazy-compilation/update0.output.js
index e2c3479cf..f2ff42168 100644
--- a/crates/compiler/tests/fixtures/update/lazy-compilation/update0.output.js
+++ b/crates/compiler/tests/fixtures/update/lazy-compilation/update0.output.js
@@ -5,10 +5,9 @@
,
"dep.ts.farm_dynamic_import_virtual_module":function (module, exports, farmRequire, farmDynamicRequire) {
module._m(exports);
- var _f_dep = module.i(farmRequire("dep.ts"));
- exports.default = module.f(_f_dep);
- var _f_dep1 = farmRequire("dep.ts");
- module._e(exports, _f_dep1);
+ var _f_dep = module.w(farmRequire("dep.ts"));
+ var ns = _f_dep;
+ module.exports = ns;
}
,})
{}
\ No newline at end of file
diff --git a/crates/compiler/tests/runtime.rs b/crates/compiler/tests/runtime.rs
index 23442bc3c..2ff46f187 100644
--- a/crates/compiler/tests/runtime.rs
+++ b/crates/compiler/tests/runtime.rs
@@ -12,9 +12,7 @@ use crate::common::{
#[allow(dead_code)]
#[cfg(test)]
fn test(file: String, crate_path: String) {
- use common::get_config_field;
-
- use crate::common::try_read_config_from_json;
+ use common::{format_output_name, get_dir_config_files, try_merge_config_file};
let file_path_buf = PathBuf::from(file.clone());
let create_path_buf = PathBuf::from(crate_path);
@@ -23,67 +21,48 @@ fn test(file: String, crate_path: String) {
let entry_name = "index".to_string();
- let config_entry = cwd.to_path_buf().join("config.json");
- let runtime_entry = cwd.to_path_buf().join("runtime.ts");
-
- let config_from_file = try_read_config_from_json(config_entry);
-
- let compiler =
- create_compiler_with_args(cwd.to_path_buf(), create_path_buf, |mut config, plugins| {
- config.mode = Mode::Production;
-
- if runtime_entry.is_file() {
- let runtime_entry = runtime_entry.to_string_lossy().to_string();
- config.runtime.path = runtime_entry;
- }
-
- config.input = HashMap::from_iter(vec![(entry_name.clone(), file)]);
+ let files = get_dir_config_files(cwd);
- config.minify = Box::new(BoolOrObj::Bool(false));
- config.tree_shaking = Box::new(BoolOrObj::Bool(false));
+ for (name, config_entry) in files {
+ let runtime_entry = cwd.to_path_buf().join("runtime.ts");
- config.external = vec![ConfigRegex::new("(^node:.*)"), ConfigRegex::new("^fs$")];
- config.output.target_env = TargetEnv::Node;
- // config.output.format = ModuleFormat::CommonJs;
+ let compiler = create_compiler_with_args(
+ cwd.to_path_buf(),
+ create_path_buf.clone(),
+ |mut config, plugins| {
+ config.mode = Mode::Production;
- // TODO: multiple bundle
- config.partial_bundling.enforce_resources = vec![PartialBundlingEnforceResourceConfig {
- test: vec![ConfigRegex::new("^bundle2.*")],
- name: "bundle2".to_string(),
- }];
-
- if let Some(config_from_file) = config_from_file {
- // TODO: macro
- if let Some(mode) = get_config_field(&config_from_file, &["mode"]) {
- config.mode = mode;
+ if runtime_entry.is_file() {
+ let runtime_entry = runtime_entry.to_string_lossy().to_string();
+ config.runtime.path = runtime_entry;
}
- if let Some(format) = get_config_field(&config_from_file, &["output", "format"]) {
- config.output.format = format;
- }
+ config.input = HashMap::from_iter(vec![(entry_name.clone(), file.clone())]);
- if let Some(target_env) = get_config_field(&config_from_file, &["output", "targetEnv"]) {
- config.output.target_env = target_env;
- }
+ config.minify = Box::new(BoolOrObj::Bool(false));
+ config.tree_shaking = Box::new(BoolOrObj::Bool(false));
- if let Some(lazy_compilation) = get_config_field(&config_from_file, &["lazyCompilation"]) {
- config.lazy_compilation = lazy_compilation;
- }
- }
+ config.external = vec![ConfigRegex::new("(^node:.*)"), ConfigRegex::new("^fs$")];
+ config.output.target_env = TargetEnv::Node;
+
+ config = try_merge_config_file(config, config_entry);
- (config, plugins)
- });
+ (config, plugins)
+ },
+ );
- compiler.compile().unwrap();
+ compiler.compile().unwrap();
- assert_compiler_result_with_config(
- &compiler,
- AssertCompilerResultConfig {
- entry_name: Some(entry_name),
- ignore_emitted_field: false,
- ..Default::default()
- },
- );
+ assert_compiler_result_with_config(
+ &compiler,
+ AssertCompilerResultConfig {
+ entry_name: Some(entry_name.clone()),
+ output_file: Some(format_output_name(name)),
+ ignore_emitted_field: false,
+ ..Default::default()
+ },
+ );
+ }
}
farmfe_testing::testing! {"tests/fixtures/runtime/bundle/**/index.ts", test}
diff --git a/crates/compiler/tests/script.rs b/crates/compiler/tests/script.rs
index cdfc0ad95..4016331e9 100644
--- a/crates/compiler/tests/script.rs
+++ b/crates/compiler/tests/script.rs
@@ -1,8 +1,8 @@
use std::{collections::HashMap, path::PathBuf};
use common::{
- assert_compiler_result_with_config, create_compiler_with_args, get_config_field,
- try_read_config_from_json, AssertCompilerResultConfig,
+ assert_compiler_result_with_config, create_compiler_with_args,
+ try_merge_config_file, AssertCompilerResultConfig,
};
mod common;
@@ -17,23 +17,11 @@ fn script_test(file: String, crate_path: String) {
let config_entry = cwd.to_path_buf().join("config.json");
- let config_from_file = try_read_config_from_json(config_entry);
-
let compiler =
create_compiler_with_args(cwd.to_path_buf(), create_path_buf, |mut config, plugins| {
- config.input = HashMap::from_iter(vec![(entry_name.clone(), file)]);
-
- if let Some(config_form_file) = config_from_file {
- if let Some(str) = get_config_field(&config_form_file, &["output", "publicPath"]) {
- config.output.public_path = str;
- }
-
- if let Some(enable) =
- get_config_field(&config_form_file, &["script", "nativeTopLevelAwait"])
- {
- config.script.native_top_level_await = enable;
- }
- }
+ config.input = HashMap::from_iter(vec![(entry_name.clone(), file.clone())]);
+
+ config = try_merge_config_file(config, config_entry);
(config, plugins)
});
diff --git a/crates/core/src/module/mod.rs b/crates/core/src/module/mod.rs
index 0f8272514..431740d29 100644
--- a/crates/core/src/module/mod.rs
+++ b/crates/core/src/module/mod.rs
@@ -402,6 +402,18 @@ impl ScriptModuleMetaData {
pub fn set_comments(&mut self, comments: CommentsMetaData) {
self.comments = comments;
}
+
+ pub fn is_cjs(&self) -> bool {
+ matches!(self.module_system, ModuleSystem::CommonJs)
+ }
+
+ pub fn is_esm(&self) -> bool {
+ matches!(self.module_system, ModuleSystem::EsModule)
+ }
+
+ pub fn is_hybrid(&self) -> bool {
+ matches!(self.module_system, ModuleSystem::Hybrid)
+ }
}
#[cache_item]
diff --git a/crates/core/src/resource/resource_pot.rs b/crates/core/src/resource/resource_pot.rs
index abc101a6b..1f5ae40e0 100644
--- a/crates/core/src/resource/resource_pot.rs
+++ b/crates/core/src/resource/resource_pot.rs
@@ -82,6 +82,10 @@ impl ResourcePot {
std::mem::take(&mut self.meta)
}
+ pub fn has_module(&self, module_id: &ModuleId) -> bool {
+ self.modules.contains(module_id)
+ }
+
pub fn remove_module(&mut self, module_id: &ModuleId) {
self.modules.remove(module_id);
}
diff --git a/crates/plugin_bundle/src/lib.rs b/crates/plugin_bundle/src/lib.rs
index dccc11ffe..a8586a87b 100644
--- a/crates/plugin_bundle/src/lib.rs
+++ b/crates/plugin_bundle/src/lib.rs
@@ -1,27 +1,43 @@
#![feature(box_patterns)]
-use std::{collections::HashMap, sync::Arc};
+use std::{
+ collections::{HashMap, HashSet},
+ sync::Arc,
+};
use farmfe_core::{
+ config::{
+ config_regex::ConfigRegex, partial_bundling::PartialBundlingEnforceResourceConfig, Config,
+ },
+ context::CompilationContext,
enhanced_magic_string::bundle::Bundle,
+ module::ModuleType,
parking_lot::Mutex,
- plugin::Plugin,
- resource::resource_pot::{ResourcePotMetaData, ResourcePotType},
+ plugin::{
+ Plugin, PluginAnalyzeDepsHookResultEntry, PluginFinalizeResourcesHookParams,
+ PluginGenerateResourcesHookResult, PluginHookContext, PluginLoadHookParam,
+ PluginLoadHookResult, PluginResolveHookParam, PluginResolveHookResult, ResolveKind,
+ },
+ regex::Regex,
+ relative_path::RelativePath,
+ resource::{
+ resource_pot::{ResourcePot, ResourcePotMetaData, ResourcePotType},
+ ResourceType,
+ },
+};
+use farmfe_toolkit::constant::RUNTIME_SUFFIX;
+use resource_pot_to_bundle::{
+ BundleGroup, ShareBundleOptions, SharedBundle, FARM_BUNDLE_POLYFILL_SLOT,
+ FARM_BUNDLE_REFERENCE_SLOT_PREFIX,
};
-use resource_pot_to_bundle::{Polyfill, SharedBundle};
pub mod resource_pot_to_bundle;
-const MODULE_NEED_POLYFILLS: [Polyfill; 3] = [
- Polyfill::Wildcard,
- Polyfill::InteropRequireDefault,
- Polyfill::ExportStar,
-];
-
#[derive(Default)]
pub struct FarmPluginBundle {
runtime_code: Mutex>,
bundle_map: Mutex>,
+ resource_pot_id_resource_map: Mutex>,
}
impl FarmPluginBundle {
@@ -30,15 +46,94 @@ impl FarmPluginBundle {
}
}
+impl FarmPluginBundle {
+ fn should_bundle(config: &Config) -> bool {
+ config.output.target_env.is_library()
+ }
+}
+
impl Plugin for FarmPluginBundle {
fn name(&self) -> &str {
"farm-plugin-bundle"
}
+ fn config(&self, config: &mut Config) -> farmfe_core::error::Result