Skip to content

Commit 3175c2d

Browse files
author
wuls
committed
feat: ts-node
1 parent b30303f commit 3175c2d

File tree

4 files changed

+31
-62
lines changed

4 files changed

+31
-62
lines changed

package.json

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -188,35 +188,35 @@
188188
},
189189
"private": true,
190190
"scripts": {
191-
"api.update": "tsm scripts/index.ts --tsc --api --dev",
192-
"build": "tsm scripts/index.ts",
191+
"api.update": "node --loader ts-node/esm --require ./scripts/runBefore.ts scripts/index.ts --tsc --api --dev",
192+
"build": "node --loader ts-node/esm --require ./scripts/runBefore.ts scripts/index.ts",
193193
"build.changelog-formatter": "tsc .changeset/changelog-github-custom.ts && mv .changeset/changelog-github-custom.js .changeset/changelog-github-custom.cjs",
194194
"build.clean": "rm -rf packages/qwik/dist/ && rm -rf packages/qwik-city/lib/ && rm -rf packages/docs/dist/ && rm -rf packages/insights/dist/ && rm -rf packages/qwik-labs/lib/ && rm -rf packages/qwik-labs/vite/",
195-
"build.cli": "node --loader ts-node/esm scripts/index.ts --cli --dev",
196-
"build.cli.prod": "node --loader ts-node/esm scripts/index.ts --cli",
197-
"build.core": "node --loader ts-node/esm scripts/index.ts --tsc --build --qwikcity --api --platform-binding",
198-
"build.eslint": "node --loader ts-node/esm scripts/index.ts --eslint",
199-
"build.full": "node --loader ts-node/esm scripts/index.ts --tsc --tsc-docs --build --supabaseauthhelpers --api --eslint --qwikcity --qwikworker --qwiklabs --qwikreact --qwikauth --cli --platform-binding --wasm",
200-
"build.local": "node --loader ts-node/esm scripts/index.ts --tsc --tsc-docs --build --supabaseauthhelpers --api --eslint --qwikcity --qwikworker --qwiklabs --qwikreact --qwikauth --cli --platform-binding-wasm-copy",
201-
"build.only_javascript": "node --loader ts-node/esm scripts/index.ts --tsc --build --api",
195+
"build.cli": "node --loader ts-node/esm --require ./scripts/runBefore.ts scripts/index.ts --cli --dev",
196+
"build.cli.prod": "node --loader ts-node/esm --require ./scripts/runBefore.ts scripts/index.ts --cli",
197+
"build.core": "node --loader ts-node/esm --require ./scripts/runBefore.ts scripts/index.ts --tsc --build --qwikcity --api --platform-binding",
198+
"build.eslint": "node --loader ts-node/esm --require ./scripts/runBefore.ts scripts/index.ts --eslint",
199+
"build.full": "node --loader ts-node/esm --require ./scripts/runBefore.ts scripts/index.ts --tsc --tsc-docs --build --supabaseauthhelpers --api --eslint --qwikcity --qwikworker --qwiklabs --qwikreact --qwikauth --cli --platform-binding --wasm",
200+
"build.local": "node --loader ts-node/esm --require ./scripts/runBefore.tsscripts/index.ts --tsc --tsc-docs --build --supabaseauthhelpers --api --eslint --qwikcity --qwikworker --qwiklabs --qwikreact --qwikauth --cli --platform-binding-wasm-copy",
201+
"build.only_javascript": "node --loader ts-node/esm --require ./scripts/runBefore.ts scripts/index.ts --tsc --build --api",
202202
"build.packages.docs": "pnpm -C ./packages/docs/ run build",
203203
"build.packages.insights": "pnpm -C ./packages/insights/ run build",
204-
"build.platform": "node --loader ts-node/esm scripts/index.ts --platform-binding",
205-
"build.platform.copy": "node --loader ts-node/esm scripts/index.ts --platform-binding-wasm-copy",
206-
"build.qwik-city": "node --loader ts-node/esm scripts/index.ts --tsc --qwikcity",
207-
"build.validate": "node --loader ts-node/esm scripts/index.ts --tsc --build --api --eslint --qwikcity --platform-binding --wasm --validate",
208-
"build.vite": "node --loader ts-node/esm scripts/index.ts --tsc --build --api --qwikcity --eslint --platform-binding-wasm-copy",
209-
"build.wasm": "node --loader ts-node/esm scripts/index.ts --wasm",
210-
"build.watch": "node --loader ts-node/esm scripts/index.ts --build --qwikcity --watch --dev --platform-binding",
204+
"build.platform": "node --loader ts-node/esm --require ./scripts/runBefore.ts scripts/index.ts --platform-binding",
205+
"build.platform.copy": "node --loader ts-node/esm --require ./scripts/runBefore.ts scripts/index.ts --platform-binding-wasm-copy",
206+
"build.qwik-city": "node --loader ts-node/esm --require ./scripts/runBefore.ts scripts/index.ts --tsc --qwikcity",
207+
"build.validate": "node --loader ts-node/esm --require ./scripts/runBefore.ts scripts/index.ts --tsc --build --api --eslint --qwikcity --platform-binding --wasm --validate",
208+
"build.vite": "node --loader ts-node/esm --require ./scripts/runBefore.ts scripts/index.ts --tsc --build --api --qwikcity --eslint --platform-binding-wasm-copy",
209+
"build.wasm": "node --loader ts-node/esm --require ./scripts/runBefore.ts scripts/index.ts --wasm",
210+
"build.watch": "node --loader ts-node/esm --require ./scripts/runBefore.ts scripts/index.ts --build --qwikcity --watch --dev --platform-binding",
211211
"change": "changeset",
212-
"cli": "pnpm build.cli && node packages/create-qwik/dist/create-qwik.cjs && tsm scripts/validate-cli.ts --copy-local-qwik-dist",
212+
"cli": "pnpm build.cli && node packages/create-qwik/dist/create-qwik.cjs && node --loader ts-node/esm --require ./scripts/runBefore.ts scripts/validate-cli.ts --copy-local-qwik-dist",
213213
"cli.qwik": "pnpm build.cli && node packages/qwik/dist/qwik-cli.cjs",
214-
"cli.validate": "node --loader ts-node/esm scripts/validate-cli.ts",
214+
"cli.validate": "node --loader ts-node/esm --require ./scripts/runBefore.ts scripts/validate-cli.ts",
215215
"deps": "corepack pnpm upgrade -i -r --latest && syncpack fix-mismatches && corepack pnpm dedupe",
216216
"docs.dev": "cd packages/docs && pnpm build.repl-sw && pnpm dev",
217217
"docs.preview": "cd packages/docs && pnpm preview",
218-
"docs.sync": "node --loader ts-node/esm scripts/docs_sync/index.ts && pnpm fmt",
219-
"eslint.update": "node --loader ts-node/esm scripts/eslint-docs.ts",
218+
"docs.sync": "node --loader ts-node/esm --require ./scripts/runBefore.ts scripts/docs_sync/index.ts && pnpm fmt",
219+
"eslint.update": "node --loader ts-node/esm --require ./scripts/runBefore.ts scripts/eslint-docs.ts",
220220
"fmt": "pnpm prettier.fix && pnpm syncpack format",
221221
"fmt.staged": "pretty-quick --staged",
222222
"link.dist": "cd packages/qwik && pnpm link --global && cd ../qwik-city && pnpm link --global && cd ../eslint-plugin-qwik && pnpm link --global && cd ../qwik-react && pnpm link --global",
@@ -231,12 +231,12 @@
231231
"preinstall": "npx only-allow pnpm",
232232
"prepare": "simple-git-hooks",
233233
"prettier.fix": "prettier --cache --write .",
234-
"qwik-save-artifacts": "node --loader ts-node/esm ./scripts/qwik-save-artifacts.ts",
234+
"qwik-save-artifacts": "node --loader ts-node/esm --require ./scripts/runBefore.ts ./scripts/qwik-save-artifacts.ts",
235235
"release": "changeset publish",
236236
"release.pkg-pr-new": "pnpm dlx pkg-pr-new@^0.0.9 publish --compact --pnpm ./packages/qwik ./packages/qwik-city ./packages/eslint-plugin-qwik ./packages/create-qwik",
237237
"release.prepare": "pnpm build --prepare-release",
238-
"serve": "node --loader ts-node/esm --inspect --conditions=development starters/dev-server.ts 3300",
239-
"serve.debug": "node --loader ts-node/esm --inspect-brk --conditions=development starters/dev-server.ts 3300",
238+
"serve": "node --loader ts-node/esm --require ./scripts/runBefore.ts --inspect --conditions=development starters/dev-server.ts 3300",
239+
"serve.debug": "node --loader ts-node/esm --require ./scripts/runBefore.ts --inspect-brk --conditions=development starters/dev-server.ts 3300",
240240
"start": "concurrently \"npm:build.watch\" \"npm:tsc.watch\" -n build,tsc -c green,cyan",
241241
"test": "pnpm build.full && pnpm test.unit && pnpm test.e2e",
242242
"test.e2e": "pnpm test.e2e.chromium && pnpm test.e2e.webkit",
@@ -253,7 +253,7 @@
253253
"tsc.check": "tsc --noEmit",
254254
"tsc.trace": "tsc -p tsconfig.json --traceResolution > tsc.log",
255255
"tsc.watch": "tsc --noEmit --watch --preserveWatchOutput",
256-
"update.qwik.builds": "node --loader ts-node/esm scripts/update-qwik-builds.ts packages/docs && node --loader ts-node/esm scripts/update-qwik-builds.ts packages/insights; pnpm install",
256+
"update.qwik.builds": "node --loader ts-node/esm --require ./scripts/runBefore.ts scripts/update-qwik-builds.ts packages/docs && node --loader ts-node/esm scripts/update-qwik-builds.ts packages/insights; pnpm install",
257257
"vitest": "vitest"
258258
},
259259
"simple-git-hooks": {

packages/qwik/src/optimizer/src/qwik-binding-map.ts

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,6 @@
44
// prettier-ignore
55
export const QWIK_BINDING_MAP = {
66
"darwin": {
7-
"arm64": [
8-
{
9-
"platform": "darwin",
10-
"arch": "arm64",
11-
"abi": null,
12-
"platformArchABI": "qwik.darwin-arm64.node"
13-
}
14-
],
157
"x64": [
168
{
179
"platform": "darwin",
@@ -20,25 +12,5 @@ export const QWIK_BINDING_MAP = {
2012
"platformArchABI": "qwik.darwin-x64.node"
2113
}
2214
]
23-
},
24-
"win32": {
25-
"x64": [
26-
{
27-
"platform": "win32",
28-
"arch": "x64",
29-
"abi": "msvc",
30-
"platformArchABI": "qwik.win32-x64-msvc.node"
31-
}
32-
]
33-
},
34-
"linux": {
35-
"x64": [
36-
{
37-
"platform": "linux",
38-
"arch": "x64",
39-
"abi": "gnu",
40-
"platformArchABI": "qwik.linux-x64-gnu.node"
41-
}
42-
]
4315
}
4416
};

scripts/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
*/
66
import { build } from './build';
77
import { loadConfig } from './util';
8-
import { polyfill } from './runBefore';
98

109
const args = process.argv.slice(2);
1110

@@ -14,6 +13,5 @@ const args = process.argv.slice(2);
1413
const config = loadConfig(args);
1514
config.esmNode = true;
1615

17-
polyfill();
1816
// let's do this!
1917
build(config);

scripts/runBefore.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
1-
declare global {
2-
var qTest: boolean;
3-
var qRuntimeQrl: boolean;
4-
var qDev: boolean;
5-
var qInspector: boolean;
6-
}
7-
8-
export function polyfill() {
1+
function polyfill() {
2+
// @ts-ignore
93
globalThis.qTest = true;
4+
// @ts-ignore
105
globalThis.qRuntimeQrl = true;
6+
// @ts-ignore
117
globalThis.qDev = true;
8+
// @ts-ignore
129
globalThis.qInspector = false;
1310
if (
1411
typeof global !== 'undefined' &&
@@ -26,3 +23,5 @@ export function polyfill() {
2623
}
2724
}
2825
}
26+
27+
polyfill();

0 commit comments

Comments
 (0)