Skip to content

Commit 691ade4

Browse files
committed
Add new lit-dev-tools-esm package
The lit-dev-tools package is currently CommonJS, because mostly it is used for Eleventy plugins, and Eleventy doesn't support ES modules (11ty/eleventy#836). We want ES modules for this new redirect checker script, because it needs to import some ES modules, and that is difficult to do with TypeScript, because TypeScript doesn't allow emitting an actual `import` statement, which is how CommonJS -> ESM interop works (microsoft/TypeScript#43329). We also an't really have a mix of CommonJS and ESM in the same package, because the {"type": "module"} field has to be set. We could use .mjs extensions, but TypeScript won't emit those. So the simplest solution seems to be to just have two packages!
1 parent 4d623e0 commit 691ade4

File tree

3 files changed

+39
-1
lines changed

3 files changed

+39
-1
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"name": "lit-dev-tools-esm",
3+
"private": true,
4+
"version": "0.0.0",
5+
"description": "Misc tools for lit.dev (ES Modules)",
6+
"author": "Google LLC",
7+
"license": "BSD-3-Clause",
8+
"type": "module",
9+
"scripts": {
10+
"build": "npm run build:ts",
11+
"build:ts": "../../node_modules/.bin/tsc",
12+
"format": "../../node_modules/.bin/prettier \"**/*.{ts,js,json,html,css,md}\" --write"
13+
},
14+
"dependencies": {
15+
}
16+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"compilerOptions": {
3+
"target": "es2020",
4+
"module": "esnext",
5+
"moduleResolution": "node",
6+
"declaration": true,
7+
"declarationMap": true,
8+
"sourceMap": true,
9+
"outDir": "./lib",
10+
"rootDir": "./src",
11+
"strict": true,
12+
"noUnusedLocals": true,
13+
"noUnusedParameters": true,
14+
"noImplicitReturns": true,
15+
"noFallthroughCasesInSwitch": true,
16+
"esModuleInterop": true,
17+
"experimentalDecorators": true,
18+
"forceConsistentCasingInFileNames": true
19+
},
20+
"include": ["src/**/*.ts"],
21+
"exclude": []
22+
}

packages/lit-dev-tools/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "lit-dev-tools",
33
"private": true,
44
"version": "0.0.0",
5-
"description": "Misc tools for lit.dev",
5+
"description": "Misc tools for lit.dev (CommonJS)",
66
"author": "Google LLC",
77
"license": "BSD-3-Clause",
88
"scripts": {

0 commit comments

Comments
 (0)