Skip to content

Commit

Permalink
Merge pull request #447 from jsenv/work_on_spa
Browse files Browse the repository at this point in the history
Work on spa
  • Loading branch information
dmail authored Jan 22, 2025
2 parents 395201f + 1a01356 commit d673419
Show file tree
Hide file tree
Showing 106 changed files with 1,225 additions and 678 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci_eslint_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- ubuntu-22.04
- macos-14 # might cause https://github.com/microsoft/playwright/issues/30585
- windows-2022
node: [22.11.0]
node: [22.13.1]
runs-on: ${{ matrix.os }}
name: test on ${{ matrix.os }} and node ${{ matrix.node }}
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_test_workspace.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- ubuntu-22.04
- macos-14 # might cause https://github.com/microsoft/playwright/issues/30585
- windows-2022
node: [22.11.0]
node: [22.13.1]
runs-on: ${{ matrix.os }}
name: test on ${{ matrix.os }} and node ${{ matrix.node }}
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr_impact_on_dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-22.04]
node: [22.3.0]
node: [22.13.1]
runs-on: ${{ matrix.os }}
name: pr impact
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr_impact_on_performances.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-22.04]
node: [22.3.0]
node: [22.13.1]
runs-on: ${{ matrix.os }}
name: performance impact
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/testing_github_check_run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-22.04]
node: [22.3.0]
node: [22.13.1]
runs-on: ${{ matrix.os }}
name: test on ${{ matrix.os }} and node ${{ matrix.node }}
steps:
Expand Down
67 changes: 49 additions & 18 deletions dist/js/autoreload.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,29 @@ const initAutoreload = ({ mainFilePath }) => {
currentExecution: null,
reload: () => {
const someEffectIsFullReload = reloader.changes.value.some(
(reloadMessage) => reloadMessage.type === "full",
(reloadMessage) => {
if (reloadMessage.type === "full") {
return true;
}
if (reloadMessage.type === "hot") {
for (const reloadInstruction of reloadMessage.hotInstructions) {
if (reloadInstruction.type === "html") {
const acceptedByUrl = new URL(
reloadInstruction.acceptedBy,
`${window.location.origin}/`,
).href;
const isCurrentHtmlFile = compareTwoUrlPaths(
acceptedByUrl,
window.location.href,
);
if (isCurrentHtmlFile) {
return true;
}
}
}
}
return false;
},
);
if (someEffectIsFullReload) {
dispatchBeforeFullReload();
Expand Down Expand Up @@ -136,30 +158,32 @@ This could be due to syntax errors or importing non-existent modules (see errors
// - code was not executed (code splitting with dynamic import)
// - import.meta.hot.accept() is not called (happens for HTML and CSS)
if (type === "prune") {
if (urlHotMeta) {
dispatchBeforePrune();
delete urlHotMetas[urlToFetch];
if (urlHotMeta.disposeCallback) {
console.log(
`[jsenv] cleanup ${boundary} (no longer referenced by ${acceptedBy})`,
);
await urlHotMeta.disposeCallback();
}
if (!urlHotMeta) {
// code not executed for this url, no need to prune
continue;
}
dispatchBeforePrune();
delete urlHotMetas[urlToFetch];
if (urlHotMeta.disposeCallback) {
console.log(
`[jsenv] cleanup ${boundary} (no longer referenced by ${acceptedBy})`,
);
await urlHotMeta.disposeCallback();
}
continue;
}
if (acceptedBy === boundary) {
console.log(`[jsenv] hot reloading ${boundary} (${cause})`);
} else {
console.log(
`[jsenv] hot reloading ${acceptedBy} usage in ${boundary} (${cause})`,
);
}
if (type === "js_module") {
if (!urlHotMeta) {
// code was not executed, no need to re-execute it
// code not yet executed for this url, no need to re-execute it
continue;
}
if (acceptedBy === boundary) {
console.log(`[jsenv] hot reload ${boundary} (${cause})`);
} else {
console.log(
`[jsenv] hot reload ${acceptedBy} usage in ${boundary} (${cause})`,
);
}
if (urlHotMeta.disposeCallback) {
await urlHotMeta.disposeCallback();
}
Expand Down Expand Up @@ -189,6 +213,13 @@ This could be due to syntax errors or importing non-existent modules (see errors
// we are not in that HTML page
continue;
}
if (acceptedBy === boundary) {
console.log(`[jsenv] hot reload ${boundary} (${cause})`);
} else {
console.log(
`[jsenv] hot reload ${acceptedBy} usage in ${boundary} (${cause})`,
);
}
const urlToReload = new URL(acceptedBy, `${window.location.origin}/`)
.href;
const domNodesUsingUrl = getDOMNodesUsingUrl(urlToReload);
Expand Down
2 changes: 1 addition & 1 deletion dist/js/new_stylesheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@
null,
false,
);
for (var next = void 0; (next = iter.nextNode()); ) {
for (var next = undefined; (next = iter.nextNode()); ) {
callback(getShadowRoot(next));
}
}
Expand Down
2 changes: 1 addition & 1 deletion dist/js/regenerator_runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ var runtime = (function (exports) {
// AsyncIterator objects; they just return a Promise for the value of
// the final result produced by the iterator.
exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
if (PromiseImpl === void 0) PromiseImpl = Promise;
if (PromiseImpl === undefined) PromiseImpl = Promise;

var iter = new AsyncIterator(
wrap(innerFn, outerFn, self, tryLocsList),
Expand Down
14 changes: 7 additions & 7 deletions dist/js/ws.js
Original file line number Diff line number Diff line change
Expand Up @@ -1738,8 +1738,8 @@ function requireBuffer () {
byteOffset = 0;
} else if (byteOffset > 0x7fffffff) {
byteOffset = 0x7fffffff;
} else if (byteOffset < -0x80000000) {
byteOffset = -0x80000000;
} else if (byteOffset < -2147483648) {
byteOffset = -2147483648;
}
byteOffset = +byteOffset; // Coerce to Number.
if (numberIsNaN(byteOffset)) {
Expand Down Expand Up @@ -2480,7 +2480,7 @@ function requireBuffer () {
Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
value = +value;
offset = offset >>> 0;
if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80);
if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -128);
if (value < 0) value = 0xff + value + 1;
this[offset] = (value & 0xff);
return offset + 1
Expand All @@ -2489,7 +2489,7 @@ function requireBuffer () {
Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
value = +value;
offset = offset >>> 0;
if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);
if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -32768);
this[offset] = (value & 0xff);
this[offset + 1] = (value >>> 8);
return offset + 2
Expand All @@ -2498,7 +2498,7 @@ function requireBuffer () {
Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
value = +value;
offset = offset >>> 0;
if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);
if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -32768);
this[offset] = (value >>> 8);
this[offset + 1] = (value & 0xff);
return offset + 2
Expand All @@ -2507,7 +2507,7 @@ function requireBuffer () {
Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
value = +value;
offset = offset >>> 0;
if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);
if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -2147483648);
this[offset] = (value & 0xff);
this[offset + 1] = (value >>> 8);
this[offset + 2] = (value >>> 16);
Expand All @@ -2518,7 +2518,7 @@ function requireBuffer () {
Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
value = +value;
offset = offset >>> 0;
if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);
if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -2147483648);
if (value < 0) value = 0xffffffff + value + 1;
this[offset] = (value >>> 24);
this[offset + 1] = (value >>> 16);
Expand Down
Loading

0 comments on commit d673419

Please sign in to comment.