Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set babel sourceType dynamically #183

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
31,071 changes: 0 additions & 31,071 deletions package-lock.json

This file was deleted.

19 changes: 12 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
"@babel/plugin-transform-runtime": "^7.17.0",
"@babel/preset-env": "^7.16.11",
"@babel/runtime": "^7.17.2",
"@typescript-eslint/eslint-plugin": "^4.33.0",
"@typescript-eslint/parser": "^4.33.0",
"@typescript-eslint/eslint-plugin": "^5.45.1",
"@typescript-eslint/parser": "^5.45.1",
"babel-eslint": "^10.0.2",
"babel-jest": "^26.6.3",
"babel-loader": "^8.2.3",
Expand All @@ -51,7 +51,7 @@
"css-loader": "^5.2.7",
"dotenv": "^8.6.0",
"esbuild-loader": "^2.18.0",
"eslint": "^7.32.0",
"eslint": "7.32.0",
"eslint-config-strongloop": "^2.1.0",
"eslint-webpack-plugin": "^2.6.0",
"fast-glob": "^3.2.11",
Expand All @@ -62,6 +62,7 @@
"import-fresh": "^3.3.0",
"isomorphic-style-loader": "^5.3.2",
"jest": "^26.6.3",
"node-loader": "^2.0.0",
"pkg-up": "^3.1.0",
"raw-loader": "^4.0.2",
"regenerator-runtime": "^0.13.9",
Expand All @@ -70,8 +71,8 @@
"sass-loader": "^11.1.1",
"serverless-webpack": "^5.6.1",
"source-map-support": "^0.5.21",
"ts-jest": "^26.5.6",
"ts-loader": "^8.3.0",
"ts-jest": "^29.0.3",
"ts-loader": "^9.4.2",
"tsconfig-paths-webpack-plugin": "^3.5.2",
"typescript": "^4.5.5",
"webpack": "^5.68.0",
Expand All @@ -85,9 +86,9 @@
"is-ci": "^3.0.1",
"lerna-changelog": "^1.0.1",
"lint-staged": "^10.5.4",
"prettier": "^2.5.1",
"prettier": "^2.8.0",
"reflect-metadata": "^0.1.13",
"serverless": "^2.72.2"
"serverless": "^3.25.1"
},
"peerDependencies": {
"serverless": "1 || 2 || 3"
Expand All @@ -101,5 +102,9 @@
"eslint --fix",
"git add"
]
},
"volta": {
"node": "18.17.0",
"yarn": "1.22.19"
}
}
2 changes: 2 additions & 0 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,7 @@ module.exports = {
rawFileExtensions: ["pem", "txt"],
minifyOptions: {},
experiments: {},
sourceType: "module", // "script" | "module" | "unambiguous"
nodeDirname: false
},
};
8 changes: 2 additions & 6 deletions src/ts.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
{
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"parserOptions": {
"ecmaVersion": 2017,
"sourceType": "module"
},
"plugins": ["@typescript-eslint", "prettier"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
"prettier"
],
"rules": {}
}
9 changes: 8 additions & 1 deletion src/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ const esbuildNodeVersion = "node" + nodeVersion;
const forceExclude = config.options.forceExclude;
const ignorePackages = config.options.ignorePackages;
const rawFileExtensions = config.options.rawFileExtensions;
const sourceType = config.options.sourceType;
const nodeDirname = config.options.nodeDirname;
const fixPackages = convertListToObject(config.options.fixPackages);
const tsConfigPath = path.resolve(servicePath, config.options.tsConfig);
const minifyOptions = config.options.minifyOptions;
Expand Down Expand Up @@ -143,6 +145,7 @@ function babelLoader() {
// Disable compresisng cache files to speed up caching
cacheCompression: false,
plugins: plugins.map(require.resolve),
sourceType,
presets: [
[
require.resolve("@babel/preset-env"),
Expand Down Expand Up @@ -240,6 +243,10 @@ function loaders() {
],
},
{ test: /\.gif|\.svg|\.png|\.jpg|\.jpeg$/, loader: "ignore-loader" },
{
test: /\.node$/,
loader: "node-loader",
},
],
};

Expand Down Expand Up @@ -469,6 +476,6 @@ module.exports = {
plugins: plugins(),
experiments,
node: {
__dirname: false,
__dirname: nodeDirname,
},
};
6 changes: 0 additions & 6 deletions tests/concat-text/.gitignore

This file was deleted.

9 changes: 0 additions & 9 deletions tests/concat-text/handler.js

This file was deleted.

5 changes: 0 additions & 5 deletions tests/concat-text/package-lock.json

This file was deleted.

12 changes: 0 additions & 12 deletions tests/concat-text/package.json

This file was deleted.

1 change: 0 additions & 1 deletion tests/concat-text/public/test-1.txt

This file was deleted.

1 change: 0 additions & 1 deletion tests/concat-text/public/test-2.txt

This file was deleted.

19 changes: 0 additions & 19 deletions tests/concat-text/serverless.yml

This file was deleted.

6 changes: 0 additions & 6 deletions tests/typescript-no-baseUrl/tsconfig.json

This file was deleted.

Loading