Skip to content

Commit 0eebcc4

Browse files
authored
feat: upgrade yarn and dependencies (#73)
1 parent aedac1f commit 0eebcc4

File tree

14 files changed

+1200
-1643
lines changed

14 files changed

+1200
-1643
lines changed

.github/workflows/release-please.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,14 @@ jobs:
1717
changelog-types: '[{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"chore","section":"Miscellaneous","hidden":false},{"type":"docs","section":"Documentation","hidden":false},{"type":"test","section":"Tests","hidden":false}]'
1818
path: esbuild-node-externals
1919

20-
- uses: actions/checkout@v2
20+
- uses: actions/checkout@v4
2121
if: ${{ steps.release.outputs.release_created }}
2222

23-
- name: Use Node 20
24-
uses: actions/setup-node@v1
23+
- name: Use Node 22
24+
uses: actions/setup-node@v4
2525
with:
26-
node-version: 20.x
26+
node-version: 22.x
27+
cache: 'yarn'
2728
if: ${{ steps.release.outputs.release_created }}
2829

2930
- name: Install dependencies

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
dist
2+
esbuild-node-externals/CHANGELOG.md

.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

Lines changed: 0 additions & 363 deletions
This file was deleted.

.yarn/releases/yarn-3.1.0.cjs

Lines changed: 0 additions & 768 deletions
This file was deleted.

.yarn/releases/yarn-4.6.0.cjs

Lines changed: 934 additions & 0 deletions
Large diffs are not rendered by default.

.yarnrc.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
compressionLevel: mixed
2+
3+
enableGlobalCache: false
4+
15
nodeLinker: node-modules
26

37
npmAuthToken: "${NPM_TOKEN-''}"
48

5-
plugins:
6-
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
7-
spec: '@yarnpkg/plugin-interactive-tools'
8-
9-
yarnPath: .yarn/releases/yarn-3.1.0.cjs
9+
yarnPath: .yarn/releases/yarn-4.6.0.cjs

esbuild-node-externals/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@
3434
"esbuild": "0.12 - 0.25"
3535
},
3636
"devDependencies": {
37-
"@types/node": "^18.15.10",
37+
"@types/node": "^22.13.1",
3838
"esbuild": "^0.25.0",
3939
"rimraf": "^4.4.1",
40-
"typescript": "^4.9.4"
40+
"typescript": "^5.7.3"
4141
}
4242
}

esbuild-node-externals/src/index.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { Plugin } from 'esbuild';
33
import {
44
findPackagePaths,
55
findDependencies,
6-
AllowList,
6+
type AllowList,
77
createAllowPredicate,
88
} from './utils';
99

@@ -46,12 +46,14 @@ export const nodeExternalsPlugin = (paramsOptions: Options = {}): Plugin => {
4646
const allowPredicate =
4747
options.allowList && createAllowPredicate(options.allowList);
4848
const externalPredicate =
49-
options.forceExternalList && createAllowPredicate(options.forceExternalList);
49+
options.forceExternalList &&
50+
createAllowPredicate(options.forceExternalList);
5051

5152
return {
5253
name: 'node-externals',
5354
setup(build) {
54-
const cwd = options.cwd || build.initialOptions.absWorkingDir || process.cwd()
55+
const cwd =
56+
options.cwd || build.initialOptions.absWorkingDir || process.cwd();
5557
const nodeModules = findDependencies({
5658
packagePaths: options.packagePath
5759
? options.packagePath
@@ -80,7 +82,7 @@ export const nodeExternalsPlugin = (paramsOptions: Options = {}): Plugin => {
8082
}
8183

8284
// Mark the module as external so it is not resolved
83-
if (nodeModules.includes(moduleName)) {
85+
if (moduleName && nodeModules.includes(moduleName)) {
8486
return { path: args.path, external: true };
8587
}
8688

esbuild-node-externals/src/utils.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import path from 'path';
2-
import fs from 'fs';
1+
import path from 'node:path';
2+
import fs from 'node:fs';
33
import findUp from 'find-up';
44

55
export type AllowPredicate = (path: string) => boolean;
@@ -11,8 +11,8 @@ export const createAllowPredicate = (allowList: AllowList): AllowPredicate => {
1111
: (path: string) =>
1212
Boolean(
1313
allowList.find((pattern) =>
14-
typeof pattern === 'string' ? path === pattern : pattern.test(path)
15-
)
14+
typeof pattern === 'string' ? path === pattern : pattern.test(path),
15+
),
1616
);
1717
};
1818

@@ -60,7 +60,7 @@ export const findPackagePaths = (_cwd: string = process.cwd()): string[] => {
6060

6161
function getDependencyKeys(
6262
map: Record<string, string> = {},
63-
allowWorkspaces: boolean = false
63+
allowWorkspaces: boolean = false,
6464
): string[] {
6565
if (!map) {
6666
return [];
@@ -69,7 +69,9 @@ function getDependencyKeys(
6969
return Object.keys(map);
7070
}
7171
// Filter out shared workspaces
72-
return Object.keys(map).filter((depKey) => !map[depKey].startsWith('workspace:'));
72+
return Object.keys(map).filter(
73+
(depKey) => !map[depKey]?.startsWith('workspace:'),
74+
);
7375
}
7476

7577
/**
@@ -99,13 +101,13 @@ export const findDependencies = (options: {
99101
} catch (error) {
100102
console.error(error);
101103
throw new Error(
102-
`Couldn't process ${packagePath}". Make sure it's a valid JSON.`
104+
`Couldn't process ${packagePath}". Make sure it's a valid JSON.`,
103105
);
104106
}
105107

106108
const packageNames = packageJsonKeys
107109
.map((key) =>
108-
getDependencyKeys(packageJson[key], options.allowWorkspaces)
110+
getDependencyKeys(packageJson[key], options.allowWorkspaces),
109111
)
110112
.flat(1);
111113
const { allowPredicate } = options;

esbuild-node-externals/tsconfig.json

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,21 @@
11
{
22
"compilerOptions": {
33
"rootDir": "./src",
4-
"outDir": "./dist",
5-
"importHelpers": true,
6-
"lib": ["es2019", "es2020.promise", "es2020.bigint", "es2020.string"],
7-
"removeComments": true,
8-
"target": "es2019",
9-
"declaration": true,
10-
"sourceMap": true,
11-
"module": "commonjs",
12-
"moduleResolution": "node",
13-
"strict": true,
14-
"downlevelIteration": true,
15-
"allowSyntheticDefaultImports": true,
4+
"outDir": "dist",
165
"esModuleInterop": true,
176
"skipLibCheck": true,
7+
"target": "es2022",
8+
"allowJs": true,
9+
"resolveJsonModule": true,
10+
"moduleDetection": "force",
1811
"isolatedModules": true,
19-
"forceConsistentCasingInFileNames": true,
20-
"allowUnusedLabels": false,
21-
"allowUnreachableCode": false,
22-
"noUnusedLocals": true,
23-
"noUnusedParameters": true,
24-
"importsNotUsedAsValues": "error",
25-
"noErrorTruncation": true,
26-
"exactOptionalPropertyTypes": true,
27-
"noImplicitOverride": false,
28-
"noUncheckedIndexedAccess": false
12+
"strict": true,
13+
"noUncheckedIndexedAccess": true,
14+
"noImplicitOverride": true,
15+
"module": "NodeNext",
16+
"sourceMap": true,
17+
"declaration": true,
18+
"lib": ["es2022"]
2919
},
3020
"include": ["src/**/*"],
3121
"exclude": ["node_modules"]

0 commit comments

Comments
 (0)