Skip to content

Commit ecd9ce7

Browse files
committed
Update: Bump esbuild and add support for new import path format
1 parent bcc98f1 commit ecd9ce7

18 files changed

Lines changed: 950 additions & 623 deletions

.github/workflows/publish_dev.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,17 @@ jobs:
99
runs-on: ubuntu-latest
1010
permissions:
1111
id-token: write
12-
environment: npm
12+
environment: npm_beta
1313
steps:
1414
- uses: actions/checkout@v3
1515
- uses: actions/setup-node@v3
1616
with:
1717
node-version: '18.x'
1818
registry-url: 'https://registry.npmjs.org'
1919
- run: |
20+
BRANCH_SLUG=$(echo "${{ github.ref_name }}" | sed 's|/|-|g')
2021
SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-7)
21-
npm version 0.0.0-${{ github.ref_slug }}-$SHORT_SHA --no-git-tag-version
22+
npm version 0.0.0-${BRANCH_SLUG}-${SHORT_SHA} --no-git-tag-version
2223
npm ci
2324
npm run compile
2425
npm publish --tag beta --provenance

.github/workflows/test.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ jobs:
1313
name: install
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/checkout@v2
17-
- uses: actions/setup-node@v2
16+
- uses: actions/checkout@v4
17+
- uses: actions/setup-node@v4
1818
with:
1919
node-version: ${{ env.NODE_VERSION }}
2020
cache: 'npm'
2121
cache-dependency-path: package-lock.json
2222
- name: node_modules cache
23-
uses: actions/cache@v2
23+
uses: actions/cache@v4
2424
with:
2525
path: node_modules
2626
key: ${{ runner.OS }}-cache-${{ hashFiles('**/package-lock.json') }}
@@ -32,12 +32,12 @@ jobs:
3232
needs: install
3333
runs-on: ubuntu-latest
3434
steps:
35-
- uses: actions/checkout@v2
36-
- uses: actions/setup-node@v2
35+
- uses: actions/checkout@v4
36+
- uses: actions/setup-node@v4
3737
with:
3838
node-version: ${{ env.NODE_VERSION }}
3939
- name: node_modules cache
40-
uses: actions/cache@v2
40+
uses: actions/cache@v4
4141
with:
4242
path: node_modules
4343
key: ${{ runner.OS }}-cache-${{ hashFiles('**/package-lock.json') }}
@@ -49,12 +49,12 @@ jobs:
4949
needs: install
5050
runs-on: ubuntu-latest
5151
steps:
52-
- uses: actions/checkout@v2
53-
- uses: actions/setup-node@v2
52+
- uses: actions/checkout@v4
53+
- uses: actions/setup-node@v4
5454
with:
5555
node-version: ${{ env.NODE_VERSION }}
5656
- name: node_modules cache
57-
uses: actions/cache@v2
57+
uses: actions/cache@v4
5858
with:
5959
path: node_modules
6060
key: ${{ runner.OS }}-cache-${{ hashFiles('**/package-lock.json') }}
@@ -66,12 +66,12 @@ jobs:
6666
needs: install
6767
runs-on: ubuntu-latest
6868
steps:
69-
- uses: actions/checkout@v2
70-
- uses: actions/setup-node@v2
69+
- uses: actions/checkout@v4
70+
- uses: actions/setup-node@v4
7171
with:
7272
node-version: ${{ env.NODE_VERSION }}
7373
- name: node_modules cache
74-
uses: actions/cache@v2
74+
uses: actions/cache@v4
7575
with:
7676
path: node_modules
7777
key: ${{ runner.OS }}-cache-${{ hashFiles('**/package-lock.json') }}

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
registry="https://registry.npmjs.org"

examples/__snapshots__/examples.test.ts.snap

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ Object {
1818

1919
exports[`examples "basic-single" packages correctly 1`] = `
2020
Object {
21-
"dependencies": Object {},
21+
"dependencies": Object {
22+
"@typescript-eslint/utils": "5.27.1",
23+
"resolve-package-path": "4.0.3",
24+
},
2225
"main": "index.js",
2326
"type": "module",
2427
}

examples/basic-single/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
"main": "./src/main.ts"
1717
}
1818
},
19+
"dependencies": {
20+
"resolve-package-path": "^4.0.3"
21+
},
1922
"devDependencies": {
2023
"funpack": "file:../.."
2124
}

examples/basic-single/src/main.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
1+
// Check if nodejs internal modules resolve correctly
2+
import { fileURLToPath } from 'url';
3+
import { join } from 'node:path';
4+
5+
// Check if importing with package paths works correctly
6+
import { AST_NODE_TYPES } from '@typescript-eslint/utils/dist/ts-estree';
7+
import resolvePackagePath from 'resolve-package-path';
8+
19
export const handler = (event: unknown) => {
210
console.log('Hello world!', 'event:', event);
311

12+
const currentFilePath = fileURLToPath('.');
13+
const directoryPath = join(currentFilePath, '..');
14+
console.log(
15+
{ currentFilePath, directoryPath },
16+
AST_NODE_TYPES,
17+
resolvePackagePath
18+
);
19+
420
return {
521
status: 200,
622
};

examples/examples.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { readFileSync } from 'fs';
2-
import { join } from 'path';
1+
import { readFileSync } from 'node:fs';
2+
import { join } from 'node:path';
33

44
import funpack from '../src';
55

@@ -13,7 +13,7 @@ const directories = [
1313
},
1414
{
1515
dir: 'basic-single',
16-
expectedOutput: [{ name: 'main', zip: { approxSize: 851 } }],
16+
expectedOutput: [{ name: 'main', zip: { approxSize: 7400 } }],
1717
},
1818
{
1919
dir: 'mjs-extension',
@@ -23,7 +23,7 @@ const directories = [
2323
dir: 'module-splitting',
2424
expectedOutput: [
2525
{ name: 'exampleTwo', zip: { approxSize: 432 } },
26-
{ name: 'exampleOne', zip: { approxSize: 21597 } },
26+
{ name: 'exampleOne', zip: { approxSize: 21868 } },
2727
],
2828
},
2929
{

0 commit comments

Comments
 (0)