0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00

Move from yarn to pnpm (#2455)

* chore: `yarn` => `pnpm`

* docs: `yarn` => `pnpm`

* chore(ci): yarn => pnpm

* chore(ci): update pnpm cache path

* fix: add missing deps

* fix: add missing deps

* test: add package.json to all test fixtures

* chore: improve hoisting behavior

* chore: move turbo into package.json

* chore: update npmrc

* fix: add missing `debug` dependency

* chore: remove prepare script

* test: fix new tests

* fix: fully resolve renderer paths and `astro/internal` path

* chore: update lockfile

* chore: remove log

* fix: resolve renderers in vite-plugin-jsx

* fix: prefer public-hoist-pattern to shamefully-hoist

* chore: ignore @babel/core peer warning

* chore: update dependencies

* test: add autoprefixer as explicit dep

* chore: update `.npmrc` file in examples

* chore: update dependencies

* fix: resolve renderer dependencies in static build

* fix: static build renderer resolution

* chore: fix smoke tests

* chore: hoist autoprefixer

* chore: update lockfile

* attempt: use full file:// path on Windows

* attempt: use astro/internal

* attempt: optimize astro/internal

* attempt: expose ./internal.js

* chore: add missing package.json files

* attempt: resolve astro/internal path

* chore: tidy package.json

* chore: update lockfile

* chore: update deps

* chore: update deps

* chore: yarn -> pnpm

* attempt: explicit /@fs urls

* attempt: explicit /@fs urls

* chore: update all examples for pnpm

* chore: fix hoisting for with-vite-plugin-pwa

* chore(ci): fix sharp install

* chore: update with-vite-plugin-pwa example

* fix: pin vite-plugin-pwa to 0.11.11

* fix: add workbox-window to vite-plugin-pwa deps

* refactor: use pnpm update --recursive

Co-authored-by: JuanM04 <me@juanm04.com>

* chore: yarn => pnpm

* chore: yarn => pnpm

* fix: update smoke test to skip examples which don't work in static build

* update lockfile

* chore: update .npmrc files

* chore: update lockfile

* fix: smoke script

* chore: update .npmrc file

* fix: return to shamefully-hoist (shamefully)

* chore: update lockfile

* fix(smoke): ignore scripts for smoke tests

* fix: update example to disable renderers

* chore: bump version

* chore(ci): fix smoke tests

* attempt: disable --frozen-lockfile for smoke tests

* chore: update smoke test

* chore: fix rebase issue

* chore: update lockfile

* fix: smoke tests

* fix(ci): run external smoke tests first

* fix(ci): run syntax

* chore: update lockfile

* fix(ci): ensure submodules are up-to-date

* fix(ci): ensure submodules are up-to-date

* chore: update lockfile

* chore: update for webapi

* chore: silence node:* warnings

* chore: update deps

* fix(ci): persist generated webapi assets

* fix(ci): webapi build script

* chore(ci): remove custom node caching

* chore: keep turbo.json

* chore: update turbo, ignore create-astro

* chore: update deps

* fix(ci): test command

* chore(ci): update test script

Co-authored-by: JuanM04 <me@juanm04.com>
This commit is contained in:
Nate Moore 2022-03-08 15:46:11 -06:00 committed by GitHub
parent 2f7a4f8eae
commit d08ddaf5b9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
161 changed files with 10965 additions and 21082 deletions

View file

@ -20,7 +20,6 @@ defaults:
jobs:
# Lint can run in parallel with Build.
# We also run `yarn install` with the `--prefer-offline` flag to speed things up.
lint:
name: Lint
runs-on: ubuntu-latest
@ -28,14 +27,19 @@ jobs:
- name: Check out repository
uses: actions/checkout@v2
- name: Setup PNPM
uses: pnpm/action-setup@v2.0.1
with:
version: 6.23.6
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: 16
cache: 'yarn'
cache: 'pnpm'
- name: Install NPM Dependencies
run: yarn install --prefer-offline --frozen-lockfile --ignore-engines --registry https://registry.npmjs.org --network-timeout 300000
run: pnpm install
env:
CI: true
@ -45,7 +49,7 @@ jobs:
# Lint autofix cannot run on forks, so just skip those! See https://github.com/wearerequired/lint-action/issues/13
- name: Lint (External)
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.owner.login != github.repository_owner }}
run: yarn lint
run: pnpm run lint
# Otherwise, run lint autofixer
- name: Lint
@ -80,39 +84,36 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PNPM
uses: pnpm/action-setup@v2.0.1
with:
version: 6.23.6
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: 16
cache: 'yarn'
- name: Cache Node Modules
id: cache-node
uses: actions/cache@v2
with:
path: "**/node_modules"
key: cache-node_modules-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ github.run_id }}
restore-keys: |
cache-node_modules-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ github.run_id }}
cache-node_modules-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-
cache: 'pnpm'
- name: Install NPM Dependencies
run: yarn install --prefer-offline --frozen-lockfile --ignore-engines --registry https://registry.npmjs.org --network-timeout 300000
run: pnpm install
env:
CI: true
- name: Build Packages
run: yarn build --force
run: pnpm run build
- name: Upload Package Artifacts
uses: actions/upload-artifact@v2
with:
name: artifacts
path: packages/**/dist/**
path: |
packages/**/dist/**
packages/webapi/mod.js
packages/webapi/mod.js.map
if-no-files-found: error
# Test depends on Build's output, which allows us to skip any build process!
# We also run `yarn install` with the `--prefer-offline` flag to speed things up.
test:
name: 'Test: ${{ matrix.os }} (node@${{ matrix.node_version }})'
runs-on: ${{ matrix.os }}
@ -132,11 +133,16 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PNPM
uses: pnpm/action-setup@v2.0.1
with:
version: 6.23.6
- name: Setup node@${{ matrix.node_version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node_version }}
cache: 'yarn'
cache: 'pnpm'
- name: Download Build Artifacts
uses: actions/download-artifact@v2
@ -144,29 +150,13 @@ jobs:
- name: Extract Artifacts
run: ./.github/extract-artifacts.sh
- name: Cache Node Modules
id: cache-node
uses: actions/cache@v2
with:
path: "**/node_modules"
key: cache-node_modules-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ github.run_id }}
restore-keys: |
cache-node_modules-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ github.run_id }}
cache-node_modules-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-
- name: Install NPM Dependencies
run: yarn install --prefer-offline --frozen-lockfile --ignore-engines --registry https://registry.npmjs.org --network-timeout 300000
run: pnpm install
env:
CI: true
- name: Test
if: ${{ matrix.os != 'windows-latest' }}
run: yarn test
# Turbo seems to make the tests hang on Windows, just run them directly
- name: Test (Windows)
if: ${{ matrix.os == 'windows-latest' }}
run: yarn workspace astro run test
run: pnpm run test
smoke:
name: 'Test (Smoke) ${{ matrix.os }}'
@ -182,11 +172,19 @@ jobs:
with:
submodules: 'recursive'
- name: Update submodules
run: git submodule update --remote
- name: Setup PNPM
uses: pnpm/action-setup@v2.0.1
with:
version: 6.23.6
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: 14
cache: 'yarn'
cache: 'pnpm'
- name: Download Build Artifacts
uses: actions/download-artifact@v2
@ -194,24 +192,11 @@ jobs:
- name: Extract Artifacts
run: ./.github/extract-artifacts.sh
- name: Cache Node Modules
id: cache-node
uses: actions/cache@v2
with:
path: "**/node_modules"
key: cache-node_modules-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ github.run_id }}
restore-keys: |
cache-node_modules-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ github.run_id }}
cache-node_modules-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-
- name: Install NPM Dependencies
# NOTE: Do NOT use `--frozen-lockfile` here! The lockfile needs to be updated in order to pull the submodules into the monorepo
run: yarn install --prefer-offline --ignore-engines --registry https://registry.npmjs.org --network-timeout 300000
env:
CI: true
run: pnpm install --frozen-lockfile=false
- name: Test
run: yarn test:smoke
run: pnpm run test:smoke
- name: Memory Leak Test
run: |
@ -230,12 +215,17 @@ jobs:
- uses: actions/checkout@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Setup PNPM
uses: pnpm/action-setup@v2.0.1
with:
version: 6.23.6
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: 16
cache: 'yarn'
cache: 'pnpm'
- name: Download Build Artifacts
uses: actions/download-artifact@v2
@ -243,18 +233,8 @@ jobs:
- name: Extract Artifacts
run: ./.github/extract-artifacts.sh
- name: Cache Node Modules
id: cache-node
uses: actions/cache@v2
with:
path: "**/node_modules"
key: cache-node_modules-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ github.run_id }}
restore-keys: |
cache-node_modules-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ github.run_id }}
cache-node_modules-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-
- name: Install NPM Dependencies
run: yarn install --prefer-offline --frozen-lockfile --ignore-engines --registry https://registry.npmjs.org --network-timeout 300000
run: pnpm install
env:
CI: true
@ -262,7 +242,7 @@ jobs:
id: changesets
uses: changesets/action@v1
with:
publish: yarn changeset publish
publish: pnpm exec changeset publish
commit: '[ci] release'
title: '[ci] release'
env:

View file

@ -13,19 +13,14 @@ jobs:
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- name: Set Node version to 16
uses: actions/setup-node@v2
with:
node-version: 16
cache: 'yarn'
- name: Install dependencies
run: yarn --frozen-lockfile --ignore-engines
- name: Install NPM Dependencies
run: pnpm install
env:
CI: true
- name: Format code
run: yarn format
run: pnpm run format
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: '[ci] yarn format'
commit_message: '[ci] format'
branch: ${{ github.head_ref }}

View file

@ -40,21 +40,25 @@ jobs:
run_job: ${{ steps.check_files.outputs.run_job }}
steps:
- uses: actions/checkout@v2
- name: Setup PNPM
uses: pnpm/action-setup@v2.0.1
with:
version: 6.23.6
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: 16
cache: 'yarn'
cache: 'pnpm'
- name: Install NPM Dependencies
if: steps.cache-npm.outputs.cache-hit != 'true'
run: yarn install --prefer-offline --frozen-lockfile --ignore-engines --registry https://registry.npmjs.org --network-timeout 300000
run: pnpm install
env:
CI: true
- name: Check Modified
run: yarn changeset status --output ./status.json
run: pnpm exec changeset status --output ./status.json
- name: Check Output
id: check_files

View file

@ -13,13 +13,23 @@ jobs:
steps:
- name: Check out code using Git
uses: actions/checkout@v2
- name: Set Node version to 16
- name: Setup PNPM
uses: pnpm/action-setup@v2.0.1
with:
version: 6.23.6
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: 16
cache: 'yarn'
- name: Install dependencies
run: yarn install --frozen-lockfile --ignore-engines --ignore-scripts
cache: 'pnpm'
- name: Install NPM Dependencies
run: pnpm install
env:
CI: true
- name: Collect stats
run: node scripts/stats/index.js
env:
@ -38,17 +48,21 @@ jobs:
- name: Check out code using Git
uses: actions/checkout@v2
- name: Set Node version to 16
- name: Setup PNPM
uses: pnpm/action-setup@v2.0.1
with:
version: 6.23.6
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: 16
cache: 'yarn'
cache: 'pnpm'
- name: Clear lockfile
run: rm -rf yarn.lock node_modules
- name: Install dependencies
run: yarn install --ignore-engines --ignore-scripts
- name: Install NPM Dependencies
run: pnpm upgrade --recursive
env:
CI: true
- name: Create Pull Request
id: createpr

View file

@ -1,8 +1,8 @@
---
# Commands to start on workspace startup
tasks:
- init: yarn install
command: yarn build
- init: pnpm install
command: pnpm run build
vscode:
extensions:
# TODO Once astro is on [vsx](https://open-vsx.org/), we should be able to specify it as an extension as well!

16
.npmrc Normal file
View file

@ -0,0 +1,16 @@
# Important! Never install `astro` even when new version is in registry
prefer-workspace-packages=true
# Rather than shamefully hoisting everything, just make problematic packages public
public-hoist-pattern[]=autoprefixer
public-hoist-pattern[]=astro
public-hoist-pattern[]=remark-*
public-hoist-pattern[]=rehype-*
public-hoist-pattern[]=react
public-hoist-pattern[]=react-dom
public-hoist-pattern[]=preact
public-hoist-pattern[]=preact-render-to-string
public-hoist-pattern[]=vue
public-hoist-pattern[]=svelte
public-hoist-pattern[]=solid-js
public-hoist-pattern[]=lit
public-hoist-pattern[]=@webcomponents/template-shadowroot

View file

@ -11,18 +11,18 @@ We welcome contributions of any size and skill level. As an open source project,
```shell
node: "^14.15.0 || >=16.0.0"
yarn: "^1.22.10"
pnpm: "^6.23.6"
# otherwise, your build will fail
```
### Setting up your local repo
Astro uses yarn workspaces, so you should **always run `yarn install` from the top-level project directory.** running `yarn install` in the top-level project root will install dependencies for `astro`, and every package in the repo.
Astro uses pnpm workspaces, so you should **always run `pnpm install` from the top-level project directory.** running `pnpm install` in the top-level project root will install dependencies for `astro`, and every package in the repo.
```shell
git clone && cd ...
yarn install
yarn build
pnpm install
pnpm run build
```
In [#2254](https://github.com/withastro/astro/pull/2254) a `.git-blame-ignore-revs` file was added to ignore repo-wide formatting changes. To improve your experience, you should run the following command locally.
@ -35,9 +35,9 @@ git config --local blame.ignoreRevsFile .git-blame-ignore-revs
```shell
# starts a file-watching, live-reloading dev script for active development
yarn dev
pnpm run dev
# build the entire project, one time.
yarn build
pnpm run build
```
#### Debugging Vite
@ -53,11 +53,10 @@ DEBUG=vite:[name] astro dev # debug specific process, e.g. "vite:deps" or "vit
```shell
# run this in the top-level project root to run all tests
yarn test
# run only a few tests, based on describe() or it() string match
# great for development, and working on a single feature!
# (example - `yarn test:match "RSS"` runs tests in `astro-rss.test.js`)
yarn test:match "$STRING_MATCH"
pnpm run test
# run only a few tests, great for working on a single feature
# (example - `pnpm run test:match "RSS"` runs `astro-rss.test.js`)
pnpm run test:match "$STRING_MATCH"
```
### Other useful commands
@ -65,13 +64,13 @@ yarn test:match "$STRING_MATCH"
```shell
# auto-format the entire project
# (optional - a GitHub Action formats every commit after a PR is merged)
yarn format
pnpm run format
```
```shell
# lint the project
# (optional - our linter creates helpful warnings, but not errors.)
yarn lint
pnpm run lint
```
### Making a Pull Request
@ -79,7 +78,7 @@ yarn lint
When making a pull request, be sure to add a changeset when something has changed with Astro. Non-packages (`examples/*`) do not need changesets.
```shell
yarn changeset
pnpm exec changeset
```
### Running benchmarks
@ -87,7 +86,7 @@ yarn changeset
We have benchmarks to keep performance under control. You can run these by running (from the project root):
```shell
yarn workspace astro run benchmark
pnpm run benchmark --filter astro
```
Which will fail if the performance has regressed by **10%** or more.
@ -143,11 +142,11 @@ To release a snapshot, run the following locally:
# Note: XXX should be a keyword to identify this release. Ex: `--snapshot routing` & `--tag next--routing`
# 1:
yarn changeset version --snapshot XXX
pnpm exec changeset version --snapshot XXX
# 2: (Manual) review the diff, and make sure that you're not releasing more than you need to.
git checkout -- examples/
# 3:
yarn release --tag next--XXX
pnpm run release --tag next--XXX
# 4: (Manual) review the publish, and if you're happy then you can throw out all local changes
git reset --hard
```
@ -166,7 +165,7 @@ Full documentation: https://github.com/atlassian/changesets/blob/main/docs/prere
If you have gotten permission from the core contributors, you can enter into prerelease mode by following the following steps:
- Run: `yarn changeset pre enter next` in the project root
- Run: `pnpm exec changeset pre enter next` in the project root
- Create a new PR from the changes created by this command
- Review, approve, and more the PR to enter prerelease mode.
- If successful, The "Version Packages" PR (if one exists) will now say "Version Packages (next)".
@ -175,7 +174,7 @@ If you have gotten permission from the core contributors, you can enter into pre
Exiting prerelease mode should happen once an experimental release is ready to go from `npm install astro@next` to `npm install astro`. Only a core contributor run these steps. These steps should be run before
- Run: `yarn changeset pre exit` in the project root
- Run: `pnpm exec changeset pre exit` in the project root
- Create a new PR from the changes created by this command.
- Review, approve, and more the PR to enter prerelease mode.
- If successful, The "Version Packages (next)" PR (if one exists) will now say "Version Packages".
@ -188,9 +187,9 @@ When in prerelease mode, the automatic PR release process will no longer release
1. Create a new `release/0.X` branch, if none exists.
1. Point `release/0.X` to the latest commit for the `v0.X` version.
1. `git cherry-pick` commits from `main`, as needed.
1. Make sure that all changesets for the new release are included. You can create some manually (via `yarn changeset`) if needed.
1. Run `yarn changeset version` to create your new release.
1. Run `yarn release` to publish your new release.
1. Make sure that all changesets for the new release are included. You can create some manually (via `pnpm exec changeset`) if needed.
1. Run `pnpm exec changeset version` to create your new release.
1. Run `pnpm exec release` to publish your new release.
1. Run `git push && git push --tags` to push your new release to GitHub.
1. Run `git push release/0.X:latest` to push your release branch to `latest`.
1. Go to https://github.com/withastro/astro/releases/new and create a new release. Copy the new changelog entry from https://github.com/withastro/astro/blob/latest/packages/astro/CHANGELOG.md.

View file

@ -10,9 +10,9 @@ For the RFC writing guide, check out the [RFC issue template](https://github.com
### Linting (Style Rules)
We use tools like ESLint and TypeScript to automatically enforce some parts of our style guide. Run the `yarn lint` command to lint the codebase. We also use tools like Prettier to automatically enforce code formatting. Run the `yarn format` command to format the entire codebase.
We use tools like ESLint and TypeScript to automatically enforce some parts of our style guide. Run the `pnpm run lint` command to lint the codebase. We also use tools like Prettier to automatically enforce code formatting. Run the `pnpm run format` command to format the entire codebase.
Anything enforced by linting and formatting is considered a **style rule.** It is strictly required that you follow all style rules while working in the codebase. Run the `yarn lint` and `yarn format` commands to check your code at any time.
Anything enforced by linting and formatting is considered a **style rule.** It is strictly required that you follow all style rules while working in the codebase. Run the `pnpm run lint` and `pnpm run format` commands to check your code at any time.
These style rules are maintained in configuration files, and therefore not documented in this document. Read any of the following configuration files to learn more about the style rules that we strictly enforced across the codebase:

View file

@ -1,2 +1,2 @@
## force pnpm to hoist
shamefully-hoist = true
# Expose Astro dependencies for `pnpm` users
shamefully-hoist=true

View file

@ -9,8 +9,8 @@
"preview": "astro preview"
},
"devDependencies": {
"@astrojs/renderer-preact": "^0.5.0",
"astro": "^0.23.7",
"sass": "^1.49.8",
"@astrojs/renderer-preact": "^0.5.0"
"sass": "^1.49.8"
}
}

View file

@ -1,2 +1,2 @@
## force pnpm to hoist
shamefully-hoist = true
# Expose Astro dependencies for `pnpm` users
shamefully-hoist=true

View file

@ -1,2 +1,2 @@
## force pnpm to hoist
shamefully-hoist = true
# Expose Astro dependencies for `pnpm` users
shamefully-hoist=true

View file

@ -9,6 +9,7 @@
"preview": "astro preview"
},
"devDependencies": {
"astro": "^0.23.7"
"astro": "^0.23.7",
"@example/my-component": "workspace:*"
}
}

View file

@ -2,10 +2,6 @@
"name": "@example/component",
"version": "0.0.1",
"private": true,
"workspaces": [
"demo",
"packages/*"
],
"scripts": {
"start": "astro --project-root demo dev",
"build": "astro --project-root demo build",

View file

@ -0,0 +1,3 @@
packages:
- "packages/**/*"
- "demo"

View file

@ -1,2 +1,2 @@
## force pnpm to hoist
shamefully-hoist = true
# Expose Astro dependencies for `pnpm` users
shamefully-hoist=true

View file

@ -9,11 +9,12 @@
"preview": "astro preview"
},
"dependencies": {
"@docsearch/css": "^3.0.0",
"@docsearch/react": "^1.0.0-alpha.28"
},
"devDependencies": {
"astro": "^0.23.7",
"@astrojs/renderer-react": "^0.5.0",
"@astrojs/renderer-preact": "^0.5.0",
"@astrojs/renderer-react": "^0.5.0"
"astro": "^0.23.7"
}
}

View file

@ -1,2 +1,2 @@
## force pnpm to hoist
shamefully-hoist = true
# Expose Astro dependencies for `pnpm` users
shamefully-hoist=true

View file

@ -0,0 +1,2 @@
# Expose Astro dependencies for `pnpm` users
shamefully-hoist=true

View file

@ -10,8 +10,10 @@
"preview": "astro preview"
},
"devDependencies": {
"@astrojs/renderer-vue": "^0.4.0",
"@astrojs/renderer-preact": "^0.5.0",
"astro": "^0.23.7",
"preact": "~10.6.5",
"sass": "^1.49.8",
"unocss": "^0.15.5",
"vite-imagetools": "^4.0.1",
"@astrojs/renderer-vue": "^0.4.0"

View file

@ -3,7 +3,7 @@ import imgUrl from '../images/penguin.jpg';
import grayscaleUrl from '../images/random.jpg?grayscale=true';
import Greeting from '../components/Greeting.vue';
import Counter from '../components/Counter.vue';
import { Code } from 'astro/components';
// import { Code } from 'astro/components';
import InlineHoisted from '../components/InlineHoisted.astro';
import ExternalHoisted from '../components/ExternalHoisted.astro';
---
@ -48,9 +48,9 @@ import ExternalHoisted from '../components/ExternalHoisted.astro';
<section>
<h1>Astro components</h1>
<Code lang="css" code={`body {
<!-- <Code lang="css" code={`body {
color: salmon;
}`} />
}`} /> -->
</section>
<section>

View file

@ -1,2 +1,2 @@
## force pnpm to hoist
shamefully-hoist = true
# Expose Astro dependencies for `pnpm` users
shamefully-hoist=true

View file

@ -1,2 +1,2 @@
## force pnpm to hoist
shamefully-hoist = true
# Expose Astro dependencies for `pnpm` users
shamefully-hoist=true

View file

@ -1,2 +1,2 @@
## force pnpm to hoist
shamefully-hoist = true
# Expose Astro dependencies for `pnpm` users
shamefully-hoist=true

View file

@ -9,11 +9,12 @@
"preview": "astro preview"
},
"devDependencies": {
"@astrojs/renderer-solid": "^0.4.0",
"astro": "^0.23.7",
"@astrojs/renderer-lit": "^0.4.0",
"@astrojs/renderer-preact": "^0.5.0",
"@astrojs/renderer-react": "^0.5.0",
"@astrojs/renderer-svelte": "^0.5.1",
"@astrojs/renderer-vue": "^0.4.0"
"@astrojs/renderer-solid": "^0.4.0",
"@astrojs/renderer-svelte": "^0.4.0",
"@astrojs/renderer-vue": "^0.4.0",
"astro": "^0.23.7"
}
}

View file

@ -1,2 +1,2 @@
## force pnpm to hoist
shamefully-hoist = true
# Expose Astro dependencies for `pnpm` users
shamefully-hoist=true

View file

@ -9,7 +9,7 @@
"preview": "astro preview"
},
"devDependencies": {
"astro": "^0.23.7",
"@astrojs/renderer-preact": "^0.5.0"
"@astrojs/renderer-preact": "^0.5.0",
"astro": "^0.23.7"
}
}

View file

@ -1,2 +1,2 @@
## force pnpm to hoist
shamefully-hoist = true
# Expose Astro dependencies for `pnpm` users
shamefully-hoist=true

View file

@ -9,7 +9,7 @@
"preview": "astro preview"
},
"devDependencies": {
"astro": "^0.23.7",
"@astrojs/renderer-react": "^0.5.0"
"@astrojs/renderer-react": "^0.5.0",
"astro": "^0.23.7"
}
}

View file

@ -1,2 +1,2 @@
## force pnpm to hoist
shamefully-hoist = true
# Expose Astro dependencies for `pnpm` users
shamefully-hoist=true

View file

@ -1,2 +1,2 @@
## force pnpm to hoist
shamefully-hoist = true
# Expose Astro dependencies for `pnpm` users
shamefully-hoist=true

View file

@ -9,7 +9,7 @@
"preview": "astro preview"
},
"devDependencies": {
"astro": "^0.23.7",
"@astrojs/renderer-svelte": "^0.5.1"
"@astrojs/renderer-svelte": "^0.4.0",
"astro": "^0.23.7"
}
}

View file

@ -1,2 +1,2 @@
## force pnpm to hoist
shamefully-hoist = true
# Expose Astro dependencies for `pnpm` users
shamefully-hoist=true

View file

@ -9,7 +9,7 @@
"preview": "astro preview"
},
"devDependencies": {
"astro": "^0.23.7",
"@astrojs/renderer-vue": "^0.4.0"
"@astrojs/renderer-vue": "^0.4.0",
"astro": "^0.23.7"
}
}

View file

@ -1,2 +1,2 @@
## force pnpm to hoist
shamefully-hoist = true
# Expose Astro dependencies for `pnpm` users
shamefully-hoist=true

View file

@ -1,2 +1,2 @@
## force pnpm to hoist
shamefully-hoist = true
# Expose Astro dependencies for `pnpm` users
shamefully-hoist=true

View file

@ -15,4 +15,3 @@ yarn-error.log*
# macOS-specific files
.DS_Store
pnpm-lock.yaml

View file

@ -1,2 +1,2 @@
## force pnpm to hoist
shamefully-hoist = true
# Expose Astro dependencies for `pnpm` users
shamefully-hoist=true

View file

@ -9,7 +9,7 @@
"preview": "astro preview"
},
"devDependencies": {
"astro": "^0.23.7",
"@astrojs/renderer-svelte": "^0.5.1"
"@astrojs/renderer-svelte": "^0.4.0",
"astro": "^0.23.7"
}
}

View file

@ -1,2 +1,2 @@
## force pnpm to hoist
shamefully-hoist = true
# Expose Astro dependencies for `pnpm` users
shamefully-hoist=true

View file

@ -9,7 +9,7 @@
"preview": "astro preview"
},
"devDependencies": {
"astro": "^0.23.7",
"@astrojs/renderer-preact": "^0.5.0"
"@astrojs/renderer-preact": "^0.5.0",
"astro": "^0.23.7"
}
}

2
examples/ssr/.npmrc Normal file
View file

@ -0,0 +1,2 @@
# Expose Astro dependencies for `pnpm` users
shamefully-hoist=true

View file

@ -4,7 +4,7 @@ const api = execa('npm', ['run', 'dev-api']);
api.stdout.pipe(process.stdout);
api.stderr.pipe(process.stderr);
const build = execa('yarn', ['astro', 'build', '--experimental-ssr']);
const build = execa('pnpm', ['astro', 'build', '--experimental-ssr']);
build.stdout.pipe(process.stdout);
build.stderr.pipe(process.stderr);
await build;

View file

@ -6,11 +6,12 @@
"dev-api": "node server/dev-api.mjs",
"dev": "npm run dev-api & astro dev --experimental-ssr",
"start": "astro dev",
"build": "echo 'Run yarn build-ssr instead'",
"build": "echo 'Run pnpm run build-ssr instead'",
"build-ssr": "node build.mjs",
"server": "node server/server.mjs"
},
"devDependencies": {
"@astrojs/renderer-svelte": "^0.4.0",
"astro": "^0.23.7",
"unocss": "^0.15.5",
"vite-imagetools": "^4.0.1",

View file

@ -1,2 +1,2 @@
## force pnpm to hoist
shamefully-hoist = true
# Expose Astro dependencies for `pnpm` users
shamefully-hoist=true

View file

@ -10,6 +10,6 @@
export default /** @type {import('astro').AstroUserConfig} */ (
{
// Set "renderers" to "[]" to disable all default, builtin component support.
// renderers: [],
renderers: [],
}
);

View file

@ -1,2 +1,2 @@
## force pnpm to hoist
shamefully-hoist = true
# Expose Astro dependencies for `pnpm` users
shamefully-hoist=true

View file

@ -1,2 +1,2 @@
## force pnpm to hoist
shamefully-hoist = true
# Expose Astro dependencies for `pnpm` users
shamefully-hoist=true

View file

@ -11,6 +11,7 @@ import addClasses from './add-classes.mjs';
// @ts-check
export default /** @type {import('astro').AstroUserConfig} */ ({
// Enable Custom Markdown options, plugins, etc.
renderers: [],
markdownOptions: {
render: [
astroRemark,

View file

@ -9,6 +9,7 @@
"preview": "astro preview"
},
"devDependencies": {
"@astrojs/markdown-remark": "^0.6.1",
"astro": "^0.23.7",
"hast-util-select": "5.0.1",
"rehype-autolink-headings": "^6.1.0",

View file

@ -1,2 +1,2 @@
## force pnpm to hoist
shamefully-hoist = true
# Expose Astro dependencies for `pnpm` users
shamefully-hoist=true

View file

@ -10,6 +10,7 @@ import astroRemark from '@astrojs/markdown-remark';
// @ts-check
export default /** @type {import('astro').AstroUserConfig} */ ({
// Enable Custom Markdown options, plugins, etc.
renderers: [],
markdownOptions: {
render: [
astroRemark,

View file

@ -9,6 +9,7 @@
"preview": "astro preview"
},
"devDependencies": {
"@astrojs/markdown-remark": "^0.6.1",
"astro": "^0.23.7"
}
}

View file

@ -1,2 +1,2 @@
## force pnpm to hoist
shamefully-hoist = true
# Expose Astro dependencies for `pnpm` users
shamefully-hoist=true

View file

@ -9,7 +9,11 @@
// @ts-check
export default /** @type {import('astro').AstroUserConfig} */ (
{
// Set "renderers" to "[]" to disable all default, builtin component support.
// renderers: [],
renderers: [
"@astrojs/renderer-preact",
"@astrojs/renderer-react",
"@astrojs/renderer-svelte",
"@astrojs/renderer-vue",
],
}
);

View file

@ -9,6 +9,11 @@
"preview": "astro preview"
},
"devDependencies": {
"@astrojs/renderer-preact": "^0.5.0",
"@astrojs/renderer-react": "^0.5.0",
"@astrojs/renderer-svelte": "^0.4.0",
"@astrojs/renderer-vue": "^0.4.0",
"@astrojs/markdown-remark": "^0.6.1",
"astro": "^0.23.7"
}
}

View file

@ -1,2 +1,2 @@
## force pnpm to hoist
shamefully-hoist = true
# Expose Astro dependencies for `pnpm` users
shamefully-hoist=true

View file

@ -16,6 +16,10 @@
"solid-nanostores": "0.0.6"
},
"devDependencies": {
"@astrojs/renderer-react": "^0.5.0",
"@astrojs/renderer-svelte": "^0.4.0",
"@astrojs/renderer-vue": "^0.4.0",
"@astrojs/renderer-preact": "^0.5.0",
"@astrojs/renderer-solid": "^0.4.0",
"astro": "^0.23.7",
"@astrojs/renderer-preact": "^0.5.0",

View file

@ -1,2 +1,2 @@
## force pnpm to hoist
shamefully-hoist = true
# Expose Astro dependencies for `pnpm` users
shamefully-hoist=true

View file

@ -9,6 +9,7 @@
"preview": "astro preview"
},
"devDependencies": {
"@astrojs/renderer-preact": "^0.5.0",
"astro": "^0.23.7",
"autoprefixer": "^10.4.0",
"tailwindcss": "^3.0.5",

View file

@ -1,2 +1,2 @@
## force pnpm to hoist
shamefully-hoist = true
# Expose Astro dependencies for `pnpm` users
shamefully-hoist=true

View file

@ -10,6 +10,7 @@ import { VitePWA } from 'vite-plugin-pwa';
// @ts-check
export default /** @type {import('astro').AstroUserConfig} */ ({
renderers: [],
vite: {
plugins: [VitePWA()],
},

View file

@ -10,6 +10,7 @@
},
"devDependencies": {
"astro": "^0.23.7",
"vite-plugin-pwa": "0.11.5"
"vite-plugin-pwa": "0.11.11",
"workbox-window": "^6.5.0"
}
}

View file

@ -7,13 +7,13 @@
"url": "https://github.com/withastro/astro.git"
},
"scripts": {
"release": "yarn build && changeset publish",
"release": "pnpm run build && changeset publish",
"build": "turbo run build --no-deps --scope=astro --scope=create-astro --scope=\"@astrojs/*\"",
"build:examples": "turbo run build --scope=\"@example/*\"",
"dev": "turbo run dev --no-deps --no-cache --parallel --scope=astro --scope=create-astro --scope=\"@astrojs/*\"",
"test": "turbo run test --scope=astro --scope=\"@astrojs/*\"",
"test:match": "cd packages/astro && yarn run test:match",
"test:templates": "turbo run test --scope=create-astro",
"test": "pnpm run test --filter astro --filter @astrojs/webapi",
"test:match": "cd packages/astro && pnpm run test:match",
"test:templates": "pnpm run test --filter create-astro",
"test:smoke": "node scripts/smoke/index.js",
"benchmark": "turbo run benchmark --scope=astro",
"lint": "eslint \"packages/**/*.ts\"",
@ -36,7 +36,15 @@
],
"volta": {
"node": "14.17.0",
"yarn": "1.22.10"
"npm": "7.11.2"
},
"pnpm": {
"peerDependencyRules": {
"ignoreMissing": [
"@babel/core",
"@babel/plugin-transform-react-jsx"
]
}
},
"devDependencies": {
"@changesets/changelog-github": "^0.4.2",
@ -53,11 +61,14 @@
"prettier": "^2.4.1",
"pretty-bytes": "^6.0.0",
"tiny-glob": "^0.2.8",
"turbo": "^1.0.0",
"turbo": "^1.1.5",
"typescript": "4.5.2"
},
"engines": {
"node": "^14.15.0 || >=16.0.0"
},
"packageManager": "yarn@1.22.5"
"packageManager": "pnpm@6.23.6",
"dependencies": {
"@astrojs/webapi": "workspace:*"
}
}

View file

@ -17,17 +17,18 @@
"dist"
],
"scripts": {
"prepublish": "yarn build",
"prepublish": "pnpm run build",
"build": "astro-scripts build \"src/**/*.ts\" && tsc -p tsconfig.json",
"dev": "astro-scripts dev \"src/**/*.ts\""
},
"dependencies": {
"@types/node": "^15.12.2",
"acorn": "^8.6.0",
"locate-character": "^2.0.5",
"magic-string": "^0.25.3"
},
"devDependencies": {
"astro-scripts": "0.0.1"
"astro-scripts": "workspace:*"
},
"engines": {
"node": "^14.15.0 || >=16.0.0",

View file

@ -16,12 +16,12 @@
"exports": {
".": "./astro.js",
"./env": "./env.d.ts",
"./internal": "./internal.js",
"./app/node": "./dist/core/app/node.js",
"./client/*": "./dist/runtime/client/*",
"./components": "./components/index.js",
"./components/*": "./components/*",
"./debug": "./components/Debug.astro",
"./internal": "./dist/runtime/server/index.js",
"./internal/*": "./dist/runtime/server/*",
"./package.json": "./package.json",
"./runtime/*": "./dist/runtime/*",
@ -71,12 +71,10 @@
"@babel/traverse": "^7.15.4",
"@proload/core": "^0.2.2",
"@proload/plugin-tsm": "^0.1.0",
"@types/babel__core": "^7.1.15",
"@types/debug": "^4.1.7",
"@types/yargs-parser": "^20.2.1",
"@web/parse5-utils": "^1.3.0",
"ci-info": "^3.2.0",
"common-ancestor-path": "^1.0.1",
"debug": "^4.3.3",
"eol": "^0.9.1",
"es-module-lexer": "^0.9.3",
"esbuild": "0.13.7",
@ -115,15 +113,21 @@
"devDependencies": {
"@astrojs/parser": "^0.22.1",
"@babel/types": "^7.15.6",
"@types/babel__core": "^7.1.15",
"@types/babel__traverse": "^7.14.2",
"@types/chai": "^4.2.22",
"@types/common-ancestor-path": "^1.0.0",
"@types/connect": "^3.4.35",
"@types/debug": "^4.1.7",
"@types/estree": "^0.0.50",
"@types/mime": "^2.0.3",
"@types/mocha": "^9.0.0",
"@types/node-fetch": "^3.0.0",
"@types/parse5": "^6.0.3",
"@types/resolve": "^1.20.1",
"@types/rimraf": "^3.0.2",
"@types/send": "^0.17.1",
"@types/yargs-parser": "^20.2.1",
"astro-scripts": "workspace:*",
"chai": "^4.3.4",
"cheerio": "^1.0.0-rc.10",
"execa": "^6.0.0",

View file

@ -15,6 +15,7 @@ import glob from 'fast-glob';
import * as vite from 'vite';
import { debug, error } from '../../core/logger.js';
import { prependForwardSlash, appendForwardSlash } from '../../core/path.js';
import { resolveDependency } from '../../core/util.js';
import { createBuildInternals } from '../../core/build/internal.js';
import { rollupPluginAstroBuildCSS } from '../../vite-plugin-build-css/index.js';
import { emptyDir, prepareOutDir } from './fs.js';
@ -273,7 +274,7 @@ async function collectRenderers(opts: StaticBuildOptions): Promise<Renderer[]> {
const renderers = await Promise.all(
viteLoadedRenderers.map(async (r) => {
const mod = await import(r.serverEntry);
const mod = await import(resolveDependency(r.serverEntry, opts.astroConfig));
return Object.create(r, {
ssr: {
value: mod.default,

View file

@ -53,7 +53,7 @@ async function compile(config: AstroConfig, filename: string, source: string, vi
site: config.buildOptions.site,
sourcefile: filename,
sourcemap: 'both',
internalURL: 'astro/internal',
internalURL: `/@fs${new URL('../runtime/server/index.js', import.meta.url).pathname}`,
experimentalStaticExtraction: config.buildOptions.experimentalStaticBuild,
// TODO add experimental flag here
preprocessStyle: async (value: string, attrs: Record<string, string>) => {

View file

@ -9,7 +9,7 @@ import * as colors from 'kleur/colors';
import * as eslexer from 'es-module-lexer';
import path from 'path';
import { error } from '../core/logger.js';
import { parseNpmName } from '../core/util.js';
import { parseNpmName, resolveDependency } from '../core/util.js';
const JSX_RENDERER_CACHE = new WeakMap<AstroConfig, Map<string, Renderer>>();
const JSX_EXTENSIONS = new Set(['.jsx', '.tsx']);
@ -28,15 +28,15 @@ function getEsbuildLoader(fileExt: string): string {
return fileExt.substr(1);
}
async function importJSXRenderers(rendererNames: string[]): Promise<Map<string, Renderer>> {
async function importJSXRenderers(config: AstroConfig): Promise<Map<string, Renderer>> {
const renderers = new Map<string, Renderer>();
await Promise.all(
rendererNames.map((name) =>
import(name).then(({ default: renderer }) => {
config.renderers.map((name) => {
return import(resolveDependency(name, config)).then(({ default: renderer }) => {
if (!renderer.jsxImportSource) return;
renderers.set(renderer.jsxImportSource, renderer);
})
)
})
);
return renderers;
}
@ -100,7 +100,7 @@ export default function jsx({ config, logging }: AstroPluginJSXOptions): Plugin
// load renderers (on first run only)
if (!jsxRenderers) {
jsxRenderers = new Map();
const possibleRenderers = await importJSXRenderers(config.renderers);
const possibleRenderers = await importJSXRenderers(config);
if (possibleRenderers.size === 0) {
// note: we have filtered out all non-JSX files, so this error should only show if a JSX file is loaded with no matching renderers
throw new Error(

View file

@ -3,6 +3,7 @@ import type { AstroConfig } from '../@types/astro';
import esbuild from 'esbuild';
import fs from 'fs';
import { fileURLToPath } from 'url';
import { transform } from '@astrojs/compiler';
interface AstroPluginOptions {
@ -59,7 +60,7 @@ ${setup}`.trim();
site: config.buildOptions.site,
sourcefile: id,
sourcemap: 'inline',
internalURL: 'astro/internal',
internalURL: `/@fs${new URL('../runtime/server/index.js', import.meta.url).pathname}`,
});
tsResult = `\nexport const metadata = ${JSON.stringify(metadata)};

View file

@ -0,0 +1,8 @@
{
"name": "@astrojs/test-0-css",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}

View file

@ -0,0 +1,8 @@
{
"name": "@astrojs/test-astro-assets",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}

View file

@ -0,0 +1,8 @@
{
"name": "@astrojs/test-astro-attrs",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}

View file

@ -0,0 +1,8 @@
{
"name": "@astrojs/test-astro-basic",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}

View file

@ -0,0 +1,8 @@
{
"name": "@astrojs/test-astro-children",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}

View file

@ -0,0 +1,8 @@
{
"name": "@astrojs/test-astro-class-list",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}

View file

@ -0,0 +1,8 @@
{
"name": "@astrojs/test-astro-client-only",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}

View file

@ -0,0 +1,8 @@
{
"name": "@astrojs/test-astro-component-code",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}

View file

@ -0,0 +1,8 @@
{
"name": "@astrojs/test-astro-components",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}

View file

@ -0,0 +1,8 @@
{
"name": "@astrojs/test-astro-css-bundling-import",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}

View file

@ -0,0 +1,8 @@
{
"name": "@astrojs/test-astro-css-bundling-nested-layouts",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}

View file

@ -0,0 +1,8 @@
{
"name": "@astrojs/test-astro-css-bundling",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}

View file

@ -0,0 +1,8 @@
{
"name": "@astrojs/test-astro-doctype",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}

View file

@ -0,0 +1,8 @@
{
"name": "@astrojs/test-astro-dynamic",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}

View file

@ -0,0 +1,8 @@
{
"name": "@astrojs/test-astro-envs",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}

View file

@ -0,0 +1,8 @@
{
"name": "@astrojs/test-astro-expr",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}

View file

@ -0,0 +1,8 @@
{
"name": "@astrojs/test-astro-external-files",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}

View file

@ -0,0 +1,8 @@
{
"name": "@astrojs/test-astro-fallback",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}

View file

@ -0,0 +1,8 @@
{
"name": "@astrojs/test-astro-get-static-paths",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}

View file

@ -0,0 +1,8 @@
{
"name": "@astrojs/test-astro-global",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}

View file

@ -0,0 +1,9 @@
{
"name": "@astrojs/test-astro-jsx",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*",
"@astrojs/renderer-solid": "workspace:*"
}
}

View file

@ -0,0 +1,8 @@
{
"name": "@astrojs/test-astro-markdown-drafts",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}

View file

@ -0,0 +1,9 @@
{
"name": "@astrojs/test-astro-markdown-plugins",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*",
"hast-util-select": "^5.0.1"
}
}

View file

@ -0,0 +1,8 @@
{
"name": "@astrojs/test-astro-markdown-skiki-langs",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}

View file

@ -0,0 +1,8 @@
{
"name": "@astrojs/test-astro-markdown-skiki-normal",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}

View file

@ -0,0 +1,8 @@
{
"name": "@astrojs/test-astro-markdown-skiki-themes-custom",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}

View file

@ -0,0 +1,8 @@
{
"name": "@astrojs/test-astro-markdown-skiki-themes-integrated",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}

View file

@ -0,0 +1,8 @@
{
"name": "@astrojs/test-astro-markdown-skiki-wrap-false",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}

View file

@ -0,0 +1,8 @@
{
"name": "@astrojs/test-astro-markdown-skiki-wrap-null",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}

View file

@ -0,0 +1,8 @@
{
"name": "@astrojs/test-astro-markdown-skiki-wrap-true",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}

Some files were not shown because too many files have changed in this diff Show more