Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
12 changes: 6 additions & 6 deletions packages/build-tools/package-lock.json

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

4 changes: 2 additions & 2 deletions packages/build-tools/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@spinframework/build-tools",
"version": "1.0.3",
"version": "1.0.4",
"description": "",
"main": "index.js",
"scripts": {
Expand Down Expand Up @@ -30,7 +30,7 @@
},
"dependencies": {
"@ampproject/remapping": "^2.3.0",
"@bytecodealliance/componentize-js": "^0.19.0",
"@bytecodealliance/componentize-js": "^0.19.2",
"@bytecodealliance/jco": "^1.10.2",
"acorn-walk": "^8.3.4",
"acron": "^1.0.5",
Expand Down
5 changes: 5 additions & 0 deletions packages/build-tools/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export interface CliArgs {
output: string;
aot?: boolean;
debug?: boolean;
initLocation?: string;
}

export function getCliArgs(): CliArgs {
Expand All @@ -30,6 +31,10 @@ export function getCliArgs(): CliArgs {
describe: 'Enable JavaScript debugging',
type: 'boolean',
})
.option('initLocation', {
describe: 'Location during top level initialization',
type: 'string',
})
.argv as CliArgs;

return args;
Expand Down
5 changes: 4 additions & 1 deletion packages/build-tools/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ async function main() {
let CliArgs = getCliArgs();
let src = CliArgs.input;
let outputPath = CliArgs.output;
let runtimeArgs = CliArgs.debug ? '--enable-script-debugging' : '';
let runtimeArgs = [
CliArgs.debug && '--enable-script-debugging',
CliArgs.initLocation && `--init-location ${CliArgs.initLocation}`
].filter(Boolean).join(' ');

// generate wit world string
let wasiDeps = getPackagesWithWasiDeps(process.cwd(), new Set(), true);
Expand Down
4 changes: 2 additions & 2 deletions test/test-app/package-lock.json

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

2 changes: 1 addition & 1 deletion test/test-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"keywords": [],
"license": "Apache-2.0",
"scripts": {
"build": "node build.mjs && mkdirp dist && j2w -i build/bundle.js -o dist/test-app.wasm",
"build": "node build.mjs && mkdirp dist && j2w -i build/bundle.js -o dist/test-app.wasm --initLocation http://foo.bar",
"test": "echo \"Error: no test specified\" && exit 1"
},
"devDependencies": {
Expand Down
7 changes: 7 additions & 0 deletions test/test-app/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import { AutoRouter } from "itty-router"
import { headersTest, health, kvTest, kvTestUint8Array, outboundHttp, statusTest, stream, streamTest, testFunctionality } from "./test";

// Verify top level init location
if (globalThis.location.href != "http://foo.bar/") {
throw new Error(`Expected top-level init location to be "top-level", got "${globalThis.location}"`);
} else {
console.log("Top-level init location verified:", globalThis.location.href);
}

let router = AutoRouter()

router.get("/health", health)
Expand Down