summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Drew Powers <1369770+drwpow@users.noreply.github.com> 2021-11-11 10:24:48 -0700
committerGravatar GitHub <noreply@github.com> 2021-11-11 10:24:48 -0700
commit5e0cb796a6e075645d9ad9e1195e7f694df010d0 (patch)
treeea2d0f3c33cf4bb39cdc2b61ccc68bf6877e4a62
parentb67779d1dde9fca731724b4299ff4c46b8234466 (diff)
downloadastro-5e0cb796a6e075645d9ad9e1195e7f694df010d0.tar.gz
astro-5e0cb796a6e075645d9ad9e1195e7f694df010d0.tar.zst
astro-5e0cb796a6e075645d9ad9e1195e7f694df010d0.zip
Enable macOS tests (#1774)
* Enable macOS tests * Fix macOS tests
-rw-r--r--.github/workflows/ci.yml2
-rw-r--r--packages/astro/src/vite-plugin-astro/index.ts7
2 files changed, 9 insertions, 0 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index d6bc6c7f6..45a632776 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -21,6 +21,8 @@ jobs:
include:
- os: windows-latest
node_version: 16
+ - os: macos-latest
+ node_version: 16
fail-fast: false
env:
LANG: en-us
diff --git a/packages/astro/src/vite-plugin-astro/index.ts b/packages/astro/src/vite-plugin-astro/index.ts
index d22b1caf1..8e68d9504 100644
--- a/packages/astro/src/vite-plugin-astro/index.ts
+++ b/packages/astro/src/vite-plugin-astro/index.ts
@@ -6,6 +6,7 @@ import type { AstroConfig } from '../@types/astro-core';
import esbuild from 'esbuild';
import fs from 'fs';
import { fileURLToPath } from 'url';
+import os from 'os';
import { transform } from '@astrojs/compiler';
import { decode } from 'sourcemap-codec';
import { AstroDevServer } from '../core/dev/index.js';
@@ -79,6 +80,12 @@ export default function astro({ config, devServer }: AstroPluginOptions): vite.P
return { code: result.code, map };
},
});
+
+ // macOS fix: remove null chars generated by compiler
+ if (os.platform() === 'darwin') {
+ tsResult.code = tsResult.code.replace(/\x00/g, '');
+ }
+
// Compile `.ts` to `.js`
const { code, map } = await esbuild.transform(tsResult.code, { loader: 'ts', sourcemap: 'external', sourcefile: id });