@ghini/xstart 26.1.5151627 → 26.1.5202440

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 CHANGED
@@ -1,5 +1,7 @@
1
1
  # 一个标准 TypeScript 2026 的 npm 库脚手架
2
2
 
3
+ 2026 版现代 TS 脚手架:基于 Node 24 原生 ESM,利用“源码直连”实现免 build 实时调试;通过 esbuild 抹除后缀并配合 publishConfig,兼顾开发爽感与发布标准,是极致紧凑的 npm 库闭环模板。
4
+
3
5
  ### 发布
4
6
 
5
7
  ```bash
@@ -15,7 +17,6 @@ pnpm import
15
17
  Remove-Item -Recurse -Force node_modules
16
18
  Remove-Item package-lock.json
17
19
  pnpm i
18
- pnpm tsc --watch
19
20
  ```
20
21
 
21
22
  ## 📦 创建新库
@@ -23,6 +24,8 @@ pnpm tsc --watch
23
24
  全文件替换 `xstart` 为新库名:
24
25
 
25
26
  ```bash
27
+ git clone -b xstart git@github.com:xghini/mynpm.git
28
+ mv mynpm xstart&&cd xstart
26
29
  rm -rf .git
27
30
  Remove-Item -Recurse -Force .git
28
31
  git init
@@ -33,3 +36,12 @@ git remote add origin git@github.com:xghini/mynpm.git
33
36
  git push -u origin xstart
34
37
  pnpm pub
35
38
  ```
39
+
40
+ 💡 核心设计说明
41
+ 源码直连:package.json 中的 exports 在开发态指向 src/\*.ts,配合 Node.js 24 --experimental-strip-types 实现保存即生效,告别 tsc --watch。
42
+
43
+ 双模切换:利用 publishConfig 在发布时自动将入口切回 dist/\*.js,确保用户侧的兼容性。
44
+
45
+ 自动版本:build.js 内部集成日期版本算法(如 26.1.5161805),无需手动维护版本号。
46
+
47
+ esbuild 抹除:构建阶段自动处理 .ts 后缀映射,生成的单文件 ESM 产物极其紧凑。
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export * from "./start.js";
1
+ export * from './start.ts';
2
2
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,3 +1,8 @@
1
- // src/index.ts
2
- export * from "./start.js";
3
- //# sourceMappingURL=index.js.map
1
+ // src/start.ts
2
+ function start() {
3
+ console.log("Hello Ghini use ts");
4
+ }
5
+ export {
6
+ start
7
+ };
8
+ //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1,7 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,cAAc,YAAY,CAAC"}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/start.ts"],
4
+ "sourcesContent": ["// start.ts\nexport { start };\n\nfunction start(): void {\n console.log(\"Hello Ghini use ts\");\n}\n"],
5
+ "mappings": ";AAGA,SAAS,QAAc;AACrB,UAAQ,IAAI,oBAAoB;AAClC;",
6
+ "names": []
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ghini/xstart",
3
- "version": "26.1.5151627",
3
+ "version": "26.1.5202440",
4
4
  "type": "module",
5
5
  "author": "Ghini",
6
6
  "license": "MIT",
@@ -19,6 +19,7 @@
19
19
  ],
20
20
  "devDependencies": {
21
21
  "@types/node": "^25.0.3",
22
+ "esbuild": "^0.27.2",
22
23
  "typescript": "^5.9.3"
23
24
  },
24
25
  "scripts": {
package/src/index.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  // src/index.ts
2
- export * from "./start.js";
2
+ export * from './start.ts';
@@ -1,2 +0,0 @@
1
- export * from "../start.js";
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
package/dist/lib/index.js DELETED
@@ -1,2 +0,0 @@
1
- export * from "../start.js";
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
@@ -1,3 +0,0 @@
1
- export { start };
2
- declare function start(): void;
3
- //# sourceMappingURL=start.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../src/lib/start.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,CAAC;AAEjB,iBAAS,KAAK,IAAI,IAAI,CAErB"}
package/dist/lib/start.js DELETED
@@ -1,5 +0,0 @@
1
- export { start };
2
- function start() {
3
- console.log("Hello Ghini use ts");
4
- }
5
- //# sourceMappingURL=start.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"start.js","sourceRoot":"","sources":["../../src/lib/start.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,CAAC;AAEjB,SAAS,KAAK;IACZ,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;AACpC,CAAC"}
package/dist/main.d.ts DELETED
@@ -1,4 +0,0 @@
1
- declare const _default: any;
2
- export default _default;
3
- export * from "./lib/index.js";
4
- //# sourceMappingURL=main.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";AACA,wBAEC;AACD,cAAc,gBAAgB,CAAC"}
package/dist/main.js DELETED
@@ -1,6 +0,0 @@
1
- import * as index from "./lib/index.js";
2
- export default {
3
- ...index,
4
- };
5
- export * from "./lib/index.js";
6
- //# sourceMappingURL=main.js.map
package/dist/main.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AACxC,eAAe;IACb,GAAG,KAAK;CACT,CAAA;AACD,cAAc,gBAAgB,CAAC"}
package/dist/start.js DELETED
@@ -1,6 +0,0 @@
1
- // start.ts
2
- export { start };
3
- function start() {
4
- console.log("Hello Ghini use ts");
5
- }
6
- //# sourceMappingURL=start.js.map
package/dist/start.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"start.js","sourceRoot":"","sources":["../src/start.ts"],"names":[],"mappings":"AAAA,WAAW;AACX,OAAO,EAAE,KAAK,EAAE,CAAC;AAEjB,SAAS,KAAK;IACZ,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;AACpC,CAAC"}