| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 9de9f71 commit e7f8f95
32 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -67,6 +67,7 @@ | |||
| 67 | 67 | "chalk": "^4.1.2", | |
| 68 | 68 | "del": "^6.1.1", | |
| 69 | 69 | "diff": "^5.1.0", | |
| 70 | + "esbuild": "^0.15.9", | ||
| 70 | 71 | "eslint": "^8.22.0", | |
| 71 | 72 | "eslint-formatter-autolinkable-stylish": "^1.2.0", | |
| 72 | 73 | "eslint-plugin-import": "^2.26.0", | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,7 +4,7 @@ import os from "os"; | |||
| 4 | 4 | const ci = ["1", "true"].includes(process.env.CI ?? ""); | |
| 5 | 5 | ||
| 6 | 6 | const parsed = minimist(process.argv.slice(2), { | |
| 7 | - boolean: ["dirty", "light", "colors", "lkg", "soft", "fix", "failed", "keepFailed", "force", "built", "ci"], | ||
| 7 | + boolean: ["dirty", "light", "colors", "lkg", "soft", "fix", "failed", "keepFailed", "force", "built", "ci", "bundle"], | ||
| 8 | 8 | string: ["browser", "tests", "break", "host", "reporter", "stackTraceLimit", "timeout", "shards", "shardId"], | |
| 9 | 9 | alias: { | |
| 10 | 10 | /* eslint-disable quote-props */ | |
@@ -39,6 +39,7 @@ const parsed = minimist(process.argv.slice(2), { | |||
| 39 | 39 | dirty: false, | |
| 40 | 40 | built: false, | |
| 41 | 41 | ci, | |
| 42 | + bundle: true | ||
| 42 | 43 | } | |
| 43 | 44 | }); | |
| 44 | 45 | ||
@@ -77,5 +78,7 @@ export default options; | |||
| 77 | 78 | * @property {boolean} ci | |
| 78 | 79 | * @property {string} shards | |
| 79 | 80 | * @property {string} shardId | |
| 81 | + * @property {string} break | ||
| 82 | + * @property {boolean} bundle | ||
| 80 | 83 | */ | |
| 81 | 84 | void 0; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,69 +1,57 @@ | |||
| 1 | 1 | import { exec, Debouncer } from "./utils.mjs"; | |
| 2 | 2 | import { resolve } from "path"; | |
| 3 | 3 | import { findUpRoot } from "./findUpDir.mjs"; | |
| 4 | - import assert from "assert"; | ||
| 4 | + import cmdLineOptions from "./options.mjs"; | ||
| 5 | 5 | ||
| 6 | 6 | class ProjectQueue { | |
| 7 | 7 | /** | |
| 8 | - * @param {(projects: string[], lkg: boolean, force: boolean) => Promise<any>} action | ||
| 8 | + * @param {(projects: string[]) => Promise<any>} action | ||
| 9 | 9 | */ | |
| 10 | 10 | constructor(action) { | |
| 11 | - /** @type {{ lkg: boolean, force: boolean, projects?: string[], debouncer: Debouncer }[]} */ | ||
| 12 | - this._debouncers = []; | ||
| 13 | - this._action = action; | ||
| 11 | + /** @type {string[] | undefined} */ | ||
| 12 | + this._projects = undefined; | ||
| 13 | + this._debouncer = new Debouncer(100, async () => { | ||
| 14 | + const projects = this._projects; | ||
| 15 | + if (projects) { | ||
| 16 | + this._projects = undefined; | ||
| 17 | + await action(projects); | ||
| 18 | + } | ||
| 19 | + }); | ||
| 14 | 20 | } | |
| 15 | 21 | ||
| 16 | 22 | /** | |
| 17 | 23 | * @param {string} project | |
| 18 | - * @param {{ lkg?: boolean; force?: boolean; }} options | ||
| 19 | 24 | */ | |
| 20 | - enqueue(project, { lkg = true, force = false } = {}) { | ||
| 21 | - let entry = this._debouncers.find(entry => entry.lkg === lkg && entry.force === force); | ||
| 22 | - if (!entry) { | ||
| 23 | - const debouncer = new Debouncer(100, async () => { | ||
| 24 | - assert(entry); | ||
| 25 | - const projects = entry.projects; | ||
| 26 | - if (projects) { | ||
| 27 | - entry.projects = undefined; | ||
| 28 | - await this._action(projects, lkg, force); | ||
| 29 | - } | ||
| 30 | - }); | ||
| 31 | - this._debouncers.push(entry = { lkg, force, debouncer }); | ||
| 32 | - } | ||
| 33 | - if (!entry.projects) entry.projects = []; | ||
| 34 | - entry.projects.push(project); | ||
| 35 | - return entry.debouncer.enqueue(); | ||
| 25 | + enqueue(project) { | ||
| 26 | + if (!this._projects) this._projects = []; | ||
| 27 | + this._projects.push(project); | ||
| 28 | + return this._debouncer.enqueue(); | ||
| 36 | 29 | } | |
| 37 | 30 | } | |
| 38 | 31 | ||
| 39 | - const execTsc = (/** @type {boolean} */ lkg, /** @type {string[]} */ ...args) => | ||
| 32 | + const execTsc = (/** @type {string[]} */ ...args) => | ||
| 40 | 33 | exec(process.execPath, | |
| 41 | - [resolve(findUpRoot(), lkg ? "./lib/tsc" : "./built/local/tsc"), | ||
| 34 | + [resolve(findUpRoot(), cmdLineOptions.lkg ? "./lib/tsc" : "./built/local/tsc"), | ||
| 42 | 35 | "-b", ...args], | |
| 43 | 36 | { hidePrompt: true }); | |
| 44 | 37 | ||
| 45 | - const projectBuilder = new ProjectQueue((projects, lkg, force) => execTsc(lkg, ...(force ? ["--force"] : []), ...projects)); | ||
| 38 | + const projectBuilder = new ProjectQueue((projects) => execTsc(...projects)); | ||
| 46 | 39 | ||
| 47 | 40 | /** | |
| 48 | 41 | * @param {string} project | |
| 49 | - * @param {object} options | ||
| 50 | - * @param {boolean} [options.lkg=true] | ||
| 51 | - * @param {boolean} [options.force=false] | ||
| 52 | 42 | */ | |
| 53 | - export const buildProject = (project, { lkg, force } = {}) => projectBuilder.enqueue(project, { lkg, force }); | ||
| 43 | + export const buildProject = (project) => projectBuilder.enqueue(project); | ||
| 54 | 44 | ||
| 55 | - const projectCleaner = new ProjectQueue((projects, lkg) => execTsc(lkg, "--clean", ...projects)); | ||
| 45 | + const projectCleaner = new ProjectQueue((projects) => execTsc("--clean", ...projects)); | ||
| 56 | 46 | ||
| 57 | 47 | /** | |
| 58 | 48 | * @param {string} project | |
| 59 | 49 | */ | |
| 60 | 50 | export const cleanProject = (project) => projectCleaner.enqueue(project); | |
| 61 | 51 | ||
| 62 | - const projectWatcher = new ProjectQueue((projects) => execTsc(/*lkg*/ true, "--watch", ...projects)); | ||
| 52 | + const projectWatcher = new ProjectQueue((projects) => execTsc("--watch", ...projects)); | ||
| 63 | 53 | ||
| 64 | 54 | /** | |
| 65 | 55 | * @param {string} project | |
| 66 | - * @param {object} options | ||
| 67 | - * @param {boolean} [options.lkg=true] | ||
| 68 | 56 | */ | |
| 69 | - export const watchProject = (project, { lkg } = {}) => projectWatcher.enqueue(project, { lkg }); | ||
| 57 | + export const watchProject = (project) => projectWatcher.enqueue(project); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -122,17 +122,17 @@ export async function runConsoleTests(runJs, defaultReporter, runInParallel, _wa | |||
| 122 | 122 | errorStatus = exitCode; | |
| 123 | 123 | error = new Error(`Process exited with status code ${errorStatus}.`); | |
| 124 | 124 | } | |
| 125 | - else if (cmdLineOptions.ci && runJs.startsWith("built")) { | ||
| 126 | - // finally, do a sanity check and build the compiler with the built version of itself | ||
| 127 | - log.info("Starting sanity check build..."); | ||
| 128 | - // Cleanup everything except lint rules (we'll need those later and would rather not waste time rebuilding them) | ||
| 129 | - await exec("gulp", ["clean-tsc", "clean-services", "clean-tsserver", "clean-lssl", "clean-tests"]); | ||
| 130 | - const { exitCode } = await exec("gulp", ["local", "--lkg=false"]); | ||
| 131 | - if (exitCode !== 0) { | ||
| 132 | - errorStatus = exitCode; | ||
| 133 | - error = new Error(`Sanity check build process exited with status code ${errorStatus}.`); | ||
| 134 | - } | ||
| 135 | - } | ||
| 125 | + // else if (cmdLineOptions.ci && runJs.startsWith("built")) { | ||
| 126 | + // // finally, do a sanity check and build the compiler with the built version of itself | ||
| 127 | + // log.info("Starting sanity check build..."); | ||
| 128 | + // // Cleanup everything except lint rules (we'll need those later and would rather not waste time rebuilding them) | ||
| 129 | + // await exec("gulp", ["clean-tsc", "clean-services", "clean-tsserver", "clean-lssl", "clean-tests"]); | ||
| 130 | + // const { exitCode } = await exec("gulp", ["local", "--lkg=false"]); | ||
| 131 | + // if (exitCode !== 0) { | ||
| 132 | + // errorStatus = exitCode; | ||
| 133 | + // error = new Error(`Sanity check build process exited with status code ${errorStatus}.`); | ||
| 134 | + // } | ||
| 135 | + // } | ||
| 136 | 136 | } | |
| 137 | 137 | catch (e) { | |
| 138 | 138 | errorStatus = undefined; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -30,6 +30,27 @@ async function copyLocalizedDiagnostics() { | |||
| 30 | 30 | const dir = await fs.readdir(source); | |
| 31 | 31 | const ignoredFolders = ["enu"]; | |
| 32 | 32 | ||
| 33 | + // TODO(jakebailey): Instead of ignoring folders, we should keep a list of | ||
| 34 | + // the localizationTargets somewhere that can be used by multiple modules. | ||
| 35 | + ignoredFolders.push( | ||
| 36 | + "compiler", | ||
| 37 | + "deprecatedCompat", | ||
| 38 | + "executeCommandLine", | ||
| 39 | + "harness", | ||
| 40 | + "jsTyping", | ||
| 41 | + "loggedIO", | ||
| 42 | + "server", | ||
| 43 | + "services", | ||
| 44 | + "testRunner", | ||
| 45 | + "tsc", | ||
| 46 | + "tsserver", | ||
| 47 | + "tsserverlibrary", | ||
| 48 | + "typescript", | ||
| 49 | + "typingsInstaller", | ||
| 50 | + "typingsInstallerCore", | ||
| 51 | + "webServer", | ||
| 52 | + ); | ||
| 53 | + | ||
| 33 | 54 | for (const d of dir) { | |
| 34 | 55 | const fileName = path.join(source, d); | |
| 35 | 56 | if ( | |
@@ -46,21 +67,18 @@ async function copyTypesMap() { | |||
| 46 | 67 | } | |
| 47 | 68 | ||
| 48 | 69 | async function copyScriptOutputs() { | |
| 49 | - await copyWithCopyright("cancellationToken.js"); | ||
| 50 | - await copyWithCopyright("tsc.release.js", "tsc.js"); | ||
| 51 | - await copyWithCopyright("tsserver.js"); | ||
| 52 | - await copyWithCopyright("dynamicImportCompat.js"); | ||
| 53 | - await copyFromBuiltLocal("tsserverlibrary.js"); // copyright added by build | ||
| 54 | - await copyFromBuiltLocal("typescript.js"); // copyright added by build | ||
| 55 | - await copyFromBuiltLocal("typescriptServices.js"); // copyright added by build | ||
| 56 | - await copyWithCopyright("typingsInstaller.js"); | ||
| 57 | - await copyWithCopyright("watchGuard.js"); | ||
| 70 | + await copyFromBuiltLocal("cancellationToken.js"); | ||
| 71 | + await copyFromBuiltLocal("tsc.js"); | ||
| 72 | + await copyFromBuiltLocal("tsserver.js"); | ||
| 73 | + await copyFromBuiltLocal("tsserverlibrary.js"); | ||
| 74 | + await copyFromBuiltLocal("typescript.js"); | ||
| 75 | + await copyFromBuiltLocal("typingsInstaller.js"); | ||
| 76 | + await copyFromBuiltLocal("watchGuard.js"); | ||
| 58 | 77 | } | |
| 59 | 78 | ||
| 60 | 79 | async function copyDeclarationOutputs() { | |
| 61 | - await copyFromBuiltLocal("tsserverlibrary.d.ts"); // copyright added by build | ||
| 62 | - await copyFromBuiltLocal("typescript.d.ts"); // copyright added by build | ||
| 63 | - await copyFromBuiltLocal("typescriptServices.d.ts"); // copyright added by build | ||
| 80 | + await copyWithCopyright("tsserverlibrary.d.ts"); | ||
| 81 | + await copyWithCopyright("typescript.d.ts"); | ||
| 64 | 82 | } | |
| 65 | 83 | ||
| 66 | 84 | async function writeGitAttributes() { | |
@@ -94,16 +112,6 @@ async function copyFilesWithGlob(pattern) { | |||
| 94 | 112 | console.log(`Copied ${files.length} files matching pattern ${pattern}`); | |
| 95 | 113 | } | |
| 96 | 114 | ||
| 97 | - /** | ||
| 98 | - * @param {string} path | ||
| 99 | - * @param {string[]} args | ||
| 100 | - */ | ||
| 101 | - async function exec(path, args = []) { | ||
| 102 | - const cmdLine = ["node", path, ...args].join(" "); | ||
| 103 | - console.log(cmdLine); | ||
| 104 | - childProcess.execSync(cmdLine); | ||
| 105 | - } | ||
| 106 | - | ||
| 107 | 115 | process.on("unhandledRejection", err => { | |
| 108 | 116 | throw err; | |
| 109 | 117 | }); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,7 +1,9 @@ | |||
| 1 | 1 | { | |
| 2 | 2 | "extends": "../tsconfig-base", | |
| 3 | 3 | "compilerOptions": { | |
| 4 | - "outDir": "../../built/local/cancellationToken", | ||
| 4 | + "outDir": "../../built/local", | ||
| 5 | + "tsBuildInfoFile": "../../built/local/cancellationToken.tsbuildinfo", | ||
| 6 | + "rootDir": ".", | ||
| 5 | 7 | "module": "commonjs", | |
| 6 | 8 | "types": [ | |
| 7 | 9 | "node" | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -721,7 +721,7 @@ export namespace Debug { | |||
| 721 | 721 | try { | |
| 722 | 722 | if (sys && sys.require) { | |
| 723 | 723 | const basePath = getDirectoryPath(resolvePath(sys.getExecutingFilePath())); | |
| 724 | - const result = sys.require(basePath, "./compiler-debug") as RequireResult<ExtendedDebugModule>; | ||
| 724 | + const result = sys.require(basePath, "./compilerDebug") as RequireResult<ExtendedDebugModule>; | ||
| 725 | 725 | if (!result.error) { | |
| 726 | 726 | result.module.init(ts); | |
| 727 | 727 | extendedDebugModule = result.module; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments