mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
build: typecheck the Electron lib tree with tsgo during ninja
Adds a GN typescript_check template that runs tsgo --noEmit over a
tsconfig and writes a stamp file on success, wired into BUILD.gn as
electron_lib_typecheck. electron_js2c depends on it so a broken type
in lib/ fails 'e build'.
tsgo (@typescript/native-preview, the Go-based TypeScript compiler
preview) runs the full lib/ typecheck in ~400ms, about 6x faster than
tsc 6.0.2 (~2.3s). ts-loader previously typechecked implicitly inside
webpack and was removed in the esbuild migration, so this restores
typecheck coverage that was briefly absent on the bundle build path.
Because tsgo has no 'ignoreDiagnostics' option like ts-loader's, the
previously-silenced TS6059 and TS1111 errors needed to be fixed
properly:
- tsconfig.electron.json drops 'rootDir: "lib"'. It was only
meaningful for emit, and the TS 6 implicit rootDir inference plus
the @node/* path alias was pulling Node's internal .js files
(specifically internal/url.js with its #searchParams brand check)
into the program.
- tsconfig.json drops the @node/* path alias entirely. Every call
site that used 'as typeof import("@node/lib/...")' is replaced
with narrow structural types declared once in an ambient
NodeInternalModules interface in typings/internal-ambient.d.ts.
__non_webpack_require__ becomes an overloaded function that picks
the right return type from a string-literal id argument, so call
sites no longer need 'as' casts.
- tsconfig.default_app.json: moduleResolution 'node' -> 'bundler'
(TS 6 deprecates 'node').
- typings/internal-ambient.d.ts: 'declare module NodeJS { }' ->
'declare namespace NodeJS { }' (TS 6 rejects the module keyword
for non-external declarations).
spec/ts-smoke/runner.js now invokes tsgo's bin instead of resolving
the 'typescript' package. The 'tsc' npm script is repointed from
'tsc' to 'tsgo' so the existing CI step
'node script/yarn.js tsc -p tsconfig.script.json' continues to run.
A small script/typecheck.js wrapper runs tsgo and writes the stamp
file for GN; the typescript_check template invokes it via a new
'tsc-check' npm script.
This commit is contained in:
7
BUILD.gn
7
BUILD.gn
@@ -162,6 +162,12 @@ npm_action("build_electron_definitions") {
|
||||
outputs = [ "$target_gen_dir/tsc/typings/electron.d.ts" ]
|
||||
}
|
||||
|
||||
typescript_check("electron_lib_typecheck") {
|
||||
deps = [ ":build_electron_definitions" ]
|
||||
tsconfig = "//electron/tsconfig.electron.json"
|
||||
sources = auto_filenames.typecheck_sources
|
||||
}
|
||||
|
||||
esbuild_build("electron_browser_bundle") {
|
||||
deps = [ ":build_electron_definitions" ]
|
||||
|
||||
@@ -238,6 +244,7 @@ action("electron_js2c") {
|
||||
deps = [
|
||||
":electron_browser_bundle",
|
||||
":electron_isolated_renderer_bundle",
|
||||
":electron_lib_typecheck",
|
||||
":electron_node_bundle",
|
||||
":electron_preload_realm_bundle",
|
||||
":electron_renderer_bundle",
|
||||
|
||||
@@ -1,5 +1,42 @@
|
||||
import("npm.gni")
|
||||
|
||||
# Runs `tsgo --noEmit` over a tsconfig via the `tsc-check` npm script (which
|
||||
# wraps script/typecheck.js) and writes a stamp on success. Use this to gate
|
||||
# downstream targets on a successful typecheck without emitting JS.
|
||||
template("typescript_check") {
|
||||
assert(defined(invoker.tsconfig), "Need tsconfig name to run")
|
||||
assert(defined(invoker.sources), "Need tsc sources to run")
|
||||
|
||||
npm_action(target_name) {
|
||||
forward_variables_from(invoker,
|
||||
[
|
||||
"deps",
|
||||
"public_deps",
|
||||
])
|
||||
script = "tsc-check"
|
||||
|
||||
sources = invoker.sources
|
||||
inputs = [
|
||||
invoker.tsconfig,
|
||||
"//electron/tsconfig.json",
|
||||
"//electron/yarn.lock",
|
||||
"//electron/script/typecheck.js",
|
||||
"//electron/typings/internal-ambient.d.ts",
|
||||
"//electron/typings/internal-electron.d.ts",
|
||||
]
|
||||
|
||||
stamp_file = "$target_gen_dir/$target_name.stamp"
|
||||
outputs = [ stamp_file ]
|
||||
|
||||
args = [
|
||||
"--tsconfig",
|
||||
rebase_path(invoker.tsconfig),
|
||||
"--stamp",
|
||||
rebase_path(stamp_file),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
template("typescript_build") {
|
||||
assert(defined(invoker.tsconfig), "Need tsconfig name to run")
|
||||
assert(defined(invoker.sources), "Need tsc sources to run")
|
||||
|
||||
@@ -174,6 +174,131 @@ auto_filenames = {
|
||||
"docs/api/structures/window-session-end-event.md",
|
||||
]
|
||||
|
||||
typecheck_sources = [
|
||||
"build/esbuild/shims/browser-globals-shim.js",
|
||||
"build/esbuild/shims/node-globals-shim.js",
|
||||
"build/esbuild/shims/promise-shim.js",
|
||||
"lib/browser/api/app.ts",
|
||||
"lib/browser/api/auto-updater.ts",
|
||||
"lib/browser/api/auto-updater/auto-updater-msix.ts",
|
||||
"lib/browser/api/auto-updater/auto-updater-native.ts",
|
||||
"lib/browser/api/auto-updater/auto-updater-win.ts",
|
||||
"lib/browser/api/auto-updater/msix-update-win.ts",
|
||||
"lib/browser/api/auto-updater/squirrel-update-win.ts",
|
||||
"lib/browser/api/base-window.ts",
|
||||
"lib/browser/api/browser-view.ts",
|
||||
"lib/browser/api/browser-window.ts",
|
||||
"lib/browser/api/clipboard.ts",
|
||||
"lib/browser/api/content-tracing.ts",
|
||||
"lib/browser/api/crash-reporter.ts",
|
||||
"lib/browser/api/desktop-capturer.ts",
|
||||
"lib/browser/api/dialog.ts",
|
||||
"lib/browser/api/exports/electron.ts",
|
||||
"lib/browser/api/global-shortcut.ts",
|
||||
"lib/browser/api/in-app-purchase.ts",
|
||||
"lib/browser/api/ipc-main.ts",
|
||||
"lib/browser/api/menu-item-roles.ts",
|
||||
"lib/browser/api/menu-item.ts",
|
||||
"lib/browser/api/menu-utils.ts",
|
||||
"lib/browser/api/menu.ts",
|
||||
"lib/browser/api/message-channel.ts",
|
||||
"lib/browser/api/module-list.ts",
|
||||
"lib/browser/api/native-theme.ts",
|
||||
"lib/browser/api/net-fetch.ts",
|
||||
"lib/browser/api/net-log.ts",
|
||||
"lib/browser/api/net.ts",
|
||||
"lib/browser/api/notification.ts",
|
||||
"lib/browser/api/power-monitor.ts",
|
||||
"lib/browser/api/power-save-blocker.ts",
|
||||
"lib/browser/api/protocol.ts",
|
||||
"lib/browser/api/push-notifications.ts",
|
||||
"lib/browser/api/safe-storage.ts",
|
||||
"lib/browser/api/screen.ts",
|
||||
"lib/browser/api/service-worker-main.ts",
|
||||
"lib/browser/api/session.ts",
|
||||
"lib/browser/api/share-menu.ts",
|
||||
"lib/browser/api/shared-texture.ts",
|
||||
"lib/browser/api/system-preferences.ts",
|
||||
"lib/browser/api/touch-bar.ts",
|
||||
"lib/browser/api/tray.ts",
|
||||
"lib/browser/api/utility-process.ts",
|
||||
"lib/browser/api/view.ts",
|
||||
"lib/browser/api/views/image-view.ts",
|
||||
"lib/browser/api/web-contents-view.ts",
|
||||
"lib/browser/api/web-contents.ts",
|
||||
"lib/browser/api/web-frame-main.ts",
|
||||
"lib/browser/default-menu.ts",
|
||||
"lib/browser/devtools.ts",
|
||||
"lib/browser/guest-view-manager.ts",
|
||||
"lib/browser/guest-window-manager.ts",
|
||||
"lib/browser/init.ts",
|
||||
"lib/browser/ipc-dispatch.ts",
|
||||
"lib/browser/ipc-main-impl.ts",
|
||||
"lib/browser/ipc-main-internal-utils.ts",
|
||||
"lib/browser/ipc-main-internal.ts",
|
||||
"lib/browser/message-port-main.ts",
|
||||
"lib/browser/parse-features-string.ts",
|
||||
"lib/browser/rpc-server.ts",
|
||||
"lib/browser/web-view-events.ts",
|
||||
"lib/common/api/module-list.ts",
|
||||
"lib/common/api/native-image.ts",
|
||||
"lib/common/api/net-client-request.ts",
|
||||
"lib/common/api/shell.ts",
|
||||
"lib/common/define-properties.ts",
|
||||
"lib/common/deprecate.ts",
|
||||
"lib/common/init.ts",
|
||||
"lib/common/ipc-messages.ts",
|
||||
"lib/common/timers-shim.ts",
|
||||
"lib/common/web-view-methods.ts",
|
||||
"lib/isolated_renderer/init.ts",
|
||||
"lib/node/asar-fs-wrapper.ts",
|
||||
"lib/node/init.ts",
|
||||
"lib/preload_realm/api/exports/electron.ts",
|
||||
"lib/preload_realm/api/module-list.ts",
|
||||
"lib/preload_realm/init.ts",
|
||||
"lib/renderer/api/clipboard.ts",
|
||||
"lib/renderer/api/context-bridge.ts",
|
||||
"lib/renderer/api/crash-reporter.ts",
|
||||
"lib/renderer/api/exports/electron.ts",
|
||||
"lib/renderer/api/ipc-renderer.ts",
|
||||
"lib/renderer/api/module-list.ts",
|
||||
"lib/renderer/api/shared-texture.ts",
|
||||
"lib/renderer/api/web-frame.ts",
|
||||
"lib/renderer/api/web-utils.ts",
|
||||
"lib/renderer/common-init.ts",
|
||||
"lib/renderer/init.ts",
|
||||
"lib/renderer/inspector.ts",
|
||||
"lib/renderer/ipc-native-setup.ts",
|
||||
"lib/renderer/ipc-renderer-bindings.ts",
|
||||
"lib/renderer/ipc-renderer-internal-utils.ts",
|
||||
"lib/renderer/ipc-renderer-internal.ts",
|
||||
"lib/renderer/security-warnings.ts",
|
||||
"lib/renderer/web-frame-init.ts",
|
||||
"lib/renderer/web-view/guest-view-internal.ts",
|
||||
"lib/renderer/web-view/web-view-attributes.ts",
|
||||
"lib/renderer/web-view/web-view-constants.ts",
|
||||
"lib/renderer/web-view/web-view-element.ts",
|
||||
"lib/renderer/web-view/web-view-impl.ts",
|
||||
"lib/renderer/web-view/web-view-init.ts",
|
||||
"lib/renderer/window-setup.ts",
|
||||
"lib/sandboxed_renderer/api/exports/electron.ts",
|
||||
"lib/sandboxed_renderer/api/module-list.ts",
|
||||
"lib/sandboxed_renderer/init.ts",
|
||||
"lib/sandboxed_renderer/pre-init.ts",
|
||||
"lib/sandboxed_renderer/preload.ts",
|
||||
"lib/utility/api/exports/electron.ts",
|
||||
"lib/utility/api/module-list.ts",
|
||||
"lib/utility/api/net.ts",
|
||||
"lib/utility/init.ts",
|
||||
"lib/utility/parent-port.ts",
|
||||
"lib/worker/init.ts",
|
||||
"package.json",
|
||||
"tsconfig.electron.json",
|
||||
"tsconfig.json",
|
||||
"typings/internal-ambient.d.ts",
|
||||
"typings/internal-electron.d.ts",
|
||||
]
|
||||
|
||||
sandbox_bundle_deps = [
|
||||
"build/esbuild/shims/browser-globals-shim.js",
|
||||
"build/esbuild/shims/promise-shim.js",
|
||||
|
||||
@@ -181,7 +181,7 @@ delete process.appCodeLoaded;
|
||||
if (packagePath) {
|
||||
// Finally load app's main.js and transfer control to C++.
|
||||
if ((packageJson.type === 'module' && !mainStartupScript.endsWith('.cjs')) || mainStartupScript.endsWith('.mjs')) {
|
||||
const { runEntryPointWithESMLoader } = __non_webpack_require__('internal/modules/run_main') as typeof import('@node/lib/internal/modules/run_main');
|
||||
const { runEntryPointWithESMLoader } = __non_webpack_require__('internal/modules/run_main');
|
||||
const main = (require('url') as typeof url).pathToFileURL(path.join(packagePath, mainStartupScript));
|
||||
runEntryPointWithESMLoader(async (cascadedLoader: any) => {
|
||||
try {
|
||||
|
||||
@@ -52,20 +52,20 @@ const {
|
||||
getValidatedPath,
|
||||
getOptions,
|
||||
getDirent
|
||||
} = __non_webpack_require__('internal/fs/utils') as typeof import('@node/lib/internal/fs/utils');
|
||||
} = __non_webpack_require__('internal/fs/utils');
|
||||
|
||||
const {
|
||||
assignFunctionName
|
||||
} = __non_webpack_require__('internal/util') as typeof import('@node/lib/internal/util');
|
||||
} = __non_webpack_require__('internal/util');
|
||||
|
||||
const {
|
||||
validateBoolean,
|
||||
validateFunction
|
||||
} = __non_webpack_require__('internal/validators') as typeof import('@node/lib/internal/validators');
|
||||
} = __non_webpack_require__('internal/validators');
|
||||
|
||||
// In the renderer node internals use the node global URL but we do not set that to be
|
||||
// the global URL instance. We need to do instanceof checks against the internal URL impl
|
||||
const { URL: NodeURL } = __non_webpack_require__('internal/url') as typeof import('@node/lib/internal/url');
|
||||
// the global URL instance. We need to do instanceof checks against the internal URL impl.
|
||||
const { URL: NodeURL } = __non_webpack_require__('internal/url');
|
||||
|
||||
// Separate asar package's path from full path.
|
||||
const splitPath = (archivePathOrBuffer: string | Buffer | URL) => {
|
||||
|
||||
@@ -66,9 +66,9 @@ require('@electron/internal/renderer/common-init');
|
||||
|
||||
if (nodeIntegration) {
|
||||
// Export node bindings to global.
|
||||
const { makeRequireFunction } = __non_webpack_require__('internal/modules/helpers') as typeof import('@node/lib/internal/modules/helpers');
|
||||
const { makeRequireFunction } = __non_webpack_require__('internal/modules/helpers');
|
||||
global.module = new Module('electron/js2c/renderer_init');
|
||||
global.require = makeRequireFunction(global.module) as NodeRequire;
|
||||
global.require = makeRequireFunction(global.module);
|
||||
|
||||
// Set the __filename to the path of html file if it is file: protocol.
|
||||
if (window.location.protocol === 'file:') {
|
||||
@@ -153,7 +153,7 @@ if (cjsPreloads.length) {
|
||||
}
|
||||
}
|
||||
if (esmPreloads.length) {
|
||||
const { runEntryPointWithESMLoader } = __non_webpack_require__('internal/modules/run_main') as typeof import('@node/lib/internal/modules/run_main');
|
||||
const { runEntryPointWithESMLoader } = __non_webpack_require__('internal/modules/run_main');
|
||||
|
||||
runEntryPointWithESMLoader(async (cascadedLoader: any) => {
|
||||
// Load the preload scripts.
|
||||
|
||||
@@ -36,7 +36,7 @@ parentPort.on('removeListener', (name: string) => {
|
||||
});
|
||||
|
||||
// Finally load entry script.
|
||||
const { runEntryPointWithESMLoader } = __non_webpack_require__('internal/modules/run_main') as typeof import('@node/lib/internal/modules/run_main');
|
||||
const { runEntryPointWithESMLoader } = __non_webpack_require__('internal/modules/run_main');
|
||||
const mainEntry = pathToFileURL(entryScript);
|
||||
|
||||
runEntryPointWithESMLoader(async (cascadedLoader: any) => {
|
||||
|
||||
@@ -13,9 +13,9 @@ require('@electron/internal/common/init');
|
||||
const { hasSwitch, getSwitchValue } = process._linkedBinding('electron_common_command_line');
|
||||
|
||||
// Export node bindings to global.
|
||||
const { makeRequireFunction } = __non_webpack_require__('internal/modules/helpers') as typeof import('@node/lib/internal/modules/helpers');
|
||||
const { makeRequireFunction } = __non_webpack_require__('internal/modules/helpers');
|
||||
global.module = new Module('electron/js2c/worker_init');
|
||||
global.require = makeRequireFunction(global.module) as NodeRequire;
|
||||
global.require = makeRequireFunction(global.module);
|
||||
|
||||
// See WebWorkerObserver::WorkerScriptReadyForEvaluation.
|
||||
if ((globalThis as any).blinkfetch) {
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
"@types/temp": "^0.9.4",
|
||||
"@typescript-eslint/eslint-plugin": "^8.32.1",
|
||||
"@typescript-eslint/parser": "^8.7.0",
|
||||
"@typescript/native-preview": "^7.0.0-dev.20260324.1",
|
||||
"@xmldom/xmldom": "^0.8.11",
|
||||
"buffer": "^6.0.3",
|
||||
"chalk": "^4.1.0",
|
||||
@@ -89,7 +90,8 @@
|
||||
"repl": "node ./script/start.js --interactive",
|
||||
"start": "node ./script/start.js",
|
||||
"test": "node ./script/spec-runner.js",
|
||||
"tsc": "tsc",
|
||||
"tsc": "tsgo",
|
||||
"tsc-check": "node script/typecheck.js",
|
||||
"bundle": "node build/esbuild/bundle.js"
|
||||
},
|
||||
"license": "MIT",
|
||||
|
||||
@@ -60,6 +60,15 @@ const main = async () => {
|
||||
};
|
||||
}));
|
||||
|
||||
// The typecheck step runs tsgo over tsconfig.electron.json which includes
|
||||
// the whole lib/ + typings/ trees. For GN dependency tracking, list the
|
||||
// union of every bundle's dependency set (lib files) plus typings, and
|
||||
// dedupe.
|
||||
const typecheckSources = Array.from(new Set([
|
||||
...targetsWithDeps.flatMap(t => t.dependencies),
|
||||
...typingFiles
|
||||
])).sort();
|
||||
|
||||
fs.writeFileSync(
|
||||
gniPath,
|
||||
`# THIS FILE IS AUTO-GENERATED, PLEASE DO NOT EDIT BY HAND
|
||||
@@ -68,6 +77,10 @@ auto_filenames = {
|
||||
${allDocs.map(doc => ` "${doc}",`).join('\n')}
|
||||
]
|
||||
|
||||
typecheck_sources = [
|
||||
${typecheckSources.map(src => ` "${src}",`).join('\n')}
|
||||
]
|
||||
|
||||
${targetsWithDeps.map(target => ` ${target.name} = [
|
||||
${target.dependencies.map(dep => ` "${dep}",`).join('\n')}
|
||||
]`).join('\n\n')}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Octokit } from '@octokit/rest';
|
||||
|
||||
import * as assert from 'node:assert';
|
||||
import { strict as assert } from 'node:assert';
|
||||
|
||||
import { createGitHubTokenStrategy } from './github-token';
|
||||
import { ELECTRON_ORG, ELECTRON_REPO } from './types';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as minimist from 'minimist';
|
||||
import * as streamChain from 'stream-chain';
|
||||
import * as streamJson from 'stream-json';
|
||||
import minimist = require('minimist');
|
||||
import streamChain = require('stream-chain');
|
||||
import streamJson = require('stream-json');
|
||||
import { ignore as streamJsonIgnore } from 'stream-json/filters/Ignore';
|
||||
import { streamArray as streamJsonStreamArray } from 'stream-json/streamers/StreamArray';
|
||||
|
||||
|
||||
58
script/typecheck.js
Normal file
58
script/typecheck.js
Normal file
@@ -0,0 +1,58 @@
|
||||
#!/usr/bin/env node
|
||||
// Runs `tsgo --noEmit -p <tsconfig>` and writes a stamp file on success,
|
||||
// so GN can track typecheck results as a build output.
|
||||
//
|
||||
// Usage: node script/typecheck.js --tsconfig <path> --stamp <path>
|
||||
|
||||
'use strict';
|
||||
|
||||
const cp = require('node:child_process');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
|
||||
function parseArgs (argv) {
|
||||
const out = {};
|
||||
for (let i = 0; i < argv.length; i++) {
|
||||
const a = argv[i];
|
||||
if (a.startsWith('--')) {
|
||||
const next = argv[i + 1];
|
||||
if (next === undefined || next.startsWith('--')) {
|
||||
out[a.slice(2)] = true;
|
||||
} else {
|
||||
out[a.slice(2)] = next;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
const args = parseArgs(process.argv.slice(2));
|
||||
if (!args.tsconfig || !args.stamp) {
|
||||
console.error('Usage: typecheck.js --tsconfig <path> --stamp <path>');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const electronRoot = path.resolve(__dirname, '..');
|
||||
// Resolve tsgo's bin entry directly from the package's `bin` map and run it
|
||||
// via the current Node executable. We can't `require.resolve` the bin path
|
||||
// (the package's `exports` field doesn't expose it) and we can't spawn
|
||||
// `node_modules/.bin/tsgo` directly on Windows (it's a `.cmd` shim).
|
||||
const tsgoPkgPath = require.resolve('@typescript/native-preview/package.json', {
|
||||
paths: [electronRoot]
|
||||
});
|
||||
const tsgoPkg = JSON.parse(fs.readFileSync(tsgoPkgPath, 'utf8'));
|
||||
const tsgoEntry = path.resolve(path.dirname(tsgoPkgPath), tsgoPkg.bin.tsgo);
|
||||
|
||||
const child = cp.spawnSync(
|
||||
process.execPath,
|
||||
[tsgoEntry, '--noEmit', '-p', path.resolve(args.tsconfig)],
|
||||
{ cwd: electronRoot, stdio: 'inherit' }
|
||||
);
|
||||
|
||||
if (child.status !== 0) {
|
||||
process.exit(child.status || 1);
|
||||
}
|
||||
|
||||
fs.mkdirSync(path.dirname(args.stamp), { recursive: true });
|
||||
fs.writeFileSync(args.stamp, '');
|
||||
@@ -2,8 +2,8 @@ const childProcess = require('node:child_process');
|
||||
const path = require('node:path');
|
||||
|
||||
const typeCheck = () => {
|
||||
const tscExec = path.resolve(require.resolve('typescript'), '../../bin/tsc');
|
||||
const tscChild = childProcess.spawn(process.execPath, [tscExec, '--project', './ts-smoke/tsconfig.json'], {
|
||||
const tsgoExec = path.resolve(require.resolve('@typescript/native-preview/package.json'), '..', 'bin', 'tsgo.js');
|
||||
const tscChild = childProcess.spawn(process.execPath, [tsgoExec, '--project', './ts-smoke/tsconfig.json'], {
|
||||
cwd: path.resolve(__dirname, '../')
|
||||
});
|
||||
tscChild.stdout.on('data', d => console.log(d.toString()));
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"compilerOptions": {
|
||||
"rootDir": "default_app",
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "node"
|
||||
"moduleResolution": "bundler"
|
||||
},
|
||||
"include": [
|
||||
"default_app",
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"rootDir": "lib"
|
||||
// rootDir intentionally omitted: some lib/ files pull type declarations
|
||||
// out of ../third_party/electron_node via the `@node/*` path alias (see
|
||||
// lib/node/asar-fs-wrapper.ts) and a rootDir of 'lib' rejects those
|
||||
// as outside-rootDir imports.
|
||||
},
|
||||
"include": [
|
||||
"lib",
|
||||
|
||||
@@ -10,14 +10,12 @@
|
||||
"sourceMap": true,
|
||||
"experimentalDecorators": true,
|
||||
"strict": true,
|
||||
"baseUrl": ".",
|
||||
"allowJs": true,
|
||||
"noUnusedLocals": true,
|
||||
"outDir": "ts-gen",
|
||||
"typeRoots" : ["./node_modules/@types", "./spec/node_modules/@types"],
|
||||
"paths": {
|
||||
"@electron/internal/*": ["lib/*"],
|
||||
"@node/*": ["../third_party/electron_node/*"]
|
||||
"@electron/internal/*": ["./lib/*"]
|
||||
}
|
||||
},
|
||||
"exclude": [
|
||||
|
||||
32
typings/internal-ambient.d.ts
vendored
32
typings/internal-ambient.d.ts
vendored
@@ -3,8 +3,34 @@ declare const BUILDFLAG: (flag: boolean) => boolean;
|
||||
// esbuild build/esbuild/bundle.js rewrites calls to this identifier into
|
||||
// literal `require()` calls so that consumers can reach Node internal modules
|
||||
// (e.g. 'internal/modules/helpers') without the bundler trying to resolve
|
||||
// them. It must therefore be declared as a bare function.
|
||||
declare const __non_webpack_require__: (id: any) => unknown;
|
||||
// them. Overloads below pin the known internal-module IDs to narrow types;
|
||||
// the final catch-all signature keeps less-common paths usable at the cost
|
||||
// of no static type information.
|
||||
interface NodeInternalModules {
|
||||
'internal/modules/helpers': {
|
||||
makeRequireFunction: (mod: NodeModule) => NodeRequire;
|
||||
};
|
||||
'internal/modules/run_main': {
|
||||
runEntryPointWithESMLoader: (cb: (cascadedLoader: any) => any) => Promise<void>;
|
||||
};
|
||||
'internal/fs/utils': {
|
||||
getValidatedPath: (path: any, ...args: any[]) => string;
|
||||
getOptions: (options: any, defaultOptions?: any) => any;
|
||||
getDirent: (path: string, name: string | Buffer, type: number, callback?: Function) => any;
|
||||
};
|
||||
'internal/util': {
|
||||
assignFunctionName: (name: string | symbol, fn: Function) => Function;
|
||||
};
|
||||
'internal/validators': {
|
||||
validateBoolean: (value: unknown, name: string) => asserts value is boolean;
|
||||
validateFunction: (value: unknown, name: string) => void;
|
||||
};
|
||||
'internal/url': {
|
||||
URL: typeof URL;
|
||||
};
|
||||
}
|
||||
declare function __non_webpack_require__<K extends keyof NodeInternalModules>(id: K): NodeInternalModules[K];
|
||||
declare function __non_webpack_require__(id: string): unknown;
|
||||
|
||||
declare namespace NodeJS {
|
||||
interface ModuleInternal extends NodeJS.Module {
|
||||
@@ -286,7 +312,7 @@ declare namespace NodeJS {
|
||||
}
|
||||
}
|
||||
|
||||
declare module NodeJS {
|
||||
declare namespace NodeJS {
|
||||
interface Global {
|
||||
require: NodeRequire;
|
||||
module: NodeModule;
|
||||
|
||||
115
yarn.lock
115
yarn.lock
@@ -585,6 +585,7 @@ __metadata:
|
||||
"@types/temp": "npm:^0.9.4"
|
||||
"@typescript-eslint/eslint-plugin": "npm:^8.32.1"
|
||||
"@typescript-eslint/parser": "npm:^8.7.0"
|
||||
"@typescript/native-preview": "npm:^7.0.0-dev.20260324.1"
|
||||
"@xmldom/xmldom": "npm:^0.8.11"
|
||||
buffer: "npm:^6.0.3"
|
||||
chalk: "npm:^4.1.0"
|
||||
@@ -2594,6 +2595,87 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@typescript/native-preview-darwin-arm64@npm:7.0.0-dev.20260328.1":
|
||||
version: 7.0.0-dev.20260328.1
|
||||
resolution: "@typescript/native-preview-darwin-arm64@npm:7.0.0-dev.20260328.1"
|
||||
conditions: os=darwin & cpu=arm64
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@typescript/native-preview-darwin-x64@npm:7.0.0-dev.20260328.1":
|
||||
version: 7.0.0-dev.20260328.1
|
||||
resolution: "@typescript/native-preview-darwin-x64@npm:7.0.0-dev.20260328.1"
|
||||
conditions: os=darwin & cpu=x64
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@typescript/native-preview-linux-arm64@npm:7.0.0-dev.20260328.1":
|
||||
version: 7.0.0-dev.20260328.1
|
||||
resolution: "@typescript/native-preview-linux-arm64@npm:7.0.0-dev.20260328.1"
|
||||
conditions: os=linux & cpu=arm64
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@typescript/native-preview-linux-arm@npm:7.0.0-dev.20260328.1":
|
||||
version: 7.0.0-dev.20260328.1
|
||||
resolution: "@typescript/native-preview-linux-arm@npm:7.0.0-dev.20260328.1"
|
||||
conditions: os=linux & cpu=arm
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@typescript/native-preview-linux-x64@npm:7.0.0-dev.20260328.1":
|
||||
version: 7.0.0-dev.20260328.1
|
||||
resolution: "@typescript/native-preview-linux-x64@npm:7.0.0-dev.20260328.1"
|
||||
conditions: os=linux & cpu=x64
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@typescript/native-preview-win32-arm64@npm:7.0.0-dev.20260328.1":
|
||||
version: 7.0.0-dev.20260328.1
|
||||
resolution: "@typescript/native-preview-win32-arm64@npm:7.0.0-dev.20260328.1"
|
||||
conditions: os=win32 & cpu=arm64
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@typescript/native-preview-win32-x64@npm:7.0.0-dev.20260328.1":
|
||||
version: 7.0.0-dev.20260328.1
|
||||
resolution: "@typescript/native-preview-win32-x64@npm:7.0.0-dev.20260328.1"
|
||||
conditions: os=win32 & cpu=x64
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@typescript/native-preview@npm:^7.0.0-dev.20260324.1":
|
||||
version: 7.0.0-dev.20260328.1
|
||||
resolution: "@typescript/native-preview@npm:7.0.0-dev.20260328.1"
|
||||
dependencies:
|
||||
"@typescript/native-preview-darwin-arm64": "npm:7.0.0-dev.20260328.1"
|
||||
"@typescript/native-preview-darwin-x64": "npm:7.0.0-dev.20260328.1"
|
||||
"@typescript/native-preview-linux-arm": "npm:7.0.0-dev.20260328.1"
|
||||
"@typescript/native-preview-linux-arm64": "npm:7.0.0-dev.20260328.1"
|
||||
"@typescript/native-preview-linux-x64": "npm:7.0.0-dev.20260328.1"
|
||||
"@typescript/native-preview-win32-arm64": "npm:7.0.0-dev.20260328.1"
|
||||
"@typescript/native-preview-win32-x64": "npm:7.0.0-dev.20260328.1"
|
||||
dependenciesMeta:
|
||||
"@typescript/native-preview-darwin-arm64":
|
||||
optional: true
|
||||
"@typescript/native-preview-darwin-x64":
|
||||
optional: true
|
||||
"@typescript/native-preview-linux-arm":
|
||||
optional: true
|
||||
"@typescript/native-preview-linux-arm64":
|
||||
optional: true
|
||||
"@typescript/native-preview-linux-x64":
|
||||
optional: true
|
||||
"@typescript/native-preview-win32-arm64":
|
||||
optional: true
|
||||
"@typescript/native-preview-win32-x64":
|
||||
optional: true
|
||||
bin:
|
||||
tsgo: bin/tsgo.js
|
||||
checksum: 10c0/64cc340ff0e2d7e652d0e8a47f64c52cd858a8c902a7bd5f835074478a04ffc01ba04b261a96c20fcf860ea7d06a434a834e9e273ceb02bd2de26717268712c5
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@typespec/ts-http-runtime@npm:^0.3.0":
|
||||
version: 0.3.0
|
||||
resolution: "@typespec/ts-http-runtime@npm:0.3.0"
|
||||
@@ -3374,20 +3456,13 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"buffer-from@npm:^1.0.0":
|
||||
"buffer-from@npm:^1.0.0, buffer-from@npm:^1.1.0":
|
||||
version: 1.1.2
|
||||
resolution: "buffer-from@npm:1.1.2"
|
||||
checksum: 10c0/124fff9d66d691a86d3b062eff4663fe437a9d9ee4b47b1b9e97f5a5d14f6d5399345db80f796827be7c95e70a8e765dd404b7c3ff3b3324f98e9b0c8826cc34
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"buffer-from@npm:^1.1.0":
|
||||
version: 1.1.1
|
||||
resolution: "buffer-from@npm:1.1.1"
|
||||
checksum: 10c0/a8c5057c985d8071e7a64988ad72f313e08eb3001eda76bead78b1f9afc7a07d20be9677eed0b5791727baeecd56360fe541bc5dd74feb40efe202a74584d533
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"buffer@npm:^5.5.0":
|
||||
version: 5.7.1
|
||||
resolution: "buffer@npm:5.7.1"
|
||||
@@ -8348,9 +8423,9 @@ __metadata:
|
||||
linkType: hard
|
||||
|
||||
"make-error@npm:^1.1.1":
|
||||
version: 1.3.5
|
||||
resolution: "make-error@npm:1.3.5"
|
||||
checksum: 10c0/c79a4c8adff05521702c1c2a8903eca7c3e79188ff47059efe113d7ca6d65ce2e46091ae391682c4e564a3d50eed7fc8a08cef3e9f0db59dd8e19ee93fc51114
|
||||
version: 1.3.6
|
||||
resolution: "make-error@npm:1.3.6"
|
||||
checksum: 10c0/171e458d86854c6b3fc46610cfacf0b45149ba043782558c6875d9f42f222124384ad0b468c92e996d815a8a2003817a710c0a160e49c1c394626f76fa45396f
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -11474,12 +11549,12 @@ __metadata:
|
||||
linkType: hard
|
||||
|
||||
"source-map-support@npm:^0.5.6":
|
||||
version: 0.5.19
|
||||
resolution: "source-map-support@npm:0.5.19"
|
||||
version: 0.5.21
|
||||
resolution: "source-map-support@npm:0.5.21"
|
||||
dependencies:
|
||||
buffer-from: "npm:^1.0.0"
|
||||
source-map: "npm:^0.6.0"
|
||||
checksum: 10c0/a232cb02dc5c2c048460dff3ca1a4c2aa44488822028932daff99b8707c8e4f87d2535dae319d65691c905096f2c06a2517793472634efb01f8a095661b9aa93
|
||||
checksum: 10c0/9ee09942f415e0f721d6daad3917ec1516af746a8120bba7bb56278707a37f1eb8642bde456e98454b8a885023af81a16e646869975f06afc1a711fb90484e7d
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -12432,22 +12507,22 @@ __metadata:
|
||||
linkType: hard
|
||||
|
||||
"typescript@npm:^5.8.3":
|
||||
version: 5.8.3
|
||||
resolution: "typescript@npm:5.8.3"
|
||||
version: 5.9.3
|
||||
resolution: "typescript@npm:5.9.3"
|
||||
bin:
|
||||
tsc: bin/tsc
|
||||
tsserver: bin/tsserver
|
||||
checksum: 10c0/5f8bb01196e542e64d44db3d16ee0e4063ce4f3e3966df6005f2588e86d91c03e1fb131c2581baf0fb65ee79669eea6e161cd448178986587e9f6844446dbb48
|
||||
checksum: 10c0/6bd7552ce39f97e711db5aa048f6f9995b53f1c52f7d8667c1abdc1700c68a76a308f579cd309ce6b53646deb4e9a1be7c813a93baaf0a28ccd536a30270e1c5
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"typescript@patch:typescript@npm%3A^5.8.3#optional!builtin<compat/typescript>":
|
||||
version: 5.8.3
|
||||
resolution: "typescript@patch:typescript@npm%3A5.8.3#optional!builtin<compat/typescript>::version=5.8.3&hash=5786d5"
|
||||
version: 5.9.3
|
||||
resolution: "typescript@patch:typescript@npm%3A5.9.3#optional!builtin<compat/typescript>::version=5.9.3&hash=5786d5"
|
||||
bin:
|
||||
tsc: bin/tsc
|
||||
tsserver: bin/tsserver
|
||||
checksum: 10c0/39117e346ff8ebd87ae1510b3a77d5d92dae5a89bde588c747d25da5c146603a99c8ee588c7ef80faaf123d89ed46f6dbd918d534d641083177d5fac38b8a1cb
|
||||
checksum: 10c0/ad09fdf7a756814dce65bc60c1657b40d44451346858eea230e10f2e95a289d9183b6e32e5c11e95acc0ccc214b4f36289dcad4bf1886b0adb84d711d336a430
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
|
||||
Reference in New Issue
Block a user