Skip to content

Commit

Permalink
fix: use esm for legacy packages
Browse files Browse the repository at this point in the history
Signed-off-by: Okiki <[email protected]>
  • Loading branch information
okikio committed Oct 26, 2024
1 parent c616e68 commit ecb608d
Show file tree
Hide file tree
Showing 10 changed files with 1,089 additions and 964 deletions.
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Expose Astro dependencies for `pnpm` users
shamefully-hoist=false
strict-peer-dependencies=false
@jsr:registry=https://npm.jsr.io
27 changes: 13 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,29 +49,28 @@
}
},
"devDependencies": {
"@commitlint/cli": "^19.4.1",
"@commitlint/config-conventional": "^19.4.1",
"@commitlint/cli": "^19.5.0",
"@commitlint/config-conventional": "^19.5.0",
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/git": "^10.0.1",
"commitizen": "^4.3.0",
"esbuild": "^0.23.1",
"commitizen": "^4.3.1",
"esbuild": "^0.24.0",
"hastscript": "^9.0.0",
"husky": "^9.1.5",
"postcss": "^8.4.45",
"husky": "^9.1.6",
"postcss": "^8.4.47",
"postcss-font-grabber": "^3.1.0",
"rehype": "^13.0.1",
"rehype": "^13.0.2",
"rehype-external-links": "^3.0.0",
"rehype-slug": "^6.0.0",
"rehype-urls": "^1.2.0",
"sass": "^1.78.0",
"semantic-release": "^24.1.0",
"sass": "^1.80.4",
"semantic-release": "^24.2.0",
"tiny-glob": "^0.2.9",
"typedoc": "^0.26.6",
"typedoc": "^0.26.10",
"typedoc-plugin-extras": "^3.1.0",
"typedoc-plugin-inline-sources": "^1.0.2",
"typedoc-plugin-mdn-links": "^3.2.11",
"typedoc-plugin-inline-sources": "^1.1.0",
"typedoc-plugin-mdn-links": "^3.3.4",
"typedoc-plugin-missing-exports": "^3.0.0",
"typescript": "5.5.4",
"ultra-runner": "^3.10.5"
"typescript": "5.6.3"
}
}
6 changes: 5 additions & 1 deletion packages/core/deno.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,9 @@
},
"tasks": {
"dev": "deno run -A --watch repl.ts"
},
"imports": {
"@std/path": "jsr:@std/path@^1.0.6",
"@std/tar": "jsr:@std/tar@^0.1.1"
}
}
}
19 changes: 10 additions & 9 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"test": "vitest",
"repl": "tsx repl.ts",
"deno": "deno run --allow-net --allow-env --allow-read --allow-write --allow-run ./repl.ts",
"dts": "del-cli @types/ && tsc --project dts.tsconfig.json",
"dts": "rm -r @types/ && tsc --project dts.tsconfig.json",
"verify": "pnpm dts; pnpm test:run",
"pre-release": "pnpm build:all; ultra verify"
},
Expand Down Expand Up @@ -76,17 +76,18 @@
},
"homepage": "https://bundlejs.com",
"dependencies": {
"esbuild": "^0.23.1",
"esbuild-wasm": "^0.23.1",
"@std/path": "npm:@jsr/std__path@^1.0.7",
"@std/tar": "npm:@jsr/std__tar@^0.1.3",
"esbuild": "^0.24.0",
"esbuild-wasm": "^0.24.0",
"resolve.exports": "^2.0.2"
},
"devDependencies": {
"@types/node": "^22.5.4",
"del-cli": "^5.1.0",
"tsx": "^4.19.0",
"typescript": "5.5.4",
"vite": "^5.4.3",
"@types/node": "^22.8.1",
"tsx": "^4.19.1",
"typescript": "5.6.3",
"vite": "^5.4.10",
"vite-plugin-cp": "^4.0.8",
"vitest": "^2.0.5"
"vitest": "^2.1.3"
}
}
Binary file modified packages/core/src/esbuild.wasm
Binary file not shown.
7 changes: 4 additions & 3 deletions packages/core/src/plugins/cdn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ export const CDN_RESOLVE = (cdn = DEFAULT_CDN_HOST, rootPkg: Partial<PackageJson

const relativePath = subpath.replace(/^\//, "./");

let modernResolve: ReturnType<typeof resolve> | void;
let legacyResolve: ReturnType<typeof legacy> | void;
let modernResolve: ReturnType<typeof resolve> | undefined;
let legacyResolve: ReturnType<typeof legacy> | undefined;

let resolvedPath: string | void = subpath;

Expand All @@ -214,11 +214,12 @@ export const CDN_RESOLVE = (cdn = DEFAULT_CDN_HOST, rootPkg: Partial<PackageJson
// we can safely use legacy resolve,
// else, if the subpath doesn't have a package.json, then the subpath is literal,
// and we should just use the subpath as it is
if (isDirPkgJSON) {
if (isDirPkgJSON || relativePath.trim().length === 0) {
try {
// Resolving using main, module, etc... from package.json
legacyResolve = (
legacy(pkg, { browser: true }) ||
legacy(pkg, { fields: ["module", "main"] }) ||
legacy(pkg, { fields: ["unpkg", "bin"] })
);

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/wasm.ts

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/edge/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ curl -fsSL https://deno.land/x/install/install.sh | sh
export DENO_INSTALL="/home/gitpod/.deno"
export PATH="$DENO_INSTALL/bin:$PATH"

deno run -A --watch packages/edge/mod.ts
deno serve -A --watch packages/edge/mod.ts

deno install --global -Arf jsr:@deno/deployctl

Expand Down
10 changes: 5 additions & 5 deletions packages/edge/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
"license": "ISC",
"dependencies": {
"@octokit/core": "^6.1.2",
"@octokit/plugin-throttling": "^9.3.1",
"@octokit/plugin-throttling": "^9.3.2",
"@octokit/rest": "^21.0.2",
"@upstash/redis": "^1.34.0",
"esbuild": "^0.23.1",
"esbuild-wasm": "^0.23.1",
"@upstash/redis": "^1.34.3",
"esbuild": "^0.24.0",
"esbuild-wasm": "^0.24.0",
"json5": "^2.2.3",
"octokit": "^4.0.2",
"resolve.exports": "^2.0.2",
"tsx": "^4.19.0"
"tsx": "^4.19.1"
}
}
Loading

0 comments on commit ecb608d

Please sign in to comment.