Remove shamefully-hoist (#4842)

This commit is contained in:
Bjorn Lu 2022-09-28 23:13:33 +08:00 committed by GitHub
parent f4bca41a2d
commit 812658ad2a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
104 changed files with 768 additions and 527 deletions

View file

@ -0,0 +1,5 @@
---
'@astrojs/image': patch
---
Specify sharp as optional peer dependency

View file

@ -0,0 +1,5 @@
---
'@astrojs/markdown-remark': patch
---
Fix non-hoisted remark/rehype plugin loading

View file

@ -0,0 +1,15 @@
---
'astro': patch
'@astrojs/image': patch
'@astrojs/mdx': patch
'@astrojs/netlify': patch
'@astrojs/preact': patch
'@astrojs/rss': patch
'@astrojs/svelte': patch
'@astrojs/tailwind': patch
'@astrojs/vue': patch
'@astrojs/markdown-remark': patch
'@astrojs/telemetry': patch
---
Add missing dependencies, support strict dependency installation (e.g. pnpm)

View file

@ -0,0 +1,5 @@
---
'@astrojs/rss': patch
---
Remove path-browserify dependency

View file

@ -207,8 +207,9 @@ jobs:
repository: withastro/docs
path: smoke/docs
# NOTE: remove shamefully-hoist when docs is also not hoisted
- name: Install dependencies
run: pnpm install --no-frozen-lockfile
run: pnpm install --no-frozen-lockfile --shamefully-hoist
- name: Build Packages
run: pnpm run build

26
.npmrc
View file

@ -4,19 +4,13 @@ link-workspace-packages=true
save-workspace-protocol=false # This prevents the examples to have the `workspace:` prefix
auto-install-peers=false
shamefully-hoist=true
# TODO: We would like to move to individual opt-in hoisting, but Astro was not originally
# written with this in mind. In the future, it would be good to hoist individual packages only.
# 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
# `github-slugger` is used by `vite-plugin-markdown-legacy`.
# Temporarily hoist this until we remove the feature.
public-hoist-pattern[]=github-slugger
# Vite's esbuild optimizer has trouble optimizing `@astrojs/lit/client-shim.js`
# which imports this dependency.
public-hoist-pattern[]=@webcomponents/template-shadowroot
# On Windows, `svelte-preprocess` can't import `svelte/compiler`. Might be a pnpm bug.
public-hoist-pattern[]=svelte
# There's a lit dependency duplication somewhere causing multiple Lit versions error.
public-hoist-pattern[]=*lit*

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,2 +1 @@
# Expose Astro dependencies for `pnpm` users
shamefully-hoist=true
public-hoist-pattern[]=*lit*

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -41,7 +41,7 @@
"node": "^14.18.0 || >=16.12.0",
"pnpm": ">=7.9.5"
},
"packageManager": "pnpm@7.9.5",
"packageManager": "pnpm@7.12.2",
"pnpm": {
"packageExtensions": {
"svelte2tsx": {
@ -74,6 +74,7 @@
"@changesets/changelog-github": "0.4.4",
"@changesets/cli": "2.23.0",
"@octokit/action": "^3.18.1",
"@types/node": "^18.7.21",
"@typescript-eslint/eslint-plugin": "^5.27.1",
"@typescript-eslint/parser": "^5.27.1",
"del": "^7.0.0",

View file

@ -1,10 +1,8 @@
import npath from 'path-browserify';
/** Normalize URL to its canonical form */
export function createCanonicalURL(url: string, base?: string): URL {
let pathname = url.replace(/\/index.html$/, ''); // index.html is not canonical
pathname = pathname.replace(/\/1\/?$/, ''); // neither is a trailing /1/ (impl. detail of collections)
if (!npath.extname(pathname)) pathname = pathname.replace(/(\/+)?$/, '/'); // add trailing slash if theres no extension
if (!getUrlExtension(url)) pathname = pathname.replace(/(\/+)?$/, '/'); // add trailing slash if theres no extension
pathname = pathname.replace(/\/+/g, '/'); // remove duplicate slashes (URL() wont)
return new URL(pathname, base);
}
@ -17,3 +15,9 @@ export function isValidURL(url: string): boolean {
} catch (e) {}
return false;
}
function getUrlExtension(url: string) {
const lastDot = url.lastIndexOf('.');
const lastSlash = url.lastIndexOf('/');
return lastDot > lastSlash ? url.slice(lastDot + 1) : '';
}

View file

@ -1,4 +1,7 @@
import { defineConfig } from 'astro/config';
import preact from '@astrojs/preact'
// https://astro.build/config
export default defineConfig({});
export default defineConfig({
integrations: [preact()]
});

View file

@ -3,6 +3,8 @@
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
"@astrojs/preact": "^1.1.0",
"astro": "workspace:*",
"preact": "^10.11.0"
}
}

View file

@ -3,7 +3,8 @@
"version": "0.0.0",
"private": true,
"dependencies": {
"@astrojs/preact": "workspace:*",
"astro": "workspace:*",
"@astrojs/preact": "workspace:*"
"preact": "^10.11.0"
}
}

View file

@ -3,13 +3,17 @@
"version": "0.0.0",
"private": true,
"dependencies": {
"@astrojs/react": "workspace:*",
"@astrojs/preact": "workspace:*",
"@astrojs/react": "workspace:*",
"@astrojs/solid-js": "workspace:*",
"@astrojs/svelte": "workspace:*",
"@astrojs/vue": "workspace:*",
"astro": "workspace:*",
"preact": "^10.11.0",
"react": "^18.1.0",
"react-dom": "^18.1.0"
"react-dom": "^18.1.0",
"solid-js": "^1.5.6",
"svelte": "^3.50.1",
"vue": "^3.2.39"
}
}

View file

@ -7,7 +7,8 @@
"build": "astro build"
},
"dependencies": {
"@astrojs/preact": "workspace:*",
"astro": "workspace:*",
"@astrojs/preact": "workspace:*"
"preact": "^10.11.0"
}
}

View file

@ -3,11 +3,9 @@
"version": "0.0.0",
"private": true,
"dependencies": {
"@astrojs/mdx": "workspace:*",
"@astrojs/solid-js": "workspace:*",
"astro": "workspace:*",
"@astrojs/mdx": "workspace:*"
},
"devDependencies": {
"solid-js": "^1.4.3"
"solid-js": "^1.5.5"
}
}

View file

@ -3,7 +3,10 @@
"version": "0.0.0",
"private": true,
"dependencies": {
"@astrojs/tailwind": "workspace:*",
"astro": "workspace:*",
"@astrojs/tailwind": "workspace:*"
"autoprefixer": "^10.4.7",
"postcss": "^8.4.14",
"tailwindcss": "^3.0.24"
}
}

View file

@ -3,8 +3,9 @@
"version": "0.0.0",
"private": true,
"dependencies": {
"@astrojs/mdx": "workspace:*",
"@astrojs/vue": "workspace:*",
"astro": "workspace:*",
"@astrojs/mdx": "workspace:*"
"vue": "^3.2.39"
}
}

View file

@ -164,11 +164,13 @@
"@types/debug": "^4.1.7",
"@types/diff": "^5.0.2",
"@types/estree": "^0.0.51",
"@types/hast": "^2.3.4",
"@types/mime": "^2.0.3",
"@types/mocha": "^9.1.1",
"@types/parse5": "^6.0.3",
"@types/path-browserify": "^1.0.0",
"@types/prettier": "^2.6.3",
"@types/prompts": "^2.0.14",
"@types/resolve": "^1.20.2",
"@types/rimraf": "^3.0.2",
"@types/send": "^0.17.1",
@ -178,8 +180,14 @@
"chai": "^4.3.6",
"cheerio": "^1.0.0-rc.11",
"mocha": "^9.2.2",
"node-fetch": "^3.2.5",
"rehype-autolink-headings": "^6.1.1",
"rehype-slug": "^5.0.1",
"rehype-toc": "^3.0.2",
"remark-code-titles": "^0.1.2",
"sass": "^1.52.2",
"srcset-parse": "^1.1.0"
"srcset-parse": "^1.1.0",
"unified": "^10.1.2"
},
"engines": {
"node": "^14.18.0 || >=16.12.0",

View file

@ -1,4 +1,7 @@
import { devices } from '@playwright/test';
// NOTE: Sometimes, tests fail with `TypeError: process.stdout.clearLine is not a function`
// for some reason. This comes from Vite, and is conditionally called based on `isTTY`.
// We set it to false here to skip this odd behavior.
process.stdout.isTTY = false;
const config = {
testMatch: 'e2e/*.test.js',

View file

@ -263,6 +263,12 @@ async function tryLoadConfig(
optimizeDeps: { entries: [] },
clearScreen: false,
appType: 'custom',
// NOTE: Vite doesn't externalize linked packages by default. During testing locally,
// these dependencies trip up Vite's dev SSR transform. In the future, we should
// avoid `vite.createServer` and use `loadConfigFromFile` instead.
ssr: {
external: ['@astrojs/mdx', '@astrojs/react'],
},
});
try {
const mod = await viteServer.ssrLoadModule(configPath);

View file

@ -130,6 +130,10 @@ export async function createVite(
},
ssr: {
noExternal: [...getSsrNoExternalDeps(settings.config.root), ...thirdPartyAstroPackages],
// shiki is imported by Code.astro, which is no-externalized (processed by Vite).
// However, shiki's deps are in CJS and trips up Vite's dev SSR transform, externalize
// shiki to load it with node instead.
external: mode === 'dev' ? ['shiki'] : [],
},
};

View file

@ -1,8 +1,5 @@
import { expect } from 'chai';
import * as cheerio from 'cheerio';
import { loadFixture } from './test-utils.js';
import * as fs from 'fs';
import { FormData, File } from 'node-fetch';
describe('API routes', () => {
/** @type {import('./test-utils').Fixture} */

View file

@ -8,6 +8,8 @@
"@astrojs/vue": "workspace:*",
"astro": "workspace:*",
"react": "^18.1.0",
"react-dom": "^18.1.0"
"react-dom": "^18.1.0",
"svelte": "^3.48.0",
"vue": "^3.2.39"
}
}

View file

@ -4,6 +4,7 @@
"private": true,
"dependencies": {
"@astrojs/svelte": "workspace:*",
"astro": "workspace:*"
"astro": "workspace:*",
"svelte": "^3.48.0"
}
}

View file

@ -4,6 +4,7 @@
"private": true,
"dependencies": {
"@astrojs/svelte": "workspace:*",
"astro": "workspace:*"
"astro": "workspace:*",
"svelte": "^3.48.0"
}
}

View file

@ -4,6 +4,7 @@
"private": true,
"dependencies": {
"@astrojs/preact": "workspace:*",
"astro": "workspace:*"
"astro": "workspace:*",
"preact": "^10.11.0"
}
}

View file

@ -6,6 +6,9 @@
"@astrojs/preact": "workspace:*",
"@astrojs/svelte": "workspace:*",
"@astrojs/vue": "workspace:*",
"astro": "workspace:*"
"astro": "workspace:*",
"preact": "^10.11.0",
"svelte": "^3.48.0",
"vue": "^3.2.39"
}
}

View file

@ -3,11 +3,12 @@
"version": "0.0.0",
"private": true,
"dependencies": {
"@astrojs/svelte": "workspace:*",
"@astrojs/react": "workspace:*",
"@astrojs/svelte": "workspace:*",
"@test/astro-client-only-pkg": "file:./pkg",
"astro": "workspace:*",
"react": "^18.1.0",
"react-dom": "^18.1.0",
"@test/astro-client-only-pkg": "file:./pkg"
"svelte": "^3.48.0"
}
}

View file

@ -7,6 +7,7 @@
"@astrojs/svelte": "workspace:*",
"astro": "workspace:*",
"react": "^18.1.0",
"react-dom": "^18.1.0"
"react-dom": "^18.1.0",
"svelte": "^3.48.0"
}
}

View file

@ -4,6 +4,7 @@
"private": true,
"dependencies": {
"@astrojs/vue": "workspace:*",
"astro": "workspace:*"
"astro": "workspace:*",
"vue": "^3.2.39"
}
}

View file

@ -4,6 +4,7 @@
"private": true,
"dependencies": {
"@astrojs/preact": "workspace:*",
"astro": "workspace:*"
"astro": "workspace:*",
"preact": "^10.11.0"
}
}

View file

@ -4,6 +4,7 @@
"private": true,
"dependencies": {
"@astrojs/preact": "workspace:*",
"astro": "workspace:*"
"astro": "workspace:*",
"preact": "^10.11.0"
}
}

View file

@ -1,7 +1,8 @@
{
"name": "@test/before-hydration",
"dependencies": {
"@astrojs/preact": "workspace:*",
"astro": "workspace:*",
"@astrojs/preact": "workspace:*"
"preact": "^10.11.0"
}
}

View file

@ -16,5 +16,9 @@
],
"devDependencies": {
"astro": "workspace:*"
},
"dependencies": {
"preact": "^10.11.0",
"react": "^18.2.0"
}
}

View file

@ -4,6 +4,7 @@
"private": true,
"dependencies": {
"@astrojs/preact": "workspace:",
"astro": "workspace:*"
"astro": "workspace:*",
"preact": "^10.11.0"
}
}

View file

@ -6,6 +6,9 @@
"@astrojs/preact": "workspace:*",
"@astrojs/svelte": "workspace:*",
"@astrojs/vue": "workspace:*",
"astro": "workspace:*"
"astro": "workspace:*",
"preact": "^10.11.0",
"svelte": "^3.48.0",
"vue": "^3.2.39"
}
}

View file

@ -7,7 +7,8 @@
"build": "astro build"
},
"dependencies": {
"@astrojs/preact": "workspace:*",
"astro": "workspace:*",
"@astrojs/preact": "workspace:*"
"preact": "^10.11.0"
}
}

View file

@ -4,6 +4,7 @@
"private": true,
"dependencies": {
"@astrojs/solid-js": "workspace:*",
"astro": "workspace:*"
"astro": "workspace:*",
"solid-js": "^1.5.6"
}
}

View file

@ -5,6 +5,8 @@
"dependencies": {
"@astrojs/preact": "workspace:*",
"@astrojs/svelte": "workspace:*",
"astro": "workspace:*"
"astro": "workspace:*",
"preact": "^10.11.0",
"svelte": "^3.48.0"
}
}

View file

@ -4,6 +4,8 @@
"private": true,
"dependencies": {
"@astrojs/lit": "workspace:*",
"astro": "workspace:*"
"@webcomponents/template-shadowroot": "^0.1.0",
"astro": "workspace:*",
"lit": "^2.2.5"
}
}

View file

@ -8,7 +8,10 @@
"@astrojs/vue": "workspace:*",
"astro": "workspace:*",
"autoprefixer": "^10.4.7",
"postcss": "^8.4.14"
"postcss": "^8.4.14",
"solid-js": "^1.5.6",
"svelte": "^3.48.0",
"vue": "^3.2.39"
},
"devDependencies": {
"postcss-preset-env": "^7.7.1"

View file

@ -4,6 +4,7 @@
"private": true,
"dependencies": {
"@astrojs/preact": "workspace:*",
"astro": "workspace:*"
"astro": "workspace:*",
"preact": "^10.11.0"
}
}

View file

@ -1,8 +1,11 @@
{
"name": "@test/react-and-solid",
"dependencies": {
"astro": "workspace:*",
"@astrojs/react": "workspace:*",
"@astrojs/solid-js": "workspace:*"
"@astrojs/solid-js": "workspace:*",
"astro": "workspace:*",
"react": "^18.2.0",
"react-dom": "^18.1.0",
"solid-js": "^1.5.6"
}
}

View file

@ -1,7 +1,8 @@
{
"name": "@test/reexport-astro-containing-client-component",
"dependencies": {
"@astrojs/preact": "workspace:",
"astro": "workspace:",
"@astrojs/preact": "workspace:"
"preact": "^10.11.0"
}
}

View file

@ -5,6 +5,7 @@
"dependencies": {
"@astrojs/mdx": "workspace:*",
"@astrojs/preact": "workspace:*",
"astro": "workspace:*"
"astro": "workspace:*",
"preact": "^10.11.0"
}
}

View file

@ -5,6 +5,7 @@
"dependencies": {
"@astrojs/mdx": "workspace:*",
"@astrojs/solid-js": "workspace:*",
"astro": "workspace:*"
"astro": "workspace:*",
"solid-js": "^1.5.6"
}
}

View file

@ -5,6 +5,7 @@
"dependencies": {
"@astrojs/mdx": "workspace:*",
"@astrojs/svelte": "workspace:*",
"astro": "workspace:*"
"astro": "workspace:*",
"svelte": "^3.48.0"
}
}

View file

@ -5,6 +5,7 @@
"dependencies": {
"@astrojs/mdx": "workspace:*",
"@astrojs/vue": "workspace:*",
"astro": "workspace:*"
"astro": "workspace:*",
"vue": "^3.2.39"
}
}

View file

@ -4,6 +4,7 @@
"private": true,
"dependencies": {
"@astrojs/solid-js": "workspace:*",
"astro": "workspace:*"
"astro": "workspace:*",
"solid-js": "^1.5.6"
}
}

View file

@ -3,7 +3,8 @@
"version": "0.0.0",
"private": true,
"dependencies": {
"@astrojs/preact": "workspace:*",
"astro": "workspace:*",
"@astrojs/preact": "workspace:*"
"preact": "^10.11.0"
}
}

View file

@ -4,6 +4,7 @@
"private": true,
"dependencies": {
"@astrojs/preact": "workspace:",
"astro": "workspace:*"
"astro": "workspace:*",
"preact": "^10.11.0"
}
}

View file

@ -3,9 +3,10 @@
"version": "0.0.0",
"private": true,
"dependencies": {
"@astrojs/react": "workspace:*",
"@astrojs/preact": "workspace:*",
"@astrojs/react": "workspace:*",
"astro": "workspace:*",
"preact": "^10.11.0",
"react": "^18.1.0",
"react-dom": "^18.1.0"
}

View file

@ -4,6 +4,7 @@
"dependencies": {
"@astrojs/preact": "workspace:*",
"@test/static-build-pkg": "workspace:*",
"astro": "workspace:*"
"astro": "workspace:*",
"preact": "^10.11.0"
}
}

View file

@ -4,6 +4,7 @@
"private": true,
"dependencies": {
"@astrojs/svelte": "workspace:*",
"astro": "workspace:*"
"astro": "workspace:*",
"svelte": "^3.48.0"
}
}

View file

@ -4,6 +4,7 @@
"private": true,
"dependencies": {
"@astrojs/vue": "workspace:*",
"astro": "workspace:*"
"astro": "workspace:*",
"vue": "^3.2.39"
}
}

View file

@ -3,8 +3,10 @@
"version": "0.0.0",
"private": true,
"dependencies": {
"@astrojs/vue": "workspace:*",
"@astrojs/svelte": "workspace:*",
"astro": "workspace:*"
"@astrojs/vue": "workspace:*",
"astro": "workspace:*",
"svelte": "^3.48.0",
"vue": "^3.2.39"
}
}

View file

@ -35,6 +35,9 @@
"devDependencies": {
"astro": "workspace:*",
"astro-scripts": "workspace:*",
"chai": "^4.3.6",
"cheerio": "^1.0.0-rc.11",
"mocha": "^9.2.2",
"wrangler": "^2.0.23"
}
}

View file

@ -45,14 +45,29 @@
"@altano/tiny-async-pool": "^1.0.2",
"image-size": "^1.0.2",
"magic-string": "^0.25.9",
"mime": "^3.0.0"
"mime": "^3.0.0",
"slash": "^4.0.0"
},
"devDependencies": {
"@types/mime": "^2.0.3",
"@types/sharp": "^0.30.5",
"astro": "workspace:*",
"astro-scripts": "workspace:*",
"chai": "^4.3.6",
"cheerio": "^1.0.0-rc.11",
"kleur": "^4.1.4",
"mocha": "^9.2.2",
"rollup-plugin-copy": "^3.4.0",
"sharp": "^0.31.0",
"vite": "^3.0.0",
"web-streams-polyfill": "^3.2.1"
},
"peerDependencies": {
"sharp": ">=0.31.0"
},
"peerDependenciesMeta": {
"sharp": {
"optional": true
}
}
}

View file

@ -38,7 +38,10 @@
"devDependencies": {
"astro": "workspace:*",
"astro-scripts": "workspace:*",
"chai": "^4.3.6",
"cheerio": "^1.0.0-rc.11",
"lit": "^2.2.5",
"mocha": "^9.2.2",
"sass": "^1.52.2"
},
"peerDependencies": {

View file

@ -49,17 +49,21 @@
"devDependencies": {
"@types/chai": "^4.3.1",
"@types/estree": "^1.0.0",
"@types/github-slugger": "^1.3.0",
"@types/mocha": "^9.1.1",
"@types/yargs-parser": "^21.0.0",
"astro": "workspace:*",
"astro-scripts": "workspace:*",
"chai": "^4.3.6",
"cheerio": "^1.0.0-rc.11",
"linkedom": "^0.14.12",
"mdast-util-mdx": "^2.0.0",
"mdast-util-to-string": "^3.1.0",
"mocha": "^9.2.2",
"reading-time": "^1.5.0",
"remark-shiki-twoslash": "^3.1.0",
"remark-toc": "^8.0.1"
"remark-toc": "^8.0.1",
"vite": "^3.0.0"
},
"engines": {
"node": "^14.18.0 || >=16.12.0"

View file

@ -1,8 +1,10 @@
{
"name": "@test/mdx-namespace",
"dependencies": {
"astro": "workspace:*",
"@astrojs/mdx": "workspace:*",
"@astrojs/react": "workspace:*"
"@astrojs/react": "workspace:*",
"astro": "workspace:*",
"react": "^18.2.0",
"react-dom": "^18.1.0"
}
}

View file

@ -1,7 +1,9 @@
{
"name": "@test/mdx-page",
"dependencies": {
"@astrojs/mdx": "workspace:*",
"astro": "workspace:*",
"@astrojs/mdx": "workspace:*"
"react": "^18.2.0",
"react-dom": "^18.2.0"
}
}

View file

@ -1,8 +1,10 @@
{
"name": "@test/mdx-plus-react",
"dependencies": {
"astro": "workspace:*",
"@astrojs/mdx": "workspace:*",
"@astrojs/react": "workspace:*"
"@astrojs/react": "workspace:*",
"astro": "workspace:*",
"react": "^18.2.0",
"react-dom": "^18.2.0"
}
}

View file

@ -42,6 +42,10 @@
"@netlify/functions": "^1.0.0",
"@types/node": "^14.18.20",
"astro": "workspace:*",
"astro-scripts": "workspace:*"
"astro-scripts": "workspace:*",
"chai": "^4.3.6",
"cheerio": "^1.0.0-rc.11",
"mocha": "^9.2.2",
"vite": "^3.0.0"
}
}

View file

@ -34,6 +34,8 @@
"devDependencies": {
"astro": "workspace:*",
"astro-scripts": "workspace:*",
"chai": "^4.3.6",
"mocha": "^9.2.2",
"node-mocks-http": "^1.11.0"
}
}

View file

@ -52,17 +52,9 @@ function getCompatRenderer(development: boolean): AstroRenderer {
function getViteConfiguration(compat?: boolean): ViteUserConfig {
const viteConfig: ViteUserConfig = {
optimizeDeps: {
include: [
'@astrojs/preact/client.js',
'preact',
'preact/jsx-runtime',
'preact-render-to-string',
],
include: ['@astrojs/preact/client.js', 'preact', 'preact/jsx-runtime'],
exclude: ['@astrojs/preact/server.js'],
},
ssr: {
external: ['preact-render-to-string'],
},
};
if (compat) {
@ -81,12 +73,9 @@ function getViteConfiguration(compat?: boolean): ViteUserConfig {
dedupe: ['preact/compat', 'preact'],
};
// noExternal React entrypoints to be bundled, resolved, and aliased by Vite
viteConfig.ssr!.noExternal = [
'react',
'react-dom',
'react-dom/test-utils',
'react/jsx-runtime',
];
viteConfig.ssr = {
noExternal: ['react', 'react-dom', 'react-dom/test-utils', 'react/jsx-runtime'],
};
}
return viteConfig;

View file

@ -29,6 +29,7 @@
"test:match": "playwright test -g"
},
"devDependencies": {
"@playwright/test": "^1.26.0",
"@types/chai": "^4.3.1",
"@types/chai-as-promised": "^7.1.5",
"@types/mocha": "^9.1.1",

View file

@ -1,4 +1,7 @@
import { devices } from '@playwright/test';
// NOTE: Prefetch tests fail with `TypeError: process.stdout.clearLine is not a function`
// for some reason. This comes from Vite, and is conditionally called based on `isTTY`.
// We set it to false here to skip this odd behavior.
process.stdout.isTTY = false;
const config = {
testMatch: 'test/*.test.js',

View file

@ -39,6 +39,8 @@
"devDependencies": {
"astro": "workspace:*",
"astro-scripts": "workspace:*",
"chai": "^4.3.6",
"mocha": "^9.2.2",
"xml2js": "0.4.23"
}
}

View file

@ -36,13 +36,13 @@
"@sveltejs/vite-plugin-svelte": "^1.0.1",
"postcss-load-config": "^3.1.4",
"svelte-preprocess": "^4.10.7",
"svelte2tsx": "^0.5.11",
"vite": "^3.0.0"
"svelte2tsx": "^0.5.11"
},
"devDependencies": {
"astro": "workspace:*",
"astro-scripts": "workspace:*",
"svelte": "^3.48.0"
"svelte": "^3.48.0",
"vite": "^3.0.0"
},
"peerDependencies": {
"svelte": "^3.46.4"

View file

@ -34,7 +34,8 @@
},
"devDependencies": {
"astro": "workspace:*",
"astro-scripts": "workspace:*"
"astro-scripts": "workspace:*",
"tailwindcss": "^3.0.24"
},
"peerDependencies": {
"tailwindcss": "^3.0.24"

View file

@ -49,6 +49,8 @@
},
"devDependencies": {
"astro": "workspace:*",
"astro-scripts": "workspace:*"
"astro-scripts": "workspace:*",
"chai": "^4.3.6",
"mocha": "^9.2.2"
}
}

View file

@ -34,11 +34,12 @@
},
"dependencies": {
"@vitejs/plugin-vue": "^3.0.0",
"vite": "^3.0.0"
"@vue/compiler-sfc": "^3.2.39"
},
"devDependencies": {
"astro": "workspace:*",
"astro-scripts": "workspace:*",
"vite": "^3.0.0",
"vue": "^3.2.37"
},
"peerDependencies": {

View file

@ -21,11 +21,16 @@
"test": "mocha --exit --timeout 20000"
},
"devDependencies": {
"@types/mocha": "^9.1.1",
"astro": "workspace:*",
"chai": "^4.3.6",
"cheerio": "^1.0.0-rc.11",
"github-slugger": "^1.4.0",
"mocha": "^9.2.2",
"@types/mocha": "^9.1.1"
"rehype-autolink-headings": "^6.1.1",
"rehype-slug": "^5.0.1",
"rehype-toc": "^3.0.2",
"remark-code-titles": "^0.1.2"
},
"keywords": [
"astro",

View file

@ -12,6 +12,8 @@ describe('Astro Markdown', () => {
await fixture.build();
});
// NOTE: This test uses legacy markdown, which requires `github-slugger` to be installed.
// This breaks in strict dependency installation, but since it's a legacy feature, ignore for now.
it('Can load markdown pages with Astro', async () => {
const html = await fixture.readFile('/post/index.html');
const $ = cheerio.load(html);

View file

@ -3,10 +3,11 @@
"version": "0.0.0",
"private": true,
"dependencies": {
"@astrojs/preact": "workspace:*",
"@astrojs/markdown-component": "workspace:*",
"@astrojs/preact": "workspace:*",
"astro": "workspace:*",
"hast-util-select": "^5.0.2",
"preact": "^10.11.0",
"rehype-slug": "^5.0.1"
}
}

View file

@ -3,9 +3,11 @@
"version": "0.0.0",
"private": true,
"dependencies": {
"@astrojs/markdown-component": "workspace:*",
"@astrojs/preact": "workspace:*",
"@astrojs/svelte": "workspace:*",
"@astrojs/markdown-component": "workspace:*",
"astro": "workspace:*"
"astro": "workspace:*",
"preact": "^10.11.0",
"svelte": "^3.48.0"
}
}

View file

@ -30,6 +30,8 @@
"acorn-jsx": "^5.3.2",
"github-slugger": "^1.4.0",
"hast-util-to-html": "^8.0.3",
"import-meta-resolve": "^2.1.0",
"mdast-util-from-markdown": "^1.2.0",
"mdast-util-mdx-expression": "^1.2.1",
"mdast-util-mdx-jsx": "^1.2.0",
"micromark-extension-mdx-expression": "^1.0.3",

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