Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ jobs:
########

test:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
needs:
- build
strategy:
Expand All @@ -141,6 +141,10 @@ jobs:
node-version:
- '23.10.0'
# - latest reenable when https://github.com/nodejs/node/issues/57172 is fixed
os:
- ubuntu-latest
- windows-latest
- macos-latest
build-type:
- 'release'
- 'debug'
Expand All @@ -156,6 +160,7 @@ jobs:
uses: actions/cache/restore@v4
id: restore-starlingmonkey-jit-build
with:
enableCrossOsArchive: true
key: starlingmonkey-${{matrix.build-type}}-${{ steps.starlingmonkey-commit.outputs.STARLINGMONKEY_HASH }}
path: lib

Expand Down
24 changes: 22 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
},
"devDependencies": {
"@bytecodealliance/preview2-shim": "^0.17.1",
"cross-env": "^7.0.3",
"mocha": "^11.1.0"
},
"dependencies": {
Expand All @@ -31,8 +32,8 @@
"build:debug": "make debug",
"test": "mocha -u tdd test/test.js --timeout 120000",
"test:release": "mocha -u tdd test/test.js --timeout 120000",
"test:weval": "WEVAL_TEST=1 mocha -u tdd test/test.js --timeout 120000",
"test:debug": "DEBUG_TEST=1 mocha -u tdd test/test.js --timeout 120000",
"test:weval": "cross-env WEVAL_TEST=1 mocha -u tdd test/test.js --timeout 120000",
"test:debug": "cross-env DEBUG_TEST=1 mocha -u tdd test/test.js --timeout 120000",
"prepublishOnly": "npm run build"
},
"files": [
Expand All @@ -48,4 +49,4 @@
"workspaces": [
"."
]
}
}
17 changes: 13 additions & 4 deletions src/componentize.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,17 @@ const isWindows = platform === 'win32';

function maybeWindowsPath(path) {
if (!path) return path;
if (!isWindows) return resolve(path);
return '//?/' + resolve(path).replace(/\\/g, '/');
const resolvedPath = resolve(path);
if (!isWindows) return resolvedPath;

// Strip any existing UNC prefix check both the format we add as well as what
// the windows API returns when using path.resolve
let cleanPath = resolvedPath;
while (cleanPath.startsWith('\\\\?\\') || cleanPath.startsWith('//?/')) {
cleanPath = cleanPath.substring(4);
}

return '//?/' + cleanPath.replace(/\\/g, '/');
}

/**
Expand Down Expand Up @@ -108,7 +117,7 @@ export async function componentize(opts,
.slice(0, 12)
);
await mkdir(tmpDir);
const sourceDir = join(tmpDir, 'sources');
const sourceDir = maybeWindowsPath(join(tmpDir, 'sources'));
await mkdir(sourceDir);

let {
Expand Down Expand Up @@ -223,7 +232,7 @@ export async function componentize(opts,
console.log(env);
}

let initializerPath = join(sourceDir, 'initializer.js');
let initializerPath = maybeWindowsPath(join(sourceDir, 'initializer.js'));
sourcePath = maybeWindowsPath(sourcePath);
let workspacePrefix = dirname(sourcePath);

Expand Down
11 changes: 6 additions & 5 deletions test/cases/missing-export/test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { strictEqual } from 'node:assert';
import { match } from 'node:assert';

// use match instead of strictEqual to enable testing between linux and windows
// Windows errors prefix the error with file path
export function err(e) {
strictEqual(e.message, `Unable to extract expected exports list
Error: "missing-export.js" does not export a "expected" function as expected by the world.
Try defining it:
export function expected() {};`);
match(e.message, /Error: "missing-export.js" does not export a "expected" function/);
match(e.message, /Try defining it:/);
match(e.message, /export function expected\(\) {};/);
}