Skip to content

Commit

Permalink
feat: support rollup 3 (#38)
Browse files Browse the repository at this point in the history
* feat: support rollup 3

* feat: test only in newer node versions
BREAKING CHANGE: drop support for node < 16

* chore: resolve ts errors

* fix: inline correct __dirname code for esm
  • Loading branch information
DylanPiercey committed May 19, 2023
1 parent 623f8e7 commit 634f42d
Show file tree
Hide file tree
Showing 19 changed files with 7,095 additions and 10,085 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node: [12.x, 14.x, 15.x]
node: [16.x, 18.x, 20.x]
steps:
- name: Checkout code
uses: actions/checkout@v2
Expand Down
16 changes: 8 additions & 8 deletions components/rollup-watch.marko
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
import fs from "fs";
static let watcher;
static let pendingManifest;
static function getLatestManifest($global) {
static function getLatestManifest(markoGlobal) {
if (!watcher) {
watcher = fs.watch($global.__rollupManifest).on("change", () => {
watcher = fs.watch(markoGlobal.__rollupManifest).on("change", () => {
pendingManifest = undefined
getLatestManifest($global);
getLatestManifest(markoGlobal);
});
}
return pendingManifest || (pendingManifest = fs.promises
.readFile($global.__rollupManifest, "utf-8")
.readFile(markoGlobal.__rollupManifest, "utf-8")
.then(JSON.parse)
.catch(() =>
new Promise(resolve => watcher.once("change", resolve))
.then(() => getLatestManifest($global))
.then(() => getLatestManifest(markoGlobal))
));
}

$ const $global = out.global;
<await(getLatestManifest($global))>
$ const markoGlobal = out.global;
<await(getLatestManifest(markoGlobal))>
<@then|manifest|>
$ const entries = $global.__rollupEntries || ($global.__rollupEntries = []);
$ const entries = markoGlobal.__rollupEntries || (markoGlobal.__rollupEntries = []);
$ let writtenEntries = 0;
<__flush_here_and_after__>
$ const lastWrittenEntry = writtenEntries;
Expand Down
4 changes: 2 additions & 2 deletions components/rollup.marko
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$ const $global = out.global;
$ const entries = $global.__rollupEntries || ($global.__rollupEntries = []);
$ const markoGlobal = out.global;
$ const entries = markoGlobal.__rollupEntries || (markoGlobal.__rollupEntries = []);
$ let writtenEntries = 0;
<__flush_here_and_after__>
$ const lastWrittenEntry = writtenEntries;
Expand Down

0 comments on commit 634f42d

Please sign in to comment.