From d3090ece03582c58a971210c68e2cacfb000a7d2 Mon Sep 17 00:00:00 2001 From: William French Date: Thu, 19 Sep 2024 10:07:39 -0700 Subject: [PATCH] fix: another attempt to fix the ESM issue. --- .eleventy.js => .eleventy.cjs | 47 ++++++++++++------- package.json | 1 + playwright.config.ts | 6 +-- ....gitignore.11ty.js => .gitignore.11ty.cjs} | 0 samples/{env.11ty.js => env.11ty.cjs} | 0 .../{env.d.ts.11ty.js => env.d.ts.11ty.cjs} | 0 .../{eslintrc.11ty.js => eslintrc.11ty.cjs} | 0 ...11ty.js => jsfiddle.details.yaml.11ty.cjs} | 0 samples/{package.11ty.js => package.11ty.cjs} | 0 ...ge.11ty.js => playground-package.11ty.cjs} | 0 ...on.11ty.js => playground.ts.json.11ty.cjs} | 0 ...mples.11tydata.js => samples.11tydata.cjs} | 0 .../{tsconfig.11ty.js => tsconfig.11ty.cjs} | 0 ...types.d.ts.11ty.js => types.d.ts.11ty.cjs} | 0 ...te.config.11ty.js => vite.config.11ty.cjs} | 0 tsconfig.json | 6 +-- 16 files changed, 38 insertions(+), 22 deletions(-) rename .eleventy.js => .eleventy.cjs (71%) rename samples/{.gitignore.11ty.js => .gitignore.11ty.cjs} (100%) rename samples/{env.11ty.js => env.11ty.cjs} (100%) rename samples/{env.d.ts.11ty.js => env.d.ts.11ty.cjs} (100%) rename samples/{eslintrc.11ty.js => eslintrc.11ty.cjs} (100%) rename samples/{jsfiddle.details.yaml.11ty.js => jsfiddle.details.yaml.11ty.cjs} (100%) rename samples/{package.11ty.js => package.11ty.cjs} (100%) rename samples/{playground-package.11ty.js => playground-package.11ty.cjs} (100%) rename samples/{playground.ts.json.11ty.js => playground.ts.json.11ty.cjs} (100%) rename samples/{samples.11tydata.js => samples.11tydata.cjs} (100%) rename samples/{tsconfig.11ty.js => tsconfig.11ty.cjs} (100%) rename samples/{types.d.ts.11ty.js => types.d.ts.11ty.cjs} (100%) rename samples/{vite.config.11ty.js => vite.config.11ty.cjs} (100%) diff --git a/.eleventy.js b/.eleventy.cjs similarity index 71% rename from .eleventy.js rename to .eleventy.cjs index 3d336a43f5..d5cab8d6ba 100644 --- a/.eleventy.js +++ b/.eleventy.cjs @@ -1,21 +1,36 @@ require("dotenv").config(); -const typescript = require("./src/engines/typescript/sample"); -const typescriptJSX = require("./src/engines/typescript/sample-jsx"); -const sass = require("./src/engines/sass"); -const stripRegionTags = require("./src/transforms/strip-region-tags"); -const stripLicenseHeaders = require("./src/transforms/strip-license-headers"); -const yourAPIKey = require("./src/transforms/your-api-key"); -const format = require("./src/transforms/format"); -const minify = require("./src/transforms/minify"); -const skypack = require("./src/transforms/skypack"); -const fs = require("fs"); -const path = require("path"); -const vite = require("vite"); -const chalk = require("chalk"); -const prettier = require("prettier"); - -module.exports = function (eleventyConfig) { +// const typescript = require("./src/engines/typescript/sample"); +// const typescriptJSX = require("./src/engines/typescript/sample-jsx"); +// const sass = require("./src/engines/sass"); +// const stripRegionTags = require("./src/transforms/strip-region-tags"); +// const stripLicenseHeaders = require("./src/transforms/strip-license-headers"); +// const yourAPIKey = require("./src/transforms/your-api-key"); +// const format = require("./src/transforms/format"); +// const minify = require("./src/transforms/minify"); +// const skypack = require("./src/transforms/skypack"); +// const fs = require("fs"); +// const path = require("path"); +// const vite = require("vite"); +// const chalk = require("chalk"); +// const prettier = require("prettier"); + +const { typescript } = await ".src/engines/typescript/sample"; +const { typescriptJSX } = await "./src/engines/typescript/sample-jsx"; +const { sass } = await "./src/engines/sass"; +const { stripRegionTags } = await "./src/transforms/strip-region-tags"; +const { stripLicenseHeaders } = await "./src/transforms/strip-license-headers"; +const { yourAPIKey } = await "./src/transforms/your-api-key"; +const { format } = await "./src/transforms/format"; +const { minify } = await "./src/transforms/minify"; +const { skypack } = await "./src/transforms/skypack"; +const { fs } = await "fs"; +const { path } = await "path"; +const { vite } = await "vite"; +const { chalk } = await "chalk"; +const { prettier } = await "prettier"; + +export default function (eleventyConfig) { eleventyConfig.addWatchTarget("./shared/**/*"); eleventyConfig.addWatchTarget(".env*"); diff --git a/package.json b/package.json index 6e09fd41f8..2288584f01 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "name": "@googlemaps/js-samples", "description": "Samples for Google Maps JavaScript", "version": "2.1.4", + "type": "module", "keywords": [ "google", "javascript", diff --git a/playwright.config.ts b/playwright.config.ts index df98be0572..fab1977c7c 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -1,4 +1,4 @@ -import { PlaywrightTestConfig, devices } from "@playwright/test"; +import type { PlaywrightTestConfig, /* devices */ } from "@playwright/test"; import { test, expect, Expect } from "@playwright/test"; import fs from "fs"; import path from "path"; @@ -26,12 +26,12 @@ const config: PlaywrightTestConfig = { port: 8080, }, updateSnapshots: "none", - projects: [ + /* projects: [ { name: "chromium", use: { ...devices["Desktop Chrome"] }, }, - ], + ], */ reporter: process.env.CI ? "github" : "list", }; diff --git a/samples/.gitignore.11ty.js b/samples/.gitignore.11ty.cjs similarity index 100% rename from samples/.gitignore.11ty.js rename to samples/.gitignore.11ty.cjs diff --git a/samples/env.11ty.js b/samples/env.11ty.cjs similarity index 100% rename from samples/env.11ty.js rename to samples/env.11ty.cjs diff --git a/samples/env.d.ts.11ty.js b/samples/env.d.ts.11ty.cjs similarity index 100% rename from samples/env.d.ts.11ty.js rename to samples/env.d.ts.11ty.cjs diff --git a/samples/eslintrc.11ty.js b/samples/eslintrc.11ty.cjs similarity index 100% rename from samples/eslintrc.11ty.js rename to samples/eslintrc.11ty.cjs diff --git a/samples/jsfiddle.details.yaml.11ty.js b/samples/jsfiddle.details.yaml.11ty.cjs similarity index 100% rename from samples/jsfiddle.details.yaml.11ty.js rename to samples/jsfiddle.details.yaml.11ty.cjs diff --git a/samples/package.11ty.js b/samples/package.11ty.cjs similarity index 100% rename from samples/package.11ty.js rename to samples/package.11ty.cjs diff --git a/samples/playground-package.11ty.js b/samples/playground-package.11ty.cjs similarity index 100% rename from samples/playground-package.11ty.js rename to samples/playground-package.11ty.cjs diff --git a/samples/playground.ts.json.11ty.js b/samples/playground.ts.json.11ty.cjs similarity index 100% rename from samples/playground.ts.json.11ty.js rename to samples/playground.ts.json.11ty.cjs diff --git a/samples/samples.11tydata.js b/samples/samples.11tydata.cjs similarity index 100% rename from samples/samples.11tydata.js rename to samples/samples.11tydata.cjs diff --git a/samples/tsconfig.11ty.js b/samples/tsconfig.11ty.cjs similarity index 100% rename from samples/tsconfig.11ty.js rename to samples/tsconfig.11ty.cjs diff --git a/samples/types.d.ts.11ty.js b/samples/types.d.ts.11ty.cjs similarity index 100% rename from samples/types.d.ts.11ty.js rename to samples/types.d.ts.11ty.cjs diff --git a/samples/vite.config.11ty.js b/samples/vite.config.11ty.cjs similarity index 100% rename from samples/vite.config.11ty.js rename to samples/vite.config.11ty.cjs diff --git a/tsconfig.json b/tsconfig.json index 0c32e636cd..1698a8fc93 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,10 +1,10 @@ { "compilerOptions": { - "module": "esnext", - "target": "esnext", + "module": "ES2022", + "target": "ES2022", "strict": true, "noImplicitAny": false, - "lib": ["esnext", "es6", "dom", "dom.iterable"], + "lib": ["ES2022", "es6", "dom", "dom.iterable"], "moduleResolution": "Bundler", "jsx": "preserve", "esModuleInterop": true,