@ghini/xstart 26.1.5151139 → 26.1.5160940

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,34 +1,22 @@
1
1
  # 一个标准 TypeScript 2026 的 npm 库脚手架
2
2
 
3
- ### 开发
4
-
5
- ```bash
6
- pnpm tsc --watch
7
- pnpm type-check # 类型检查(不生成文件)
8
- pnpm build # 编译 TypeScript + 打包 + 更新版本号
9
- ```
3
+ 2026 版现代 TS 脚手架:基于 Node 24 原生 ESM,利用“源码直连”实现免 build 实时调试;通过 esbuild 抹除后缀并配合 publishConfig,兼顾开发爽感与发布标准,是极致紧凑的 npm 库闭环模板。
10
4
 
11
5
  ### 发布
12
6
 
13
7
  ```bash
8
+ pnpm build # 编译 TypeScript + 打包 + 更新版本号
9
+ pnpm checkpub # 检查发布内容
14
10
  pnpm pub # 构建 + 发布到 npm + 提交 git
15
11
  ```
16
12
 
17
- ## 🔧 TypeScript 配置亮点
18
-
19
- - `moduleResolution: "bundler"` - 2025 最新模块解析策略
20
- - `verbatimModuleSyntax: true` - 严格 ESM 语法
21
- - `strict: true` - 全部严格类型检查
22
- - `declaration: true` - 自动生成类型声明
23
-
24
- 如果需要 pnpm 迁移:
13
+ ## 🔧 如果需要 pnpm 迁移:
25
14
 
26
15
  ```ps1
27
16
  pnpm import
28
17
  Remove-Item -Recurse -Force node_modules
29
18
  Remove-Item package-lock.json
30
19
  pnpm i
31
- pnpm tsc --watch
32
20
  ```
33
21
 
34
22
  ## 📦 创建新库
@@ -36,6 +24,8 @@ pnpm tsc --watch
36
24
  全文件替换 `xstart` 为新库名:
37
25
 
38
26
  ```bash
27
+ git clone -b xstart git@github.com:xghini/mynpm.git
28
+ rm -rf .git
39
29
  Remove-Item -Recurse -Force .git
40
30
  git init
41
31
  git add .
@@ -45,3 +35,12 @@ git remote add origin git@github.com:xghini/mynpm.git
45
35
  git push -u origin xstart
46
36
  pnpm pub
47
37
  ```
38
+
39
+ 💡 核心设计说明
40
+ 源码直连:package.json 中的 exports 在开发态指向 src/\*.ts,配合 Node.js 24 --experimental-strip-types 实现保存即生效,告别 tsc --watch。
41
+
42
+ 双模切换:利用 publishConfig 在发布时自动将入口切回 dist/\*.js,确保用户侧的兼容性。
43
+
44
+ 自动版本:build.js 内部集成日期版本算法(如 26.1.5161805),无需手动维护版本号。
45
+
46
+ 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.5151139",
3
+ "version": "26.1.5160940",
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"}