Skip to content

Commit

Permalink
build: add exports map and bundle with pkgroll (#265)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: exports map and bundled files
  • Loading branch information
privatenumber committed Feb 8, 2023
1 parent ecb181e commit f907edd
Show file tree
Hide file tree
Showing 9 changed files with 198 additions and 13 deletions.
17 changes: 13 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,28 @@
"files": [
"dist"
],
"main": "./dist/index.js",
"main": "./dist/index.cjs",
"types": "./dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.cjs"
},
"./package.json": "./package.json"
},
"imports": {
"#esbuild-loader": {
"types": "./src/index.ts",
"types": "./src/index.d.ts",
"development": "./src/index.ts",
"default": "./dist/index.js"
"default": "./dist/index.cjs"
}
},
"scripts": {
"build": "tsc",
"build": "pkgroll --target=node12.20.0",
"test": "tsx tests",
"dev": "tsx watch --conditions=development tests",
"lint": "eslint --cache .",
"type-check": "tsc --noEmit",
"prepack": "pnpm build && clean-pkg-json"
},
"peerDependencies": {
Expand All @@ -59,6 +67,7 @@
"manten": "^0.6.0",
"memfs": "^3.4.13",
"mini-css-extract-plugin": "^1.6.2",
"pkgroll": "^1.8.0",
"tsx": "^3.12.2",
"typescript": "^4.9.4",
"webpack": "^4.44.2",
Expand Down
174 changes: 174 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions src/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { MinifyPluginOptions } from './types';

export class ESBuildMinifyPlugin {
constructor(options?: MinifyPluginOptions);

apply(compiler: any): void;
}

export * from './types';
1 change: 0 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ import ESBuildMinifyPlugin from './minify-plugin';

export default esbuildLoader;
export { ESBuildPlugin, ESBuildMinifyPlugin };
export * from './interfaces';
2 changes: 1 addition & 1 deletion src/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { getOptions } from 'loader-utils';
import webpack from 'webpack';
import JoyCon, { LoadResult } from 'joycon';
import JSON5 from 'json5';
import { LoaderOptions } from './interfaces';
import type { LoaderOptions } from './types';

const joycon = new JoyCon();

Expand Down
2 changes: 1 addition & 1 deletion src/minify-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type {
} from 'tapable';
import type { Source } from 'webpack-sources';
import { matchObject } from 'webpack/lib/ModuleFilenameHelpers.js';
import { MinifyPluginOptions } from './interfaces';
import type { MinifyPluginOptions } from './types';

type StatsPrinter = {
hooks: {
Expand Down
File renamed without changes.
4 changes: 0 additions & 4 deletions tests/tsconfig.json

This file was deleted.

2 changes: 0 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"compilerOptions": {
"outDir": "dist",
"module": "Node16",

// Node 10
Expand All @@ -12,5 +11,4 @@
"esModuleInterop": true,
"skipLibCheck": true
},
"include": ["src"]
}

0 comments on commit f907edd

Please sign in to comment.