fix: add support for Es modules

This commit is contained in:
Amin Yahyaabadi 2022-07-05 21:19:58 -07:00
parent 2c84fbf623
commit ae4effdd67
8 changed files with 24 additions and 3 deletions

View File

@ -26,6 +26,7 @@ words:
- devel - devel
- dyld - dyld
- eabi - eabi
- esmodule
- execa - execa
- ftxui - ftxui
- gcovr - gcovr

2
dist/actions_python.aa574a9a.js vendored Normal file

File diff suppressed because one or more lines are too long

1
dist/actions_python.aa574a9a.js.map vendored Normal file

File diff suppressed because one or more lines are too long

2
dist/setup_cpp.mjs vendored Normal file

File diff suppressed because one or more lines are too long

1
dist/setup_cpp.mjs.map vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,7 @@
module.exports = { module.exports = {
preset: "ts-jest/presets/default-esm", preset: "ts-jest/presets/js-with-ts-esm",
extensionsToTreatAsEsm: [".ts"],
transformIgnorePatterns: [], // transform everything
testEnvironment: "node", testEnvironment: "node",
testMatch: ["**/*.test.ts"], testMatch: ["**/*.test.ts"],
testPathIgnorePatterns: ["<rootDir>/src/python/setup-python/"], testPathIgnorePatterns: ["<rootDir>/src/python/setup-python/"],

View File

@ -5,7 +5,12 @@
"repository": "https://github.com/aminya/setup-cpp", "repository": "https://github.com/aminya/setup-cpp",
"license": "Apache-2.0", "license": "Apache-2.0",
"author": "Amin Yahyaabadi", "author": "Amin Yahyaabadi",
"exports": {
"import": "./dist/setup-cpp.mjs",
"require": "./dist/setup-cpp.js"
},
"main": "./dist/setup_cpp.js", "main": "./dist/setup_cpp.js",
"module": "./dist/setup_cpp.mjs",
"source": "./src/main.ts", "source": "./src/main.ts",
"bin": { "bin": {
"setup-cpp": "./dist/setup_cpp.js", "setup-cpp": "./dist/setup_cpp.js",
@ -121,7 +126,14 @@
"main": { "main": {
"context": "node", "context": "node",
"includeNodeModules": true, "includeNodeModules": true,
"optimize": true "optimize": true,
"outputFormat": "commonjs"
},
"module": {
"context": "node",
"includeNodeModules": true,
"optimize": true,
"outputFormat": "esmodule"
} }
} }
} }

View File

@ -22,7 +22,7 @@
"allowJs": true, "allowJs": true,
"esModuleInterop": true, "esModuleInterop": true,
"resolveJsonModule": true, "resolveJsonModule": true,
"module": "commonjs", "module": "esnext",
"moduleResolution": "node", "moduleResolution": "node",
"importHelpers": false, "importHelpers": false,
"outDir": "./dist" "outDir": "./dist"