Skip to content

Commit

Permalink
Fix lodash imports from .mjs output (#136)
Browse files Browse the repository at this point in the history
* Fix lodash imports from .mjs output

* Add skipLibCheck
  • Loading branch information
nhardy authored Jan 21, 2024
1 parent 2be8998 commit af9e55b
Show file tree
Hide file tree
Showing 20 changed files with 242 additions and 243 deletions.
2 changes: 0 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ module.exports = {
{
devDependencies: [
".eslintrc.js",
"babel-register.js",
"babel.config.js",
"config/**/*",
"typings/**/*",
"**/es/**/*",
Expand Down
42 changes: 0 additions & 42 deletions .travis.yml

This file was deleted.

1 change: 0 additions & 1 deletion .yarnrc

This file was deleted.

10 changes: 0 additions & 10 deletions babel-register.js

This file was deleted.

6 changes: 0 additions & 6 deletions babel.config.js

This file was deleted.

36 changes: 0 additions & 36 deletions config/generateBabelConfig.js

This file was deleted.

19 changes: 6 additions & 13 deletions packages/eslint-plugin/src/test/rule-tester.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
import { RuleTester } from "eslint";

export default new RuleTester({
parser: require.resolve("@babel/eslint-parser"),
parser: require.resolve("@typescript-eslint/parser"),
parserOptions: {
parserOptions: {
ecmaVersion: 6,
sourceType: "module",
ecmaFeatures: {
jsx: true,
},
requireConfigFile: false,
ecmaVersion: 6,
sourceType: "module",
ecmaFeatures: {
jsx: true,
},
plugins: ["react"],
settings: {
react: {
pragma: "React",
version: "16.0.0",
},
},
},
});
4 changes: 2 additions & 2 deletions packages/kerosene-test/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kablamo/kerosene-test",
"version": "0.0.13",
"version": "0.0.14",
"repository": "https://github.com/KablamoOSS/kerosene/tree/master/packages/kerosene-test",
"bugs": {
"url": "https://github.com/KablamoOSS/kerosene/issues"
Expand Down Expand Up @@ -46,7 +46,7 @@
"utils"
],
"dependencies": {
"@kablamo/kerosene": "^0.0.35",
"@kablamo/kerosene": "^0.0.38",
"@types/lodash": "^4.14.202",
"@types/sinon": "^17.0.2",
"lodash": "^4.17.21",
Expand Down
1 change: 0 additions & 1 deletion packages/kerosene-ui/babel.config.js

This file was deleted.

13 changes: 7 additions & 6 deletions packages/kerosene-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kablamo/kerosene-ui",
"version": "0.0.37",
"version": "0.0.38",
"repository": "https://github.com/KablamoOSS/kerosene/tree/master/packages/kerosene-ui",
"bugs": {
"url": "https://github.com/KablamoOSS/kerosene/issues"
Expand Down Expand Up @@ -35,29 +35,30 @@
"node": ">=18.12.0"
},
"dependencies": {
"@babel/runtime": "^7.23.4",
"@kablamo/kerosene": "^0.0.35",
"@kablamo/kerosene": "^0.0.38",
"@types/lodash": "^4.14.202",
"esbuild-register": "^3.5.0",
"lodash": "^4.17.21",
"use-sync-external-store": "^1.2.0"
},
"devDependencies": {
"@kablamo/kerosene-test": "^0.0.13",
"@rollup/plugin-babel": "^6.0.4",
"@kablamo/kerosene-test": "^0.0.14",
"@optimize-lodash/rollup-plugin": "^4.0.4",
"@sinonjs/fake-timers": "^11.2.2",
"@tanstack/react-query": "^5.12.2",
"@testing-library/dom": "^9.3.3",
"@testing-library/react": "^14.1.2",
"@testing-library/user-event": "^14.5.1",
"@types/sinonjs__fake-timers": "^8.1.5",
"@types/use-sync-external-store": "^0.0.6",
"esbuild": "^0.19.11",
"jest-sandbox": "^1.1.2",
"jest-when": "^3.6.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-error-boundary": "^4.0.11",
"rollup": "^4.5.1",
"rollup-plugin-node-resolve": "^5.2.0"
"rollup-plugin-esbuild": "^6.1.0"
},
"peerDependencies": {
"@tanstack/react-query": ">=5.0.0 <6.0.0",
Expand Down
27 changes: 5 additions & 22 deletions packages/kerosene-ui/rollup-config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import babel from "@rollup/plugin-babel";
import { optimizeLodashImports } from "@optimize-lodash/rollup-plugin";
import path from "path";
import type { RollupOptions, ExternalOption } from "rollup";
import resolve from "rollup-plugin-node-resolve";
// eslint-disable-next-line import/no-relative-packages
import generateBabelConfig from "../../config/generateBabelConfig";
import esbuild from "rollup-plugin-esbuild";
import packageJson from "./package.json";

const input = [
Expand All @@ -22,23 +20,7 @@ const external: ExternalOption = (source) =>
externals.includes(source) ||
externals.some((mod) => source.startsWith(`${mod}/`));

const extensions = [".js", ".jsx", ".ts", ".tsx"];

const plugins = [
resolve({
customResolveOptions: {
moduleDirectory: __dirname,
},
extensions,
}),
babel({
...generateBabelConfig(false),
babelrc: false,
configFile: false,
extensions,
babelHelpers: "runtime",
}),
];
const plugins = [esbuild(), optimizeLodashImports()];

export default [
{
Expand All @@ -48,13 +30,14 @@ export default [
entryFileNames: "[name].cjs",
dir: outputDir,
format: "commonjs",
interop: "auto",
preserveModules: true,
sourcemap: true,
},
{
entryFileNames: "[name].mjs",
dir: outputDir,
format: "esm",
format: "es",
preserveModules: true,
sourcemap: true,
},
Expand Down
2 changes: 1 addition & 1 deletion packages/kerosene-ui/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
require("../../babel-register");
require("esbuild-register/dist/node").register();
// eslint-disable-next-line import/extensions
module.exports = require("./rollup-config.ts");
1 change: 0 additions & 1 deletion packages/kerosene/.npmignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
__snapshots__
config
babel.config.js
rollup-config.ts
rollup.config.js
**.spec.ts
Expand Down
1 change: 0 additions & 1 deletion packages/kerosene/babel.config.js

This file was deleted.

9 changes: 5 additions & 4 deletions packages/kerosene/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kablamo/kerosene",
"version": "0.0.35",
"version": "0.0.38",
"repository": "https://github.com/KablamoOSS/kerosene/tree/master/packages/kerosene",
"bugs": {
"url": "https://github.com/KablamoOSS/kerosene/issues"
Expand Down Expand Up @@ -30,20 +30,21 @@
"node": ">=18.12.0"
},
"dependencies": {
"@babel/runtime": "^7.23.4",
"@types/lodash": "^4.14.202",
"content-type": "^1.0.5",
"core-js-pure": "^3.33.3",
"date-fns": "^2.30.0",
"lodash": "^4.17.21"
},
"devDependencies": {
"@rollup/plugin-babel": "^6.0.4",
"@optimize-lodash/rollup-plugin": "^4.0.4",
"@sinonjs/fake-timers": "^11.2.2",
"@types/seed-random": "^2.2.4",
"esbuild": "^0.19.11",
"esbuild-register": "^3.5.0",
"jest-when": "^3.6.0",
"rollup": "^4.5.1",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-esbuild": "^6.1.0",
"seed-random": "^2.2.0"
},
"peerDependencies": {},
Expand Down
27 changes: 5 additions & 22 deletions packages/kerosene/rollup-config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import babel from "@rollup/plugin-babel";
import { optimizeLodashImports } from "@optimize-lodash/rollup-plugin";
import path from "path";
import type { ExternalOption, RollupOptions } from "rollup";
import resolve from "rollup-plugin-node-resolve";
// eslint-disable-next-line import/no-relative-packages
import generateBabelConfig from "../../config/generateBabelConfig";
import esbuild from "rollup-plugin-esbuild";
import packageJson from "./package.json";

const input = path.join(__dirname, "src", "index.ts");
Expand All @@ -19,23 +17,7 @@ const external: ExternalOption = (source) =>
externals.includes(source) ||
externals.some((mod) => source.startsWith(`${mod}/`));

const extensions = [".js", ".ts"];

const plugins = [
resolve({
customResolveOptions: {
moduleDirectory: __dirname,
},
extensions,
}),
babel({
...generateBabelConfig(false),
configFile: false,
babelrc: false,
extensions,
babelHelpers: "runtime",
}),
];
const plugins = [esbuild(), optimizeLodashImports()];

export default [
{
Expand All @@ -45,13 +27,14 @@ export default [
entryFileNames: "[name].cjs",
dir: outputDir,
format: "commonjs",
interop: "auto",
preserveModules: true,
sourcemap: true,
},
{
entryFileNames: "[name].mjs",
dir: outputDir,
format: "esm",
format: "es",
preserveModules: true,
sourcemap: true,
},
Expand Down
2 changes: 1 addition & 1 deletion packages/kerosene/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
require("../../babel-register");
require("esbuild-register/dist/node").register();
// eslint-disable-next-line import/extensions
module.exports = require("./rollup-config.ts");
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"noImplicitOverride": true,
"noUncheckedIndexedAccess": true,
"esModuleInterop": true,
"jsx": "react"
"jsx": "react",
"skipLibCheck": true
},
"include": ["**/*", "**/.*", "**/.*/**/*", "**/.*/**/.*"],
"exclude": [
Expand Down
13 changes: 0 additions & 13 deletions typings/rollup-pugin-babel.d.ts

This file was deleted.

Loading

0 comments on commit af9e55b

Please sign in to comment.