diff --git a/package.json b/package.json index e738d757d4d0b..09592ea4d6bc8 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "tsc-installer": "tsc -p ./src/install/tsconfig.json", "doc": "node utils/doclint/cli.js", "test-infra": "node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js && node utils/testrunner/test/test.js", - "lint": "npm run eslint && npm run tsc && npm run doc && npm run check-deps && npm run test-types && npm run test-infra", + "lint": "npm run eslint && npm run tsc && npm run doc && npm run check-deps && npm run generate-channels && npm run test-types && npm run test-infra", "debug-test": "node --inspect-brk test/test.js", "clean": "rimraf lib && rimraf types", "prepare": "node install-from-github.js", @@ -26,6 +26,7 @@ "watch": "node utils/runWebpack.js --mode='development' --watch --silent | tsc -w -p .", "test-types": "npm run generate-types && npx -p typescript@3.7.5 tsc -p utils/generate_types/test/tsconfig.json && npm run typecheck-tests", "generate-types": "node utils/generate_types/", + "generate-channels": "node utils/generate_channels.js", "typecheck-tests": "tsc -p ./test/", "roll-browser": "node utils/roll_browser.js", "jest": "jest", diff --git a/src/rpc/channels.ts b/src/rpc/channels.ts index 0a7dbbbcedae4..f89cb117b74c7 100644 --- a/src/rpc/channels.ts +++ b/src/rpc/channels.ts @@ -2034,7 +2034,7 @@ export type RouteAbortParams = { errorCode?: string, }; export type RouteAbortOptions = { - + errorCode?: string, }; export type RouteAbortResult = void; export type RouteContinueParams = { @@ -2064,7 +2064,13 @@ export type RouteFulfillParams = { isBase64?: boolean, }; export type RouteFulfillOptions = { - + status?: number, + headers?: { + name: string, + value: string, + }[], + body?: string, + isBase64?: boolean, }; export type RouteFulfillResult = void; diff --git a/utils/generate_channels.js b/utils/generate_channels.js index aecf1b792fadf..d70dacad95a00 100755 --- a/utils/generate_channels.js +++ b/utils/generate_channels.js @@ -229,5 +229,18 @@ validator_ts.push(` } `); -fs.writeFileSync(path.join(__dirname, '..', 'src', 'rpc', 'channels.ts'), channels_ts.join('\n'), 'utf-8'); -fs.writeFileSync(path.join(__dirname, '..', 'src', 'rpc', 'validator.ts'), validator_ts.join('\n'), 'utf-8'); +let hasChanges = false; + +function writeFile(filePath, content) { + const existing = fs.readFileSync(filePath, 'utf8'); + if (existing === content) + return; + hasChanges = true; + const root = path.join(__dirname, '..'); + console.log(`Writing //${path.relative(root, filePath)}`); + fs.writeFileSync(filePath, content, 'utf8'); +} + +writeFile(path.join(__dirname, '..', 'src', 'rpc', 'channels.ts'), channels_ts.join('\n')); +writeFile(path.join(__dirname, '..', 'src', 'rpc', 'validator.ts'), validator_ts.join('\n')); +process.exit(hasChanges ? 1 : 0);