From c0d9ed832ecf9531ce2dd55699d7c25b775c147a Mon Sep 17 00:00:00 2001 From: Drew Powers <1369770+drwpow@users.noreply.github.com> Date: Tue, 2 Nov 2021 08:13:36 -0600 Subject: [PATCH] Enable Windows tests (#1712) --- .github/workflows/ci.yml | 24 +- .github/workflows/format.yml | 18 +- .github/workflows/release.yml | 7 +- .github/workflows/stat.yml | 22 +- packages/astro/src/core/build/index.ts | 6 +- packages/astro/src/core/ssr/index.ts | 7 +- packages/astro/src/vite-plugin-astro/index.ts | 3 +- .../vite/dist/node/chunks/dep-35df7f96.js | 637 +++++++++--------- 8 files changed, 366 insertions(+), 358 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f52a7fad0..d6bc6c7f6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,19 +18,18 @@ jobs: matrix: os: [ubuntu-latest] node_version: [12, 14, 16] - # TODO: uncomment this (Vite has trouble resolving imports on Windows) - # include: - # - os: windows-latest - # node_version: 14 + include: + - os: windows-latest + node_version: 16 fail-fast: false env: LANG: en-us name: 'Test: node-${{ matrix.node_version }}, ${{ matrix.os }}' steps: - - name: Checkout + - name: Check out code using Git uses: actions/checkout@v2 - - name: Set node version to ${{ matrix.node_version }} + - name: Set Node version to ${{ matrix.node_version }} uses: actions/setup-node@v2 with: node-version: ${{ matrix.node_version }} @@ -50,16 +49,16 @@ jobs: lint: runs-on: ubuntu-latest - name: 'Lint: node-14, ubuntu-latest' + name: 'Lint: node-16, ubuntu-latest' steps: - uses: actions/checkout@v2 with: fetch-depth: 0 - - name: Set node version to 14 + - name: Set Node version to 16 uses: actions/setup-node@v2 with: - node-version: 14 + node-version: 16 cache: 'yarn' - name: Debug @@ -79,14 +78,15 @@ jobs: # runs-on: ubuntu-latest # name: 'Smoke: node-14, ubuntu-latest' # steps: - # - uses: actions/checkout@v2 + # - name: Check out code using Git + # uses: actions/checkout@v2 # with: # fetch-depth: 0 - # - name: Set node version to 14 + # - name: Set Node version to 16 # uses: actions/setup-node@v2 # with: - # node-version: 14 + # node-version: 16 # cache: 'yarn' # - name: Debug diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index bc6834e7c..6f743b101 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -5,24 +5,26 @@ on: branches: - main -env: - node_version: 14 - jobs: format: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - name: Check out code using Git + uses: actions/checkout@v2 with: ref: ${{ github.head_ref }} - - uses: actions/setup-node@v2 + - name: Set Node version to 16 + uses: actions/setup-node@v2 with: - node-version: ${{ env.node_version }} - - run: yarn --frozen-lockfile --ignore-engines + node-version: 16 + cache: 'yarn' + - name: Install dependencies + run: yarn --frozen-lockfile --ignore-engines env: CI: true - run: yarn lerna run build --scope @astrojs/parser - - run: yarn format + - name: Format code + run: yarn format - name: Commit changes uses: stefanzweifel/git-auto-commit-action@v4 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 78c5c919f..60f3ebc26 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,16 +10,17 @@ jobs: name: Changelog runs-on: ubuntu-latest steps: - - name: Check out branch + - name: Check out code using Git uses: actions/checkout@v2 with: fetch-depth: 0 # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits - - name: Set up Node.js 14.x + - name: Set Node version to 14 uses: actions/setup-node@v2 with: node-version: 14.x - + cache: 'yarn' + - name: Install dependencies run: yarn --frozen-lockfile --ignore-engines env: diff --git a/.github/workflows/stat.yml b/.github/workflows/stat.yml index 67afc0476..5668a826a 100644 --- a/.github/workflows/stat.yml +++ b/.github/workflows/stat.yml @@ -1,26 +1,26 @@ name: 'Collect Stats' -on: +on: schedule: # * is a special character in YAML so you have to quote this string - cron: '0 12 * * *' -env: - node_version: 14 - jobs: stat: if: github.repository == 'snowpackjs/astro' runs-on: ubuntu-latest steps: - # Check out code using git - - uses: actions/checkout@v2 - # Install Node 14 - - uses: actions/setup-node@v1 + - name: Check out code using Git + uses: actions/checkout@v2 + - name: Set Node version to 16 + uses: actions/setup-node@v2 with: - version: 14 - - run: yarn install --frozen-lockfile --ignore-engines --ignore-scripts - - run: node scripts/stats/index.js + node-version: 16 + cache: 'yarn' + - name: Install dependencies + run: yarn install --frozen-lockfile --ignore-engines --ignore-scripts + - name: Collect stats + run: node scripts/stats/index.js env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Commit changes diff --git a/packages/astro/src/core/build/index.ts b/packages/astro/src/core/build/index.ts index 7fdb3a51e..674748bb0 100644 --- a/packages/astro/src/core/build/index.ts +++ b/packages/astro/src/core/build/index.ts @@ -142,7 +142,11 @@ class AstroBuilder { target: 'es2020', // must match an esbuild target }, plugins: [ - rollupPluginHTML({ input, extractAssets: false }) as any, // "any" needed for CI; also we don’t need typedefs for this anyway + rollupPluginHTML({ + rootDir: viteConfig.root, + input, + extractAssets: false, + }) as any, // "any" needed for CI; also we don’t need typedefs for this anyway ...(viteConfig.plugins || []), ], publicDir: viteConfig.publicDir, diff --git a/packages/astro/src/core/ssr/index.ts b/packages/astro/src/core/ssr/index.ts index 3d92a2402..e2c4b76c0 100644 --- a/packages/astro/src/core/ssr/index.ts +++ b/packages/astro/src/core/ssr/index.ts @@ -79,7 +79,8 @@ export async function ssr({ astroConfig, filePath, logging, mode, origin, pathna // Important: This needs to happen first, in case a renderer provides polyfills. const renderers = await resolveRenderers(viteServer, astroConfig); // Load the module from the Vite SSR Runtime. - const mod = (await viteServer.ssrLoadModule(fileURLToPath(filePath))) as ComponentInstance; + const viteFriendlyURL = `/@fs${filePath.pathname}`; + const mod = (await viteServer.ssrLoadModule(viteFriendlyURL)) as ComponentInstance; // Handle dynamic routes let params: Params = {}; let pageProps: Props = {}; @@ -174,7 +175,7 @@ export async function ssr({ astroConfig, filePath, logging, mode, origin, pathna } // inject CSS - [...getStylesForID(fileURLToPath(filePath), viteServer)].forEach((href) => { + [...getStylesForID(filePath.pathname, viteServer)].forEach((href) => { tags.push({ tag: 'link', attrs: { type: 'text/css', rel: 'stylesheet', href }, @@ -187,7 +188,7 @@ export async function ssr({ astroConfig, filePath, logging, mode, origin, pathna // run transformIndexHtml() in dev to run Vite dev transformations if (mode === 'development') { - html = await viteServer.transformIndexHtml(fileURLToPath(filePath), html, pathname); + html = await viteServer.transformIndexHtml(filePath.pathname, html, pathname); } return html; diff --git a/packages/astro/src/vite-plugin-astro/index.ts b/packages/astro/src/vite-plugin-astro/index.ts index ee3ea5b67..d22b1caf1 100644 --- a/packages/astro/src/vite-plugin-astro/index.ts +++ b/packages/astro/src/vite-plugin-astro/index.ts @@ -46,7 +46,8 @@ export default function astro({ config, devServer }: AstroPluginOptions): vite.P } // pages and layouts should be transformed as full documents (implicit
etc) // everything else is treated as a fragment - const isPage = id.startsWith(fileURLToPath(config.pages)) || id.startsWith(fileURLToPath(config.layouts)); + const normalizedID = fileURLToPath(new URL(`file://${id}`)); + const isPage = normalizedID.startsWith(fileURLToPath(config.pages)) || id.startsWith(fileURLToPath(config.layouts)); let source = await fs.promises.readFile(id, 'utf8'); let tsResult: TransformResult | undefined; diff --git a/packages/astro/vendor/vite/dist/node/chunks/dep-35df7f96.js b/packages/astro/vendor/vite/dist/node/chunks/dep-35df7f96.js index fdcd3be4e..49a552ccb 100644 --- a/packages/astro/vendor/vite/dist/node/chunks/dep-35df7f96.js +++ b/packages/astro/vendor/vite/dist/node/chunks/dep-35df7f96.js @@ -90,155 +90,155 @@ function commonjsRequire (path) { var ansiStyles$2 = {exports: {}}; -var colorName$1 = { - "aliceblue": [240, 248, 255], - "antiquewhite": [250, 235, 215], - "aqua": [0, 255, 255], - "aquamarine": [127, 255, 212], - "azure": [240, 255, 255], - "beige": [245, 245, 220], - "bisque": [255, 228, 196], - "black": [0, 0, 0], - "blanchedalmond": [255, 235, 205], - "blue": [0, 0, 255], - "blueviolet": [138, 43, 226], - "brown": [165, 42, 42], - "burlywood": [222, 184, 135], - "cadetblue": [95, 158, 160], - "chartreuse": [127, 255, 0], - "chocolate": [210, 105, 30], - "coral": [255, 127, 80], - "cornflowerblue": [100, 149, 237], - "cornsilk": [255, 248, 220], - "crimson": [220, 20, 60], - "cyan": [0, 255, 255], - "darkblue": [0, 0, 139], - "darkcyan": [0, 139, 139], - "darkgoldenrod": [184, 134, 11], - "darkgray": [169, 169, 169], - "darkgreen": [0, 100, 0], - "darkgrey": [169, 169, 169], - "darkkhaki": [189, 183, 107], - "darkmagenta": [139, 0, 139], - "darkolivegreen": [85, 107, 47], - "darkorange": [255, 140, 0], - "darkorchid": [153, 50, 204], - "darkred": [139, 0, 0], - "darksalmon": [233, 150, 122], - "darkseagreen": [143, 188, 143], - "darkslateblue": [72, 61, 139], - "darkslategray": [47, 79, 79], - "darkslategrey": [47, 79, 79], - "darkturquoise": [0, 206, 209], - "darkviolet": [148, 0, 211], - "deeppink": [255, 20, 147], - "deepskyblue": [0, 191, 255], - "dimgray": [105, 105, 105], - "dimgrey": [105, 105, 105], - "dodgerblue": [30, 144, 255], - "firebrick": [178, 34, 34], - "floralwhite": [255, 250, 240], - "forestgreen": [34, 139, 34], - "fuchsia": [255, 0, 255], - "gainsboro": [220, 220, 220], - "ghostwhite": [248, 248, 255], - "gold": [255, 215, 0], - "goldenrod": [218, 165, 32], - "gray": [128, 128, 128], - "green": [0, 128, 0], - "greenyellow": [173, 255, 47], - "grey": [128, 128, 128], - "honeydew": [240, 255, 240], - "hotpink": [255, 105, 180], - "indianred": [205, 92, 92], - "indigo": [75, 0, 130], - "ivory": [255, 255, 240], - "khaki": [240, 230, 140], - "lavender": [230, 230, 250], - "lavenderblush": [255, 240, 245], - "lawngreen": [124, 252, 0], - "lemonchiffon": [255, 250, 205], - "lightblue": [173, 216, 230], - "lightcoral": [240, 128, 128], - "lightcyan": [224, 255, 255], - "lightgoldenrodyellow": [250, 250, 210], - "lightgray": [211, 211, 211], - "lightgreen": [144, 238, 144], - "lightgrey": [211, 211, 211], - "lightpink": [255, 182, 193], - "lightsalmon": [255, 160, 122], - "lightseagreen": [32, 178, 170], - "lightskyblue": [135, 206, 250], - "lightslategray": [119, 136, 153], - "lightslategrey": [119, 136, 153], - "lightsteelblue": [176, 196, 222], - "lightyellow": [255, 255, 224], - "lime": [0, 255, 0], - "limegreen": [50, 205, 50], - "linen": [250, 240, 230], - "magenta": [255, 0, 255], - "maroon": [128, 0, 0], - "mediumaquamarine": [102, 205, 170], - "mediumblue": [0, 0, 205], - "mediumorchid": [186, 85, 211], - "mediumpurple": [147, 112, 219], - "mediumseagreen": [60, 179, 113], - "mediumslateblue": [123, 104, 238], - "mediumspringgreen": [0, 250, 154], - "mediumturquoise": [72, 209, 204], - "mediumvioletred": [199, 21, 133], - "midnightblue": [25, 25, 112], - "mintcream": [245, 255, 250], - "mistyrose": [255, 228, 225], - "moccasin": [255, 228, 181], - "navajowhite": [255, 222, 173], - "navy": [0, 0, 128], - "oldlace": [253, 245, 230], - "olive": [128, 128, 0], - "olivedrab": [107, 142, 35], - "orange": [255, 165, 0], - "orangered": [255, 69, 0], - "orchid": [218, 112, 214], - "palegoldenrod": [238, 232, 170], - "palegreen": [152, 251, 152], - "paleturquoise": [175, 238, 238], - "palevioletred": [219, 112, 147], - "papayawhip": [255, 239, 213], - "peachpuff": [255, 218, 185], - "peru": [205, 133, 63], - "pink": [255, 192, 203], - "plum": [221, 160, 221], - "powderblue": [176, 224, 230], - "purple": [128, 0, 128], - "rebeccapurple": [102, 51, 153], - "red": [255, 0, 0], - "rosybrown": [188, 143, 143], - "royalblue": [65, 105, 225], - "saddlebrown": [139, 69, 19], - "salmon": [250, 128, 114], - "sandybrown": [244, 164, 96], - "seagreen": [46, 139, 87], - "seashell": [255, 245, 238], - "sienna": [160, 82, 45], - "silver": [192, 192, 192], - "skyblue": [135, 206, 235], - "slateblue": [106, 90, 205], - "slategray": [112, 128, 144], - "slategrey": [112, 128, 144], - "snow": [255, 250, 250], - "springgreen": [0, 255, 127], - "steelblue": [70, 130, 180], - "tan": [210, 180, 140], - "teal": [0, 128, 128], - "thistle": [216, 191, 216], - "tomato": [255, 99, 71], - "turquoise": [64, 224, 208], - "violet": [238, 130, 238], - "wheat": [245, 222, 179], - "white": [255, 255, 255], - "whitesmoke": [245, 245, 245], - "yellow": [255, 255, 0], - "yellowgreen": [154, 205, 50] +var colorName$1 = { + "aliceblue": [240, 248, 255], + "antiquewhite": [250, 235, 215], + "aqua": [0, 255, 255], + "aquamarine": [127, 255, 212], + "azure": [240, 255, 255], + "beige": [245, 245, 220], + "bisque": [255, 228, 196], + "black": [0, 0, 0], + "blanchedalmond": [255, 235, 205], + "blue": [0, 0, 255], + "blueviolet": [138, 43, 226], + "brown": [165, 42, 42], + "burlywood": [222, 184, 135], + "cadetblue": [95, 158, 160], + "chartreuse": [127, 255, 0], + "chocolate": [210, 105, 30], + "coral": [255, 127, 80], + "cornflowerblue": [100, 149, 237], + "cornsilk": [255, 248, 220], + "crimson": [220, 20, 60], + "cyan": [0, 255, 255], + "darkblue": [0, 0, 139], + "darkcyan": [0, 139, 139], + "darkgoldenrod": [184, 134, 11], + "darkgray": [169, 169, 169], + "darkgreen": [0, 100, 0], + "darkgrey": [169, 169, 169], + "darkkhaki": [189, 183, 107], + "darkmagenta": [139, 0, 139], + "darkolivegreen": [85, 107, 47], + "darkorange": [255, 140, 0], + "darkorchid": [153, 50, 204], + "darkred": [139, 0, 0], + "darksalmon": [233, 150, 122], + "darkseagreen": [143, 188, 143], + "darkslateblue": [72, 61, 139], + "darkslategray": [47, 79, 79], + "darkslategrey": [47, 79, 79], + "darkturquoise": [0, 206, 209], + "darkviolet": [148, 0, 211], + "deeppink": [255, 20, 147], + "deepskyblue": [0, 191, 255], + "dimgray": [105, 105, 105], + "dimgrey": [105, 105, 105], + "dodgerblue": [30, 144, 255], + "firebrick": [178, 34, 34], + "floralwhite": [255, 250, 240], + "forestgreen": [34, 139, 34], + "fuchsia": [255, 0, 255], + "gainsboro": [220, 220, 220], + "ghostwhite": [248, 248, 255], + "gold": [255, 215, 0], + "goldenrod": [218, 165, 32], + "gray": [128, 128, 128], + "green": [0, 128, 0], + "greenyellow": [173, 255, 47], + "grey": [128, 128, 128], + "honeydew": [240, 255, 240], + "hotpink": [255, 105, 180], + "indianred": [205, 92, 92], + "indigo": [75, 0, 130], + "ivory": [255, 255, 240], + "khaki": [240, 230, 140], + "lavender": [230, 230, 250], + "lavenderblush": [255, 240, 245], + "lawngreen": [124, 252, 0], + "lemonchiffon": [255, 250, 205], + "lightblue": [173, 216, 230], + "lightcoral": [240, 128, 128], + "lightcyan": [224, 255, 255], + "lightgoldenrodyellow": [250, 250, 210], + "lightgray": [211, 211, 211], + "lightgreen": [144, 238, 144], + "lightgrey": [211, 211, 211], + "lightpink": [255, 182, 193], + "lightsalmon": [255, 160, 122], + "lightseagreen": [32, 178, 170], + "lightskyblue": [135, 206, 250], + "lightslategray": [119, 136, 153], + "lightslategrey": [119, 136, 153], + "lightsteelblue": [176, 196, 222], + "lightyellow": [255, 255, 224], + "lime": [0, 255, 0], + "limegreen": [50, 205, 50], + "linen": [250, 240, 230], + "magenta": [255, 0, 255], + "maroon": [128, 0, 0], + "mediumaquamarine": [102, 205, 170], + "mediumblue": [0, 0, 205], + "mediumorchid": [186, 85, 211], + "mediumpurple": [147, 112, 219], + "mediumseagreen": [60, 179, 113], + "mediumslateblue": [123, 104, 238], + "mediumspringgreen": [0, 250, 154], + "mediumturquoise": [72, 209, 204], + "mediumvioletred": [199, 21, 133], + "midnightblue": [25, 25, 112], + "mintcream": [245, 255, 250], + "mistyrose": [255, 228, 225], + "moccasin": [255, 228, 181], + "navajowhite": [255, 222, 173], + "navy": [0, 0, 128], + "oldlace": [253, 245, 230], + "olive": [128, 128, 0], + "olivedrab": [107, 142, 35], + "orange": [255, 165, 0], + "orangered": [255, 69, 0], + "orchid": [218, 112, 214], + "palegoldenrod": [238, 232, 170], + "palegreen": [152, 251, 152], + "paleturquoise": [175, 238, 238], + "palevioletred": [219, 112, 147], + "papayawhip": [255, 239, 213], + "peachpuff": [255, 218, 185], + "peru": [205, 133, 63], + "pink": [255, 192, 203], + "plum": [221, 160, 221], + "powderblue": [176, 224, 230], + "purple": [128, 0, 128], + "rebeccapurple": [102, 51, 153], + "red": [255, 0, 0], + "rosybrown": [188, 143, 143], + "royalblue": [65, 105, 225], + "saddlebrown": [139, 69, 19], + "salmon": [250, 128, 114], + "sandybrown": [244, 164, 96], + "seagreen": [46, 139, 87], + "seashell": [255, 245, 238], + "sienna": [160, 82, 45], + "silver": [192, 192, 192], + "skyblue": [135, 206, 235], + "slateblue": [106, 90, 205], + "slategray": [112, 128, 144], + "slategrey": [112, 128, 144], + "snow": [255, 250, 250], + "springgreen": [0, 255, 127], + "steelblue": [70, 130, 180], + "tan": [210, 180, 140], + "teal": [0, 128, 128], + "thistle": [216, 191, 216], + "tomato": [255, 99, 71], + "turquoise": [64, 224, 208], + "violet": [238, 130, 238], + "wheat": [245, 222, 179], + "white": [255, 255, 255], + "whitesmoke": [245, 245, 245], + "yellow": [255, 255, 0], + "yellowgreen": [154, 205, 50] }; /* MIT license */ @@ -3695,7 +3695,7 @@ class SourceMapTree { return null; const source = this.sources[segment[1]]; // So now we can recurse down, until we hit the original source file. - return source.traceSegment(segment[2], segment[3], + return source.traceSegment(segment[2], segment[3], // A child map's recorded name for this segment takes precedence over the // parent's mapped name. Imagine a mangler changing the name over, etc. segment.length === 5 ? names[segment[4]] : name); @@ -6002,7 +6002,7 @@ async function fileToBuiltUrl(id, config, pluginContext, skipPublicCheck = false const { search, hash } = require$$0$8.parse(id); const postfix = (search || '') + (hash || ''); const output = (_b = (_a = config.build) === null || _a === void 0 ? void 0 : _a.rollupOptions) === null || _b === void 0 ? void 0 : _b.output; - const assetFileNames = (_c = (output && !Array.isArray(output) ? output.assetFileNames : undefined)) !== null && _c !== void 0 ? _c : + const assetFileNames = (_c = (output && !Array.isArray(output) ? output.assetFileNames : undefined)) !== null && _c !== void 0 ? _c : // defaults to '