Skip to content

Commit 432b3e5

Browse files
authored
Release v1.1.1 (#4)
* hotfix: resolve urls * chore: add vitest tests * fix: url bug
1 parent 6db5533 commit 432b3e5

File tree

14 files changed

+413
-33
lines changed

14 files changed

+413
-33
lines changed

.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ VITE_TEST262_RAW_URL = "https://raw.githubusercontent.com/tc39/test262/3a7a72aef
22
VITE_TEST262_URL = "https://github.com/tc39/test262/blob/3a7a72aef5009eb22117231d40f9a5a66a9a595a/test/"
33
VITE_DOUBLE_DEBUGGER_URL = "https://es-meta.github.io/playground"
44
VITE_RESOURCE_URL = "https://raw.githubusercontent.com/es-meta/ecma-visualizer-resources/refs/heads/main/"
5-
VITE_EXTENSION_VERSION = "1.1"
5+
VITE_EXTENSION_VERSION = "1.1.1"
66
VITE_ESMETA_URL = "https://es-meta.github.io/"
77
VITE_ESMETA_GITHUB_URL = "https://github.com/es-meta/esmeta"
88
VITE_ENABLED_SPEC_URL = "https://tc39.es/ecma262/2024|https://262.ecma-international.org/15.0"

.github/workflows/ci.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: Set up Node.js
1717
uses: actions/setup-node@v4
1818
with:
19-
node-version: "22"
19+
node-version: 22
2020

2121
- name: Install dependencies
2222
run: npm ci
@@ -33,7 +33,7 @@ jobs:
3333
- name: Set up Node.js
3434
uses: actions/setup-node@v4
3535
with:
36-
node-version: "22"
36+
node-version: 22
3737

3838
- name: Install dependencies
3939
run: npm ci
@@ -44,3 +44,21 @@ jobs:
4444
- name: Check for uncommitted changes (formatting)
4545
run: |
4646
git diff --exit-code || (echo "❌ Code is not properly formatted. Run 'npm run format' and commit the changes." && exit 1)
47+
test:
48+
runs-on: ubuntu-latest
49+
50+
steps:
51+
- name: Checkout repository
52+
uses: actions/checkout@v4
53+
54+
- name: Set up Node.js
55+
uses: actions/setup-node@v4
56+
with:
57+
node-version: 22
58+
cache: "npm"
59+
60+
- name: Install dependencies
61+
run: npm ci
62+
63+
- name: Run tests
64+
run: npm run test

entrypoints/background/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default defineBackground(() => {
1212
targetWindowId: activeInfo.windowId,
1313
payload: {
1414
type: CUSTOM_IS_SUPPORTED,
15-
dataSupported: isUrlSupported(tab.url ?? ""),
15+
dataSupported: url.isSupportedSpec(tab.url ?? ""),
1616
},
1717
} satisfies Message);
1818
});
@@ -23,7 +23,7 @@ export default defineBackground(() => {
2323
targetWindowId: tab.windowId,
2424
payload: {
2525
type: CUSTOM_IS_SUPPORTED,
26-
dataSupported: isUrlSupported(changeInfo.url ?? ""),
26+
dataSupported: url.isSupportedSpec(changeInfo.url ?? ""),
2727
},
2828
} satisfies Message);
2929
}

entrypoints/content/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { showToast } from "./toast.utils";
88
const definition = defineContentScript({
99
matches: ["https://tc39.es/*", "https://262.ecma-international.org/*"],
1010
main() {
11-
if (!isUrlSupported(window.location.href)) return;
11+
if (!url.isSupportedSpec(window.location.href)) return;
1212
logger.log("content", import.meta.filename, "content script loaded");
1313
handleInit();
1414
logger.log("content", import.meta.filename, "transform done");

entrypoints/sidepanel/features/notify.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export function NotifyStrip() {
1717
).at(0);
1818
jotaiStore.set(
1919
currentTabSupported,
20-
isUrlSupported(currentTab?.url ?? ""),
20+
url.isSupportedSpec(currentTab?.url ?? ""),
2121
);
2222
});
2323
});

entrypoints/sidepanel/util/api.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@ type StepToNodeId = Record<string, number[]>;
88
type FeatureToProgId = Record<string, Record<string, [number, number]>>;
99
type FeatureToEncodedTest262 = Record<string, Record<string, string>>;
1010

11-
const BASE_URL = new URL(
12-
import.meta.env.VITE_EXTENSION_VERSION,
13-
new URL(import.meta.env.VITE_RESOURCE_URL),
14-
).href;
11+
const minorVersion = str.getAB(import.meta.env.VITE_EXTENSION_VERSION);
12+
13+
const BASE_URL = url.appendURL(minorVersion, import.meta.env.VITE_RESOURCE_URL);
1514

1615
async function _fetch<T>(url: string): Promise<T> {
1716
const response = await fetch(url);
@@ -30,7 +29,7 @@ async function fetchStepToNodeId(
3029
): Promise<number[]> {
3130
const funcId = await fetchFuncIdfromSecId(secId, map);
3231
const stepToNodeId = await _fetch<StepToNodeId>(
33-
new URL(`stepToNodeId/${funcId}.json`, BASE_URL).href,
32+
url.appendURL(`stepToNodeId/${funcId}.json`, BASE_URL),
3433
);
3534

3635
const result = stepToNodeId[step];
@@ -76,13 +75,13 @@ async function fetchMinimalScriptByNodeId(nodeId: number) {
7675

7776
async function fetchFNCByNodeId(nodeId: number) {
7877
return await _fetch<FeatureToProgId>(
79-
new URL(`nodeIdToProgId/${nodeId}.json`, BASE_URL).href,
78+
url.appendURL(`nodeIdToProgId/${nodeId}.json`, BASE_URL),
8079
);
8180
}
8281

8382
async function fetchTest262FNCByNodeId(nodeId: number) {
8483
return await _fetch<FeatureToEncodedTest262>(
85-
new URL(`nodeIdToTest262/${nodeId}.json`, BASE_URL).href,
84+
url.appendURL(`nodeIdToTest262/${nodeId}.json`, BASE_URL),
8685
);
8786
}
8887

@@ -92,7 +91,7 @@ async function fetchScriptByProgId(
9291
): Promise<[string, number]> {
9392
return [
9493
await _fetch<string>(
95-
new URL(`progIdToScript/${progId}.json`, BASE_URL).href,
94+
url.appendURL(`progIdToScript/${progId}.json`, BASE_URL),
9695
),
9796
stepCount,
9897
];

0 commit comments

Comments
 (0)