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: jobs:
# Lint can run in parallel with Build. # Lint can run in parallel with Build.
# We also run `yarn install` with the `--prefer-offline` flag to speed things up.
lint: lint:
name: Lint name: Lint
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -28,14 +27,19 @@ jobs:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Setup PNPM
uses: pnpm/action-setup@v2.0.1
with:
version: 6.23.6
- name: Setup Node - name: Setup Node
uses: actions/setup-node@v2 uses: actions/setup-node@v2
with: with:
node-version: 16 node-version: 16
cache: 'yarn' cache: 'pnpm'
- name: Install NPM Dependencies - 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: env:
CI: true 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 # Lint autofix cannot run on forks, so just skip those! See https://github.com/wearerequired/lint-action/issues/13
- name: Lint (External) - name: Lint (External)
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.owner.login != github.repository_owner }} 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 # Otherwise, run lint autofixer
- name: Lint - name: Lint
@ -80,39 +84,36 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Setup PNPM
uses: pnpm/action-setup@v2.0.1
with:
version: 6.23.6
- name: Setup Node - name: Setup Node
uses: actions/setup-node@v2 uses: actions/setup-node@v2
with: with:
node-version: 16 node-version: 16
cache: 'yarn' cache: 'pnpm'
- 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 - 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: env:
CI: true CI: true
- name: Build Packages - name: Build Packages
run: yarn build --force run: pnpm run build
- name: Upload Package Artifacts - name: Upload Package Artifacts
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: artifacts name: artifacts
path: packages/**/dist/** path: |
packages/**/dist/**
packages/webapi/mod.js
packages/webapi/mod.js.map
if-no-files-found: error if-no-files-found: error
# Test depends on Build's output, which allows us to skip any build process! # 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: test:
name: 'Test: ${{ matrix.os }} (node@${{ matrix.node_version }})' name: 'Test: ${{ matrix.os }} (node@${{ matrix.node_version }})'
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
@ -132,11 +133,16 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 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 }} - name: Setup node@${{ matrix.node_version }}
uses: actions/setup-node@v2 uses: actions/setup-node@v2
with: with:
node-version: ${{ matrix.node_version }} node-version: ${{ matrix.node_version }}
cache: 'yarn' cache: 'pnpm'
- name: Download Build Artifacts - name: Download Build Artifacts
uses: actions/download-artifact@v2 uses: actions/download-artifact@v2
@ -144,29 +150,13 @@ jobs:
- name: Extract Artifacts - name: Extract Artifacts
run: ./.github/extract-artifacts.sh 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 - 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: env:
CI: true CI: true
- name: Test - name: Test
if: ${{ matrix.os != 'windows-latest' }} run: pnpm run test
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
smoke: smoke:
name: 'Test (Smoke) ${{ matrix.os }}' name: 'Test (Smoke) ${{ matrix.os }}'
@ -182,11 +172,19 @@ jobs:
with: with:
submodules: 'recursive' 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 - name: Setup Node
uses: actions/setup-node@v2 uses: actions/setup-node@v2
with: with:
node-version: 14 node-version: 14
cache: 'yarn' cache: 'pnpm'
- name: Download Build Artifacts - name: Download Build Artifacts
uses: actions/download-artifact@v2 uses: actions/download-artifact@v2
@ -194,24 +192,11 @@ jobs:
- name: Extract Artifacts - name: Extract Artifacts
run: ./.github/extract-artifacts.sh 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 - 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: pnpm install --frozen-lockfile=false
run: yarn install --prefer-offline --ignore-engines --registry https://registry.npmjs.org --network-timeout 300000
env:
CI: true
- name: Test - name: Test
run: yarn test:smoke run: pnpm run test:smoke
- name: Memory Leak Test - name: Memory Leak Test
run: | run: |
@ -231,11 +216,16 @@ jobs:
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Setup PNPM
uses: pnpm/action-setup@v2.0.1
with:
version: 6.23.6
- name: Setup Node - name: Setup Node
uses: actions/setup-node@v2 uses: actions/setup-node@v2
with: with:
node-version: 16 node-version: 16
cache: 'yarn' cache: 'pnpm'
- name: Download Build Artifacts - name: Download Build Artifacts
uses: actions/download-artifact@v2 uses: actions/download-artifact@v2
@ -243,18 +233,8 @@ jobs:
- name: Extract Artifacts - name: Extract Artifacts
run: ./.github/extract-artifacts.sh 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 - 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: env:
CI: true CI: true
@ -262,7 +242,7 @@ jobs:
id: changesets id: changesets
uses: changesets/action@v1 uses: changesets/action@v1
with: with:
publish: yarn changeset publish publish: pnpm exec changeset publish
commit: '[ci] release' commit: '[ci] release'
title: '[ci] release' title: '[ci] release'
env: env:

View file

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

View file

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

View file

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

View file

@ -1,8 +1,8 @@
--- ---
# Commands to start on workspace startup # Commands to start on workspace startup
tasks: tasks:
- init: yarn install - init: pnpm install
command: yarn build command: pnpm run build
vscode: vscode:
extensions: extensions:
# TODO Once astro is on [vsx](https://open-vsx.org/), we should be able to specify it as an extension as well! # 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 ```shell
node: "^14.15.0 || >=16.0.0" node: "^14.15.0 || >=16.0.0"
yarn: "^1.22.10" pnpm: "^6.23.6"
# otherwise, your build will fail # otherwise, your build will fail
``` ```
### Setting up your local repo ### 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 ```shell
git clone && cd ... git clone && cd ...
yarn install pnpm install
yarn build 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. 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 ```shell
# starts a file-watching, live-reloading dev script for active development # starts a file-watching, live-reloading dev script for active development
yarn dev pnpm run dev
# build the entire project, one time. # build the entire project, one time.
yarn build pnpm run build
``` ```
#### Debugging Vite #### Debugging Vite
@ -53,11 +53,10 @@ DEBUG=vite:[name] astro dev # debug specific process, e.g. "vite:deps" or "vit
```shell ```shell
# run this in the top-level project root to run all tests # run this in the top-level project root to run all tests
yarn test pnpm run test
# run only a few tests, based on describe() or it() string match # run only a few tests, great for working on a single feature
# great for development, and working on a single feature! # (example - `pnpm run test:match "RSS"` runs `astro-rss.test.js`)
# (example - `yarn test:match "RSS"` runs tests in `astro-rss.test.js`) pnpm run test:match "$STRING_MATCH"
yarn test:match "$STRING_MATCH"
``` ```
### Other useful commands ### Other useful commands
@ -65,13 +64,13 @@ yarn test:match "$STRING_MATCH"
```shell ```shell
# auto-format the entire project # auto-format the entire project
# (optional - a GitHub Action formats every commit after a PR is merged) # (optional - a GitHub Action formats every commit after a PR is merged)
yarn format pnpm run format
``` ```
```shell ```shell
# lint the project # lint the project
# (optional - our linter creates helpful warnings, but not errors.) # (optional - our linter creates helpful warnings, but not errors.)
yarn lint pnpm run lint
``` ```
### Making a Pull Request ### 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. 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 ```shell
yarn changeset pnpm exec changeset
``` ```
### Running benchmarks ### 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): We have benchmarks to keep performance under control. You can run these by running (from the project root):
```shell ```shell
yarn workspace astro run benchmark pnpm run benchmark --filter astro
``` ```
Which will fail if the performance has regressed by **10%** or more. 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` # Note: XXX should be a keyword to identify this release. Ex: `--snapshot routing` & `--tag next--routing`
# 1: # 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. # 2: (Manual) review the diff, and make sure that you're not releasing more than you need to.
git checkout -- examples/ git checkout -- examples/
# 3: # 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 # 4: (Manual) review the publish, and if you're happy then you can throw out all local changes
git reset --hard 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: 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 - Create a new PR from the changes created by this command
- Review, approve, and more the PR to enter prerelease mode. - 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)". - 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 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. - Create a new PR from the changes created by this command.
- Review, approve, and more the PR to enter prerelease mode. - 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". - 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. 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. Point `release/0.X` to the latest commit for the `v0.X` version.
1. `git cherry-pick` commits from `main`, as needed. 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. Make sure that all changesets for the new release are included. You can create some manually (via `pnpm exec changeset`) if needed.
1. Run `yarn changeset version` to create your new release. 1. Run `pnpm exec changeset version` to create your new release.
1. Run `yarn release` to publish 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 && 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. 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. 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) ### 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: 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 # Expose Astro dependencies for `pnpm` users
shamefully-hoist = true shamefully-hoist=true

View file

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

View file

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

View file

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

View file

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

View file

@ -2,10 +2,6 @@
"name": "@example/component", "name": "@example/component",
"version": "0.0.1", "version": "0.0.1",
"private": true, "private": true,
"workspaces": [
"demo",
"packages/*"
],
"scripts": { "scripts": {
"start": "astro --project-root demo dev", "start": "astro --project-root demo dev",
"build": "astro --project-root demo build", "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 # Expose Astro dependencies for `pnpm` users
shamefully-hoist = true shamefully-hoist=true

View file

@ -9,11 +9,12 @@
"preview": "astro preview" "preview": "astro preview"
}, },
"dependencies": { "dependencies": {
"@docsearch/css": "^3.0.0",
"@docsearch/react": "^1.0.0-alpha.28" "@docsearch/react": "^1.0.0-alpha.28"
}, },
"devDependencies": { "devDependencies": {
"astro": "^0.23.7", "@astrojs/renderer-react": "^0.5.0",
"@astrojs/renderer-preact": "^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 # Expose Astro dependencies for `pnpm` users
shamefully-hoist = true 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" "preview": "astro preview"
}, },
"devDependencies": { "devDependencies": {
"@astrojs/renderer-vue": "^0.4.0",
"@astrojs/renderer-preact": "^0.5.0",
"astro": "^0.23.7", "astro": "^0.23.7",
"preact": "~10.6.5", "sass": "^1.49.8",
"unocss": "^0.15.5", "unocss": "^0.15.5",
"vite-imagetools": "^4.0.1", "vite-imagetools": "^4.0.1",
"@astrojs/renderer-vue": "^0.4.0" "@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 grayscaleUrl from '../images/random.jpg?grayscale=true';
import Greeting from '../components/Greeting.vue'; import Greeting from '../components/Greeting.vue';
import Counter from '../components/Counter.vue'; import Counter from '../components/Counter.vue';
import { Code } from 'astro/components'; // import { Code } from 'astro/components';
import InlineHoisted from '../components/InlineHoisted.astro'; import InlineHoisted from '../components/InlineHoisted.astro';
import ExternalHoisted from '../components/ExternalHoisted.astro'; import ExternalHoisted from '../components/ExternalHoisted.astro';
--- ---
@ -48,9 +48,9 @@ import ExternalHoisted from '../components/ExternalHoisted.astro';
<section> <section>
<h1>Astro components</h1> <h1>Astro components</h1>
<Code lang="css" code={`body { <!-- <Code lang="css" code={`body {
color: salmon; color: salmon;
}`} /> }`} /> -->
</section> </section>
<section> <section>

View file

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

View file

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

View file

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

View file

@ -9,11 +9,12 @@
"preview": "astro preview" "preview": "astro preview"
}, },
"devDependencies": { "devDependencies": {
"@astrojs/renderer-solid": "^0.4.0", "@astrojs/renderer-lit": "^0.4.0",
"astro": "^0.23.7",
"@astrojs/renderer-preact": "^0.5.0", "@astrojs/renderer-preact": "^0.5.0",
"@astrojs/renderer-react": "^0.5.0", "@astrojs/renderer-react": "^0.5.0",
"@astrojs/renderer-svelte": "^0.5.1", "@astrojs/renderer-solid": "^0.4.0",
"@astrojs/renderer-vue": "^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 # Expose Astro dependencies for `pnpm` users
shamefully-hoist = true shamefully-hoist=true

View file

@ -9,7 +9,7 @@
"preview": "astro preview" "preview": "astro preview"
}, },
"devDependencies": { "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 # Expose Astro dependencies for `pnpm` users
shamefully-hoist = true shamefully-hoist=true

View file

@ -9,7 +9,7 @@
"preview": "astro preview" "preview": "astro preview"
}, },
"devDependencies": { "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 # Expose Astro dependencies for `pnpm` users
shamefully-hoist = true shamefully-hoist=true

View file

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

View file

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

View file

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

View file

@ -9,7 +9,7 @@
"preview": "astro preview" "preview": "astro preview"
}, },
"devDependencies": { "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 # Expose Astro dependencies for `pnpm` users
shamefully-hoist = true shamefully-hoist=true

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -9,7 +9,7 @@
"preview": "astro preview" "preview": "astro preview"
}, },
"devDependencies": { "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.stdout.pipe(process.stdout);
api.stderr.pipe(process.stderr); 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.stdout.pipe(process.stdout);
build.stderr.pipe(process.stderr); build.stderr.pipe(process.stderr);
await build; await build;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -9,7 +9,11 @@
// @ts-check // @ts-check
export default /** @type {import('astro').AstroUserConfig} */ ( 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" "preview": "astro preview"
}, },
"devDependencies": { "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" "astro": "^0.23.7"
} }
} }

View file

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

View file

@ -16,6 +16,10 @@
"solid-nanostores": "0.0.6" "solid-nanostores": "0.0.6"
}, },
"devDependencies": { "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", "@astrojs/renderer-solid": "^0.4.0",
"astro": "^0.23.7", "astro": "^0.23.7",
"@astrojs/renderer-preact": "^0.5.0", "@astrojs/renderer-preact": "^0.5.0",

View file

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

View file

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

View file

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

View file

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

View file

@ -10,6 +10,7 @@
}, },
"devDependencies": { "devDependencies": {
"astro": "^0.23.7", "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" "url": "https://github.com/withastro/astro.git"
}, },
"scripts": { "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": "turbo run build --no-deps --scope=astro --scope=create-astro --scope=\"@astrojs/*\"",
"build:examples": "turbo run build --scope=\"@example/*\"", "build:examples": "turbo run build --scope=\"@example/*\"",
"dev": "turbo run dev --no-deps --no-cache --parallel --scope=astro --scope=create-astro --scope=\"@astrojs/*\"", "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": "pnpm run test --filter astro --filter @astrojs/webapi",
"test:match": "cd packages/astro && yarn run test:match", "test:match": "cd packages/astro && pnpm run test:match",
"test:templates": "turbo run test --scope=create-astro", "test:templates": "pnpm run test --filter create-astro",
"test:smoke": "node scripts/smoke/index.js", "test:smoke": "node scripts/smoke/index.js",
"benchmark": "turbo run benchmark --scope=astro", "benchmark": "turbo run benchmark --scope=astro",
"lint": "eslint \"packages/**/*.ts\"", "lint": "eslint \"packages/**/*.ts\"",
@ -36,7 +36,15 @@
], ],
"volta": { "volta": {
"node": "14.17.0", "node": "14.17.0",
"yarn": "1.22.10" "npm": "7.11.2"
},
"pnpm": {
"peerDependencyRules": {
"ignoreMissing": [
"@babel/core",
"@babel/plugin-transform-react-jsx"
]
}
}, },
"devDependencies": { "devDependencies": {
"@changesets/changelog-github": "^0.4.2", "@changesets/changelog-github": "^0.4.2",
@ -53,11 +61,14 @@
"prettier": "^2.4.1", "prettier": "^2.4.1",
"pretty-bytes": "^6.0.0", "pretty-bytes": "^6.0.0",
"tiny-glob": "^0.2.8", "tiny-glob": "^0.2.8",
"turbo": "^1.0.0", "turbo": "^1.1.5",
"typescript": "4.5.2" "typescript": "4.5.2"
}, },
"engines": { "engines": {
"node": "^14.15.0 || >=16.0.0" "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" "dist"
], ],
"scripts": { "scripts": {
"prepublish": "yarn build", "prepublish": "pnpm run build",
"build": "astro-scripts build \"src/**/*.ts\" && tsc -p tsconfig.json", "build": "astro-scripts build \"src/**/*.ts\" && tsc -p tsconfig.json",
"dev": "astro-scripts dev \"src/**/*.ts\"" "dev": "astro-scripts dev \"src/**/*.ts\""
}, },
"dependencies": { "dependencies": {
"@types/node": "^15.12.2",
"acorn": "^8.6.0", "acorn": "^8.6.0",
"locate-character": "^2.0.5", "locate-character": "^2.0.5",
"magic-string": "^0.25.3" "magic-string": "^0.25.3"
}, },
"devDependencies": { "devDependencies": {
"astro-scripts": "0.0.1" "astro-scripts": "workspace:*"
}, },
"engines": { "engines": {
"node": "^14.15.0 || >=16.0.0", "node": "^14.15.0 || >=16.0.0",

View file

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

View file

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

View file

@ -53,7 +53,7 @@ async function compile(config: AstroConfig, filename: string, source: string, vi
site: config.buildOptions.site, site: config.buildOptions.site,
sourcefile: filename, sourcefile: filename,
sourcemap: 'both', sourcemap: 'both',
internalURL: 'astro/internal', internalURL: `/@fs${new URL('../runtime/server/index.js', import.meta.url).pathname}`,
experimentalStaticExtraction: config.buildOptions.experimentalStaticBuild, experimentalStaticExtraction: config.buildOptions.experimentalStaticBuild,
// TODO add experimental flag here // TODO add experimental flag here
preprocessStyle: async (value: string, attrs: Record<string, string>) => { 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 * as eslexer from 'es-module-lexer';
import path from 'path'; import path from 'path';
import { error } from '../core/logger.js'; 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_RENDERER_CACHE = new WeakMap<AstroConfig, Map<string, Renderer>>();
const JSX_EXTENSIONS = new Set(['.jsx', '.tsx']); const JSX_EXTENSIONS = new Set(['.jsx', '.tsx']);
@ -28,15 +28,15 @@ function getEsbuildLoader(fileExt: string): string {
return fileExt.substr(1); 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>(); const renderers = new Map<string, Renderer>();
await Promise.all( await Promise.all(
rendererNames.map((name) => config.renderers.map((name) => {
import(name).then(({ default: renderer }) => { return import(resolveDependency(name, config)).then(({ default: renderer }) => {
if (!renderer.jsxImportSource) return; if (!renderer.jsxImportSource) return;
renderers.set(renderer.jsxImportSource, renderer); renderers.set(renderer.jsxImportSource, renderer);
}) })
) })
); );
return renderers; return renderers;
} }
@ -100,7 +100,7 @@ export default function jsx({ config, logging }: AstroPluginJSXOptions): Plugin
// load renderers (on first run only) // load renderers (on first run only)
if (!jsxRenderers) { if (!jsxRenderers) {
jsxRenderers = new Map(); jsxRenderers = new Map();
const possibleRenderers = await importJSXRenderers(config.renderers); const possibleRenderers = await importJSXRenderers(config);
if (possibleRenderers.size === 0) { 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 // 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( throw new Error(

View file

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