Skip to content

Commit

Permalink
feat: add support for building on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
wessberg committed Sep 24, 2021
1 parent a407467 commit 9582357
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 13 deletions.
9 changes: 3 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"clean": "rimraf dist",
"lint": "tsc --noEmit && eslint \"src/**/*.ts\" --color",
"prettier": "prettier --write '{src,test,documentation}/**/*.{js,ts,json,html,xml,css,md}'",
"test": "NODE_ENV=TEST ava",
"test": "ava",
"prebuild": "npm run clean",
"build": "npm run rollup",
"watch": "npm run rollup -- --watch",
Expand Down Expand Up @@ -90,6 +90,7 @@
"@wessberg/di": "2.0.3",
"@wessberg/pointer-events": "1.0.9",
"@wessberg/stringutil": "1.0.19",
"crosspath": "0.0.9",
"Base64": "1.1.0",
"blob-polyfill": "5.0.20210201",
"browserslist": "4.17.1",
Expand Down
4 changes: 2 additions & 2 deletions src/build/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {ZLIB_OPTIONS} from "./options/zlib-options";
import {PolyfillFeature} from "../polyfill/polyfill-feature";
import {build as esbuild} from "esbuild";
import {tmpdir} from "os";
import {join} from "path";
import {join, normalize} from "crosspath";
import {unlinkSync, writeFileSync} from "fs";
import {transform} from "@swc/core";
import {REGENERATOR_SOURCE, REGENERATOR_SOURCE_MINIFIED} from "../constant/regenerator-source";
Expand Down Expand Up @@ -37,7 +37,7 @@ function stringifyPolyfillFeature(feature: PolyfillFeature): string {
}

export async function build({paths, features, ecmaVersion, context, sourcemap = false, minify = false}: BuildOptions): Promise<BuildResult> {
const entryText = paths.map(path => `import "${path}";`).join("\n");
const entryText = paths.map(path => `import "${normalize(path)}";`).join("\n");

// Generate the intro text
const polyfillsAppliedText = features.length < 1 ? `No polyfills applied` : `Polyfills applied (in order): ${features.map(stringifyPolyfillFeature).join(", ")}`;
Expand Down
2 changes: 1 addition & 1 deletion src/common/lib/file-system/real-file-system.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {FileSystem} from "./file-system";
import {promises} from "fs";
import {dirname} from "path";
import {dirname} from "crosspath";

export const realFileSystem: FileSystem = {
async exists(path: string): Promise<boolean> {
Expand Down
2 changes: 1 addition & 1 deletion src/constant/constant.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {IConstant} from "./i-constant";
import tempDirectory from "temp-dir";
import {join} from "path";
import {join} from "crosspath";
import {ALL_CONTEXTS, WINDOW_CONTEXT, WINDOW_NODE_CONTEXT, WINDOW_WORKER_CONTEXT} from "../polyfill/polyfill-context";
import pkg from "../../package.json";
import {booleanize} from "../api/util";
Expand Down
2 changes: 1 addition & 1 deletion src/service/polyfill-builder/polyfill-builder-service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {IPolyfillBuilderService} from "./i-polyfill-builder-service";
import {constant} from "../../constant/constant";
import {PolyfillFeature} from "../../polyfill/polyfill-feature";
import {join} from "path";
import {join} from "crosspath";
import {ICompressedPolyfillSetResult} from "./i-compressed-polyfill-set-result";
import {sync} from "find-up";
import {build} from "../../build/build";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {ICacheRegistryService} from "./i-cache-registry-service";
import {PolyfillFeature, PolyfillFeatureInput} from "../../../polyfill/polyfill-feature";
import {getPolyfillConfigChecksum, getPolyfillIdentifier, getPolyfillSetIdentifier} from "../../../util/polyfill/polyfill-util";
import {join} from "path";
import {join} from "crosspath";
import {constant} from "../../../constant/constant";
import {IMemoryRegistryService, PolyfillCachingContext} from "../polyfill-registry/i-memory-registry-service";
import {PolyfillName} from "../../../polyfill/polyfill-name";
Expand Down

0 comments on commit 9582357

Please sign in to comment.