Skip to content

Commit

Permalink
Merge pull request #6 from tajo/no-ssr
Browse files Browse the repository at this point in the history
Add configuration options and JS test suite
  • Loading branch information
tajo committed Jul 7, 2023
2 parents 4cf438b + e467b89 commit 605a51a
Show file tree
Hide file tree
Showing 45 changed files with 1,895 additions and 132 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ jobs:
with:
node-version: 18

- name: Install dependencies
run: npm install

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
Expand All @@ -47,3 +50,12 @@ jobs:
- name: Run cargo test
run: |
cargo test --all --color always
- name: Install wasm target
shell: bash
run: |
rustup target add wasm32-wasi
- name: Build binary and run JS tests
run: |
npm test -w fusion-js-test
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
packages/*
packages/fusion/*
2 changes: 2 additions & 0 deletions .rustfmt.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ imports_granularity = "Crate"
reorder_impl_items = true
use_field_init_shorthand = true
wrap_comments = true
max_width = 100

27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,33 @@ _fusionPluginI18nChunkTranslationMap.add(
);
```

### split dynamic imports

```js
import("./foo/baz");
```

into

```js
Object.defineProperties(import("./foo/baz"), {
__CHUNK_IDS: {
value: [],
},
__MODULE_ID: {
value:
"virtual:fusion-vite-split-loader?importer=file.js&specifier=%2E%2Ffoo%2Fbaz",
},
__FUSION_DYNAMIC_IMPORT_METADATA__: {
value: {
version: 0,
moduleId:
"virtual:fusion-vite-split-loader?importer=file.js&specifier=%2E%2Ffoo%2Fbaz",
},
},
});
```

## Contributing

```sh
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,8 @@ export default function () {
translate("static");
translate(`prefix.${"foo"}.mid.${"baz"}`);
}
_fusionPluginI18nChunkTranslationMap.add("/path/to/file.js", [
"vite-i18n-chunk"
], [
"static",
[
"prefix.",
".mid.",
""
]
]);
_fusionPluginI18nChunkTranslationMap.add(
"/path/to/file.js",
["vite-i18n-chunk"],
["static", ["prefix.", ".mid.", ""]]
);
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions fixtures/split-no-ssr/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"ssr": false
}
8 changes: 8 additions & 0 deletions fixtures/split-no-ssr/output.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Object.defineProperties(import("./foo/baz"), {
__CHUNK_IDS: {
value: []
},
__MODULE_ID: {
value: "virtual:fusion-vite-split-loader?importer=%2Fpath%2Fto%2Ffile%2Ejs&specifier=%2E%2Ffoo%2Fbaz"
},
});
1 change: 1 addition & 0 deletions fixtures/split/code.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import('./foo/baz')
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 605a51a

Please sign in to comment.