@gamedev-sensei/tsdown-config 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,24 @@
1
+ # @gamedev-sensei/tsdown-config
2
+
3
+ Provides simple tsdown configuration function `definePackageConfig` that instructs tsdown to:
4
+
5
+ * build for `cjs` and `esm`
6
+ * put build files in the `dist` directory
7
+ * start compilation from `src/index.ts` file
8
+ * type definitions
9
+ * source maps
10
+ * prevent node_modules from being bundled
11
+
12
+ Additionally, you can pass tsdown config to `definePackageConfig` to override parts of config.
13
+
14
+ ## Installation
15
+
16
+ Yarn:
17
+ ```bash
18
+ yarn add @gamedev-sensei/tsdown-config
19
+ ```
20
+
21
+ Npm:
22
+ ```bash
23
+ npm i @gamedev-sensei/tsdown-config
24
+ ```
@@ -0,0 +1,9 @@
1
+ import { Options, defineConfig } from "tsdown";
2
+
3
+ //#region src/index.d.ts
4
+ type TSupConfig = ReturnType<typeof defineConfig>;
5
+ type PackageConfigProps = Options | Options[];
6
+ declare function definePackageConfig(config?: PackageConfigProps): TSupConfig;
7
+ //#endregion
8
+ export { PackageConfigProps, TSupConfig, definePackageConfig };
9
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1,9 @@
1
+ import { Options, defineConfig } from "tsdown";
2
+
3
+ //#region src/index.d.ts
4
+ type TSupConfig = ReturnType<typeof defineConfig>;
5
+ type PackageConfigProps = Options | Options[];
6
+ declare function definePackageConfig(config?: PackageConfigProps): TSupConfig;
7
+ //#endregion
8
+ export { PackageConfigProps, TSupConfig, definePackageConfig };
9
+ //# sourceMappingURL=index.d.ts.map
package/dist/index.js ADDED
@@ -0,0 +1,41 @@
1
+ //#region rolldown:runtime
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
+ key = keys[i];
11
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
+ get: ((k) => from[k]).bind(null, key),
13
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
+ });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
+ value: mod,
20
+ enumerable: true
21
+ }) : target, mod));
22
+
23
+ //#endregion
24
+ const tsdown = __toESM(require("tsdown"));
25
+
26
+ //#region src/index.ts
27
+ function definePackageConfig(config = []) {
28
+ const defaultOptions = {
29
+ entry: ["src/index.ts"],
30
+ format: ["esm", "cjs"],
31
+ dts: true,
32
+ sourcemap: true,
33
+ clean: true,
34
+ skipNodeModulesBundle: true
35
+ };
36
+ return (0, tsdown.defineConfig)([defaultOptions, ...Array.isArray(config) ? config : [config]]);
37
+ }
38
+
39
+ //#endregion
40
+ exports.definePackageConfig = definePackageConfig;
41
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["config: PackageConfigProps","defaultOptions: Options"],"sources":["../src/index.ts"],"sourcesContent":["import {defineConfig, Options} from \"tsdown\";\n\nexport type TSupConfig = ReturnType<typeof defineConfig>\nexport type PackageConfigProps = Options | Options[]\nexport function definePackageConfig(config: PackageConfigProps = []): TSupConfig {\n const defaultOptions: Options = {\n entry: ['src/index.ts'],\n format: ['esm', 'cjs'],\n dts: true,\n sourcemap: true,\n clean: true,\n skipNodeModulesBundle: true\n }\n\n return defineConfig([ defaultOptions, ...(Array.isArray(config) ? config : [ config ]) ])\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,SAAgB,oBAAoBA,SAA6B,CAAE,GAAc;CAC7E,MAAMC,iBAA0B;EAC5B,OAAO,CAAC,cAAe;EACvB,QAAQ,CAAC,OAAO,KAAM;EACtB,KAAK;EACL,WAAW;EACX,OAAO;EACP,uBAAuB;CAC1B;AAED,QAAO,yBAAa,CAAE,gBAAgB,GAAI,MAAM,QAAQ,OAAO,GAAG,SAAS,CAAE,MAAQ,CAAG,EAAC;AAC5F"}
package/dist/index.mjs ADDED
@@ -0,0 +1,18 @@
1
+ import { defineConfig } from "tsdown";
2
+
3
+ //#region src/index.ts
4
+ function definePackageConfig(config = []) {
5
+ const defaultOptions = {
6
+ entry: ["src/index.ts"],
7
+ format: ["esm", "cjs"],
8
+ dts: true,
9
+ sourcemap: true,
10
+ clean: true,
11
+ skipNodeModulesBundle: true
12
+ };
13
+ return defineConfig([defaultOptions, ...Array.isArray(config) ? config : [config]]);
14
+ }
15
+
16
+ //#endregion
17
+ export { definePackageConfig };
18
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":["config: PackageConfigProps","defaultOptions: Options"],"sources":["../src/index.ts"],"sourcesContent":["import {defineConfig, Options} from \"tsdown\";\n\nexport type TSupConfig = ReturnType<typeof defineConfig>\nexport type PackageConfigProps = Options | Options[]\nexport function definePackageConfig(config: PackageConfigProps = []): TSupConfig {\n const defaultOptions: Options = {\n entry: ['src/index.ts'],\n format: ['esm', 'cjs'],\n dts: true,\n sourcemap: true,\n clean: true,\n skipNodeModulesBundle: true\n }\n\n return defineConfig([ defaultOptions, ...(Array.isArray(config) ? config : [ config ]) ])\n}"],"mappings":";;;AAIA,SAAgB,oBAAoBA,SAA6B,CAAE,GAAc;CAC7E,MAAMC,iBAA0B;EAC5B,OAAO,CAAC,cAAe;EACvB,QAAQ,CAAC,OAAO,KAAM;EACtB,KAAK;EACL,WAAW;EACX,OAAO;EACP,uBAAuB;CAC1B;AAED,QAAO,aAAa,CAAE,gBAAgB,GAAI,MAAM,QAAQ,OAAO,GAAG,SAAS,CAAE,MAAQ,CAAG,EAAC;AAC5F"}
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "@gamedev-sensei/tsdown-config",
3
+ "repository": "git@github.com:gamedev-sensei/package-extras.git",
4
+ "version": "2.0.0",
5
+ "license": "MIT",
6
+ "main": "dist/index.js",
7
+ "module": "dist/index.mjs",
8
+ "types": "dist/index.d.ts",
9
+ "files": [
10
+ "/dist"
11
+ ],
12
+ "exports": {
13
+ "import": {
14
+ "types": "./dist/index.d.mts",
15
+ "import": "./dist/index.mjs"
16
+ },
17
+ "require": {
18
+ "types": "./dist/index.d.ts",
19
+ "require": "./dist/index.js"
20
+ }
21
+ },
22
+ "scripts": {
23
+ "type-check": "tsc --noEmit",
24
+ "build": "tsdown && attw --pack ."
25
+ },
26
+ "dependencies": {
27
+ "esbuild-plugin-alias": "^0.2.1"
28
+ },
29
+ "devDependencies": {
30
+ "@arethetypeswrong/cli": "^0.18.2",
31
+ "@gamedev-sensei/ts-config": "2.0.0",
32
+ "tsdown": "^0.12.9"
33
+ }
34
+ }