Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(pnp): experimental esm support #2161

Merged
merged 45 commits into from Oct 20, 2021
Merged
Show file tree
Hide file tree
Changes from 44 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
48487a9
feat: esm support
merceyz Mar 20, 2021
9eba550
fix: detect module type from any workspace
merceyz May 15, 2021
d627dc2
fix: always treat cjs as commonjs
merceyz May 15, 2021
11a3e7f
test: add tests
merceyz May 15, 2021
a6af21a
chore: change loader name
merceyz May 15, 2021
02f375f
test: exports
merceyz May 15, 2021
f7146f8
fix: use legacy resolve if exports is missing
merceyz May 15, 2021
c776dd1
chore: update config name
merceyz May 15, 2021
8913e04
feat: enable loader if any package is a module
merceyz Jun 29, 2021
7421fc1
fix: use `findPnpApi` to get the correct `pnpapi` instance
merceyz Jun 30, 2021
0a08a60
fix: check if specifier has a pnpapi
merceyz Jul 1, 2021
8fccce5
ci: add SvelteKit test
merceyz Jul 1, 2021
b4d2207
ci: add Astro e2e test
merceyz Jul 1, 2021
27970e8
fix: pass unknown extensions to the next loader
merceyz Jul 1, 2021
710f753
fix: don't enter ESM mode if main is cjs
merceyz Jul 1, 2021
ef9fb4e
fix: handle absolute paths to `_findPath`
merceyz Jul 2, 2021
fa1ee5f
chore: let node handle encoding the path to the loader
merceyz Jul 2, 2021
7bcf000
fix: get pnpapi of absolute path in `_findPath`
merceyz Jul 2, 2021
3896ee2
Update packages/yarnpkg-pnp/sources/esm-loader/loader.ts
merceyz Jul 9, 2021
95670aa
test: add dynamic import tests
merceyz Jul 22, 2021
ee25d21
test: check named exports from a zip file works
merceyz Jul 25, 2021
cb979c0
refactor: avoid code generation
merceyz Jul 25, 2021
cea7bc0
test: skip `dynamic import in cjs` test
merceyz Sep 1, 2021
2cdd09a
refactor: cleanup
merceyz Sep 10, 2021
a2256cd
refactor: rename config and move it to the plugin
merceyz Sep 10, 2021
f418b89
fix: support explicitly disabling ESM support
merceyz Sep 10, 2021
5168653
chore: print a warning about experimental esm support
merceyz Sep 10, 2021
0c046a3
fix: make `isEsmEnabled` private
merceyz Sep 10, 2021
9b34829
chore: versions
merceyz Sep 10, 2021
21e033d
Merge branch 'master' into merceyz/esm-loader
merceyz Sep 10, 2021
8ffef3a
fix: add types for loader artifact
merceyz Sep 10, 2021
a698c88
chore: eslintignore esm loader
merceyz Sep 10, 2021
5fde656
Merge branch 'master' into merceyz/esm-loader
merceyz Sep 17, 2021
d80ee2d
chore: lint after merge
merceyz Sep 17, 2021
62d3e18
chore: update versions
merceyz Oct 12, 2021
4a87fe3
Merge branch 'master' into merceyz/esm-loader
merceyz Oct 12, 2021
66c3bd2
chore: link to the test and upstream issue
merceyz Oct 13, 2021
8d0eb39
Merge branch 'master' into merceyz/esm-loader
merceyz Oct 19, 2021
ae63ff0
refactor: pass conditions directly to `resolve.exports`
merceyz Oct 19, 2021
c9e411b
ci: set config as env variables
merceyz Oct 19, 2021
f4c801d
chore: update warning message
merceyz Oct 19, 2021
f24fab3
refactor: use `changeFilePromise` to update the loader
merceyz Oct 19, 2021
d440279
ci: remove Astro e2e test
merceyz Oct 20, 2021
872a974
Merge branch 'master' into merceyz/esm-loader
merceyz Oct 20, 2021
61d4a21
test: add link to issue
merceyz Oct 20, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintignore
@@ -1,4 +1,5 @@
/packages/yarnpkg-pnp/sources/hook.js
/packages/yarnpkg-pnp/sources/esm-loader/built-loader.js

/packages/yarnpkg-libzip/sources/libzipAsync.js
/packages/yarnpkg-libzip/sources/libzipSync.js
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/e2e-svelte-kit-workflow.yml
@@ -0,0 +1,36 @@
on:
schedule:
- cron: '0 */4 * * *'
push:
branches:
- master
pull_request:
paths:
- .github/workflows/e2e-svelte-kit-workflow.yml
- scripts/e2e-setup-ci.sh

name: 'E2E SvelteKit'
jobs:
chore:
name: 'Validating SvelteKit'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@master

- name: 'Install Node'
uses: actions/setup-node@master
with:
node-version: 14.x

- name: 'Build the standard bundle'
run: |
node ./scripts/run-yarn.js build:cli

- name: 'Running the integration test'
run: |
source scripts/e2e-setup-ci.sh
yes | yarn create svelte@next my-app && cd my-app
yarn
yarn build

175 changes: 129 additions & 46 deletions .pnp.cjs

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
28 changes: 28 additions & 0 deletions .yarn/versions/42ed2c88.yml
@@ -0,0 +1,28 @@
releases:
"@yarnpkg/cli": minor
"@yarnpkg/plugin-pnp": minor
"@yarnpkg/pnp": minor

declined:
- "@yarnpkg/esbuild-plugin-pnp"
- "@yarnpkg/plugin-compat"
- "@yarnpkg/plugin-constraints"
- "@yarnpkg/plugin-dlx"
- "@yarnpkg/plugin-essentials"
- "@yarnpkg/plugin-init"
- "@yarnpkg/plugin-interactive-tools"
- "@yarnpkg/plugin-nm"
- "@yarnpkg/plugin-npm-cli"
- "@yarnpkg/plugin-pack"
- "@yarnpkg/plugin-patch"
- "@yarnpkg/plugin-pnpm"
- "@yarnpkg/plugin-stage"
- "@yarnpkg/plugin-typescript"
- "@yarnpkg/plugin-version"
- "@yarnpkg/plugin-workspace-tools"
- "@yarnpkg/builder"
- "@yarnpkg/core"
- "@yarnpkg/doctor"
- "@yarnpkg/nm"
- "@yarnpkg/pnpify"
- "@yarnpkg/sdks"
2 changes: 2 additions & 0 deletions .yarnrc.yml
Expand Up @@ -3,6 +3,8 @@ changesetIgnorePatterns:

enableGlobalCache: false

pnpEnableExperimentalEsm: false

immutablePatterns:
- .pnp.*

Expand Down
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -113,6 +113,7 @@ On top of our classic integration tests, we also run Yarn every day against the
[![](https://github.com/yarnpkg/berry/workflows/E2E%20Gulp/badge.svg?event=schedule)](https://github.com/yarnpkg/berry/blob/master/.github/workflows/e2e-gulp-workflow.yml)<br/>
[![](https://github.com/yarnpkg/berry/workflows/E2E%20Next/badge.svg?event=schedule)](https://github.com/yarnpkg/berry/blob/master/.github/workflows/e2e-next-workflow.yml)<br/>
[![](https://github.com/yarnpkg/berry/workflows/E2E%20Preact%20CLI/badge.svg?event=schedule)](https://github.com/yarnpkg/berry/blob/master/.github/workflows/e2e-preact-cli-workflow.yml)<br/>
[![](https://github.com/yarnpkg/berry/workflows/E2E%20SvelteKit/badge.svg?event=schedule)](https://github.com/yarnpkg/berry/blob/master/.github/workflows/e2e-svelte-kit-workflow.yml)<br/>
[![](https://github.com/yarnpkg/berry/workflows/E2E%20Vue-CLI/badge.svg?event=schedule)](https://github.com/yarnpkg/berry/blob/master/.github/workflows/e2e-vue-cli-workflow.yml)<br/>
</td><td valign="top">

Expand Down
@@ -0,0 +1 @@
console.log(42);
@@ -0,0 +1,6 @@
{
"name": "no-deps-bins-esm",
"version": "1.0.0",
"type": "module",
"bin": "./index.mjs"
}
@@ -0,0 +1 @@
module.exports.foo = 42;
@@ -0,0 +1,4 @@
{
"name": "no-deps-exports",
"version": "1.0.0"
}