Skip to content

Commit

Permalink
Move from yarn to pnpm (withastro#2455)
Browse files Browse the repository at this point in the history
* 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:https:// 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 <[email protected]>

* 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 <[email protected]>
  • Loading branch information
natemoo-re and JuanM04 committed Mar 8, 2022
1 parent 208d12b commit 95a7874
Show file tree
Hide file tree
Showing 78 changed files with 592 additions and 20 deletions.
14 changes: 9 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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/*",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion src/core/build/static-build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/vite-plugin-astro/compile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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>) => {
Expand Down
12 changes: 6 additions & 6 deletions src/vite-plugin-jsx/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
Expand All @@ -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;
}
Expand Down Expand Up @@ -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(
Expand Down
3 changes: 2 additions & 1 deletion src/vite-plugin-markdown/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)};
Expand Down
8 changes: 8 additions & 0 deletions test/fixtures/0-css/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "@astrojs/test-0-css",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}
8 changes: 8 additions & 0 deletions test/fixtures/astro-assets/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "@astrojs/test-astro-assets",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}
8 changes: 8 additions & 0 deletions test/fixtures/astro-attrs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "@astrojs/test-astro-attrs",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}
8 changes: 8 additions & 0 deletions test/fixtures/astro-basic/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "@astrojs/test-astro-basic",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}
8 changes: 8 additions & 0 deletions test/fixtures/astro-children/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "@astrojs/test-astro-children",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}
8 changes: 8 additions & 0 deletions test/fixtures/astro-class-list/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "@astrojs/test-astro-class-list",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}
8 changes: 8 additions & 0 deletions test/fixtures/astro-client-only/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "@astrojs/test-astro-client-only",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}
8 changes: 8 additions & 0 deletions test/fixtures/astro-component-code/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "@astrojs/test-astro-component-code",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}
8 changes: 8 additions & 0 deletions test/fixtures/astro-components/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "@astrojs/test-astro-components",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}
8 changes: 8 additions & 0 deletions test/fixtures/astro-css-bundling-import/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "@astrojs/test-astro-css-bundling-import",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}
8 changes: 8 additions & 0 deletions test/fixtures/astro-css-bundling-nested-layouts/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "@astrojs/test-astro-css-bundling-nested-layouts",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}
8 changes: 8 additions & 0 deletions test/fixtures/astro-css-bundling/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "@astrojs/test-astro-css-bundling",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}
8 changes: 8 additions & 0 deletions test/fixtures/astro-doctype/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "@astrojs/test-astro-doctype",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}
8 changes: 8 additions & 0 deletions test/fixtures/astro-dynamic/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "@astrojs/test-astro-dynamic",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}
8 changes: 8 additions & 0 deletions test/fixtures/astro-envs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "@astrojs/test-astro-envs",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}
8 changes: 8 additions & 0 deletions test/fixtures/astro-expr/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "@astrojs/test-astro-expr",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}
8 changes: 8 additions & 0 deletions test/fixtures/astro-external-files/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "@astrojs/test-astro-external-files",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}
8 changes: 8 additions & 0 deletions test/fixtures/astro-fallback/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "@astrojs/test-astro-fallback",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}
8 changes: 8 additions & 0 deletions test/fixtures/astro-get-static-paths/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "@astrojs/test-astro-get-static-paths",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}
8 changes: 8 additions & 0 deletions test/fixtures/astro-global/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "@astrojs/test-astro-global",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}
9 changes: 9 additions & 0 deletions test/fixtures/astro-jsx/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "@astrojs/test-astro-jsx",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*",
"@astrojs/renderer-solid": "workspace:*"
}
}
8 changes: 8 additions & 0 deletions test/fixtures/astro-markdown-drafts/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "@astrojs/test-astro-markdown-drafts",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}
9 changes: 9 additions & 0 deletions test/fixtures/astro-markdown-plugins/package.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
8 changes: 8 additions & 0 deletions test/fixtures/astro-markdown-shiki/langs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "@astrojs/test-astro-markdown-skiki-langs",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}
8 changes: 8 additions & 0 deletions test/fixtures/astro-markdown-shiki/normal/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "@astrojs/test-astro-markdown-skiki-normal",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}
8 changes: 8 additions & 0 deletions test/fixtures/astro-markdown-shiki/themes-custom/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "@astrojs/test-astro-markdown-skiki-themes-custom",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "@astrojs/test-astro-markdown-skiki-themes-integrated",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}
8 changes: 8 additions & 0 deletions test/fixtures/astro-markdown-shiki/wrap-false/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "@astrojs/test-astro-markdown-skiki-wrap-false",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}
8 changes: 8 additions & 0 deletions test/fixtures/astro-markdown-shiki/wrap-null/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "@astrojs/test-astro-markdown-skiki-wrap-null",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}
Loading

0 comments on commit 95a7874

Please sign in to comment.