Comparing version 1.1.1 to 1.1.2
@@ -127,2 +127,9 @@ export * as default from "./functional.js"; | ||
/** | ||
* Comparator for numeric types. | ||
* @internal | ||
*/ | ||
export function numericComparator(left, right) { | ||
return left - right; | ||
} | ||
/** | ||
* Creates a comparator from a mapping function and a comparator. | ||
@@ -135,2 +142,6 @@ * @internal | ||
/** @internal */ | ||
export function mappedNumericComparator(map) { | ||
return mappedComparator(numericComparator, map); | ||
} | ||
/** @internal */ | ||
export function mappedPrimitiveComparator(map) { | ||
@@ -137,0 +148,0 @@ return mappedComparator(primitiveComparator, map); |
@@ -90,3 +90,7 @@ import * as assert from "node:assert/strict"; | ||
return specifierToBindings.get(importSpecifier) ?? function () { | ||
const localName = `_${specifier.replaceAll(/[^A-Za-z0-9_$]/g, "_")}`; | ||
const identifierFragment = specifier | ||
// "$" becomes our escape character | ||
.replaceAll("$", "$$") | ||
// Replace (for example) "-" with "$002d" | ||
.replaceAll(/[^A-Za-z0-9_]/g, char => `$${char.charCodeAt(0).toString(16).padStart(4, "0")}`); | ||
const bindings = []; | ||
@@ -96,3 +100,3 @@ specifierToBindings.set(importSpecifier, bindings); | ||
bindings, | ||
identifier: localName, | ||
identifier: `_${identifierFragment}`, | ||
importSpecifier, | ||
@@ -99,0 +103,0 @@ specifier, |
/// <reference types="node" resolution-mode="require"/> | ||
import type { ModuleNamespace } from "./module.js"; | ||
import type { DynamicImport } from "./declaration.js"; | ||
import { EventEmitter } from "node:events"; | ||
@@ -11,3 +11,2 @@ export interface HotApplication { | ||
} | ||
type DynamicImport = (specifier: string, importAssertions?: Record<string, string>) => Promise<ModuleNamespace>; | ||
type UpdateResult = undefined | UpdateSuccess | UpdateDeclined | UpdateUnaccepted | UpdateEvaluationError | UpdateFatalError | UpdateLinkError; | ||
@@ -14,0 +13,0 @@ interface UpdateSuccess { |
@@ -237,2 +237,5 @@ import * as assert from "node:assert/strict"; | ||
} | ||
else if (this.current.state.status === ModuleStatus.evaluatingAsync) { | ||
return this.current.state.completion.promise; | ||
} | ||
} | ||
@@ -239,0 +242,0 @@ // Invoked from transformed module source |
import * as assert from "node:assert/strict"; | ||
import Fn from "dynohot/functional"; | ||
import Fn, { mappedNumericComparator } from "dynohot/functional"; | ||
/** @internal */ | ||
@@ -46,2 +46,3 @@ export const makeAcquireVisitIndex = function () { | ||
ancestorIndex: nodeIndex, | ||
order, | ||
forwardResults: undefined, | ||
@@ -87,4 +88,6 @@ result: undefined, | ||
assert.ok(state.ancestorIndex <= state.index); | ||
state.order = ++order; | ||
if (state.ancestorIndex === state.index) { | ||
const cycleNodes = stack.splice(stackIndex); | ||
cycleNodes.sort(mappedNumericComparator(node => peek(node).state.order)); | ||
// Collect forward results from cycle nodes | ||
@@ -168,2 +171,3 @@ let hasPromise = false; | ||
let index = 0; | ||
let order = 0; | ||
const stack = []; | ||
@@ -170,0 +174,0 @@ try { |
{ | ||
"name": "dynohot", | ||
"type": "module", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"exports": { | ||
@@ -6,0 +6,0 @@ ".": "./dist/loader/loader.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
139868
2905