From 22f098a56ca76efa8fb6d2455086ce828cc01be9 Mon Sep 17 00:00:00 2001 From: Erin Millard Date: Sat, 29 Oct 2022 10:14:33 +1000 Subject: [PATCH] Fix ESM output for native Node.js usage --- Makefile | 2 ++ package.json | 8 ++++---- src/index.ts | 2 +- test/unit/index.spec.ts | 4 ++-- test/unit/normalize-param.spec.ts | 2 +- test/unit/path.spec.ts | 2 +- test/unit/type/any-param.spec.ts | 4 ++-- test/unit/type/normalize-param.spec.ts | 4 ++-- test/unit/type/param-arg.spec.ts | 4 ++-- test/unit/type/param-name.spec.ts | 4 ++-- test/unit/type/param-or-string.spec.ts | 4 ++-- test/unit/type/param.spec.ts | 2 +- test/unit/type/path-pattern.spec.ts | 2 +- 13 files changed, 23 insertions(+), 21 deletions(-) diff --git a/Makefile b/Makefile index 3521cb1..205a465 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +export NODE_OPTIONS := --experimental-vm-modules --redirect-warnings=artifacts/node-warnings + JS_SIZE_LIMIT_REQ += artifacts/dist ################################################################################ diff --git a/package.json b/package.json index ff4efa9..46a0e63 100644 --- a/package.json +++ b/package.json @@ -35,16 +35,16 @@ "size-limit-clean": "rm -rf artifacts/dist" }, "dependencies": { - "@snout/regexp": "^0.3.0" + "@snout/regexp": "^0.3.2" }, "devDependencies": { "@size-limit/preset-small-lib": "^8.0.0", "@snout/eslint-config": "^3.2.2", - "@snout/jest-config": "^2.1.0", - "@snout/tsconfig": "^2.0.0", + "@snout/jest-config": "^3.0.0", + "@snout/tsconfig": "^3.0.0", "prettier": "^2.7.1", "prettier-plugin-organize-imports": "^3.0.0", "size-limit": "^8.0.0", - "typescript": "^4.2.3" + "typescript": "^4.8.4" } } diff --git a/src/index.ts b/src/index.ts index 154fba0..8c0135e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -8,4 +8,4 @@ export { ParamOrString, path, PathPattern, -} from "./main"; +} from "./main.js"; diff --git a/test/unit/index.spec.ts b/test/unit/index.spec.ts index 8216c6d..4b9171c 100644 --- a/test/unit/index.spec.ts +++ b/test/unit/index.spec.ts @@ -1,5 +1,5 @@ -import * as index from "../../src/index"; -import { normalizeParam, path } from "../../src/main"; +import * as index from "../../src/index.js"; +import { normalizeParam, path } from "../../src/main.js"; describe("module index", () => { it("should provide access to normalizeParam()", () => { diff --git a/test/unit/normalize-param.spec.ts b/test/unit/normalize-param.spec.ts index 017cd8b..d726986 100644 --- a/test/unit/normalize-param.spec.ts +++ b/test/unit/normalize-param.spec.ts @@ -1,4 +1,4 @@ -import { normalizeParam, Param } from "../../src/main"; +import { normalizeParam, Param } from "../../src/main.js"; describe("normalizeParam()", () => { it("should return Param objects unmodified", () => { diff --git a/test/unit/path.spec.ts b/test/unit/path.spec.ts index 7d46720..ccc1a94 100644 --- a/test/unit/path.spec.ts +++ b/test/unit/path.spec.ts @@ -1,4 +1,4 @@ -import { Param, path } from "../../src/main"; +import { Param, path } from "../../src/main.js"; describe("path()", () => { describe("path.match()", () => { diff --git a/test/unit/type/any-param.spec.ts b/test/unit/type/any-param.spec.ts index 702d777..b8afc41 100644 --- a/test/unit/type/any-param.spec.ts +++ b/test/unit/type/any-param.spec.ts @@ -1,5 +1,5 @@ -import { AnyParam, Param } from "../../../src/main"; -import { hasType } from "../../helpers"; +import { AnyParam, Param } from "../../../src/main.js"; +import { hasType } from "../../helpers.js"; describe("AnyParam", () => { const a: Param<"a"> = { diff --git a/test/unit/type/normalize-param.spec.ts b/test/unit/type/normalize-param.spec.ts index 25f0d37..f4e09ea 100644 --- a/test/unit/type/normalize-param.spec.ts +++ b/test/unit/type/normalize-param.spec.ts @@ -1,5 +1,5 @@ -import { NormalizeParam, Param } from "../../../src/main"; -import { hasType } from "../../helpers"; +import { NormalizeParam, Param } from "../../../src/main.js"; +import { hasType } from "../../helpers.js"; describe("NormalizeParam", () => { it("should convert string types to Param types", () => { diff --git a/test/unit/type/param-arg.spec.ts b/test/unit/type/param-arg.spec.ts index 8274a82..1ac9f3c 100644 --- a/test/unit/type/param-arg.spec.ts +++ b/test/unit/type/param-arg.spec.ts @@ -1,5 +1,5 @@ -import { Param, ParamArg } from "../../../src/main"; -import { hasType } from "../../helpers"; +import { Param, ParamArg } from "../../../src/main.js"; +import { hasType } from "../../helpers.js"; describe("ParamArg", () => { const a: Param<"a"> = { diff --git a/test/unit/type/param-name.spec.ts b/test/unit/type/param-name.spec.ts index d699094..cd72ff3 100644 --- a/test/unit/type/param-name.spec.ts +++ b/test/unit/type/param-name.spec.ts @@ -1,5 +1,5 @@ -import { Param, ParamName } from "../../../src/main"; -import { hasType } from "../../helpers"; +import { Param, ParamName } from "../../../src/main.js"; +import { hasType } from "../../helpers.js"; describe("ParamName", () => { const a: Param<"a"> = { diff --git a/test/unit/type/param-or-string.spec.ts b/test/unit/type/param-or-string.spec.ts index 3441047..3e55edf 100644 --- a/test/unit/type/param-or-string.spec.ts +++ b/test/unit/type/param-or-string.spec.ts @@ -1,5 +1,5 @@ -import { Param, ParamOrString } from "../../../src/main"; -import { hasType } from "../../helpers"; +import { Param, ParamOrString } from "../../../src/main.js"; +import { hasType } from "../../helpers.js"; describe("ParamOrString", () => { const a: Param<"a"> = { diff --git a/test/unit/type/param.spec.ts b/test/unit/type/param.spec.ts index 774f2e3..3c4d7ad 100644 --- a/test/unit/type/param.spec.ts +++ b/test/unit/type/param.spec.ts @@ -1,4 +1,4 @@ -import { Param } from "../../../src/main"; +import { Param } from "../../../src/main.js"; describe("Param", () => { it("should not allow any properties to be modified", () => { diff --git a/test/unit/type/path-pattern.spec.ts b/test/unit/type/path-pattern.spec.ts index 99b1aa9..28b1a89 100644 --- a/test/unit/type/path-pattern.spec.ts +++ b/test/unit/type/path-pattern.spec.ts @@ -1,4 +1,4 @@ -import { path } from "../../../src/main"; +import { path } from "../../../src/main.js"; describe("PathPattern", () => { it("should not allow any properties to be modified", () => {