@lakutata/cli 3.1.2 → 3.1.4
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 +5 -2
- package/README.zh-CN.md +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -279,8 +279,11 @@ declarations, source maps, TypeScript sources and documentation of the packages
|
|
|
279
279
|
sources and objects of the addons (better-sqlite3 holds the source of SQLite) and what built them: the files of node-gyp
|
|
280
280
|
and of CMake in `build/`, the `target` directory of cargo, the static and import libraries. The addons of the
|
|
281
281
|
application itself (`require('./x.node')`, `createRequire(import.meta.url)('./x.node')`) go into the tree too. The
|
|
282
|
-
packages of the framework, and those built on it, are always bundled with the application, whatever they depend on
|
|
283
|
-
that there is one copy of the framework, its classes and its container
|
|
282
|
+
packages of the framework, and those built on it, are always bundled with the application, whatever they depend on or
|
|
283
|
+
hold, so that there is one copy of the framework, its classes and its container. Their native dependencies go into the
|
|
284
|
+
tree, and so do their own addons when they are loaded by a `require` of the file, by a path from their module
|
|
285
|
+
(`path.join(__dirname, 'prebuilds', ...)`) or from their own directory (`node-gyp-build`); an addon loaded in another
|
|
286
|
+
way is named in the warnings.
|
|
284
287
|
Optional dependencies that are not installed (the drivers of stores the application does not use: `peerDependenciesMeta`
|
|
285
288
|
optional, `optionalDependencies`) are left out: loading one throws at run time, as it would without the bundle.
|
|
286
289
|
|
package/README.zh-CN.md
CHANGED
|
@@ -167,7 +167,7 @@ lakutata create --name my-service --template service --with i18n --yes
|
|
|
167
167
|
|
|
168
168
|
单文件包是 CommonJS 模块,因为 Node.js 的可执行文件要运行它们。应用的 ES 模块会被转换,所以不能使用顶层 `await`:请在异步函数里 await。
|
|
169
169
|
|
|
170
|
-
原生插件(`.node` 文件)无法打进单文件包。打包时,工具会找出含有插件的包,以及通过计算出的路径加载插件的包(例如 sharp),把它们连同运行时加载的内容(它们 require 的 JavaScript,以及插件所链接的共享库所在的包,例如 libvips)排除在单文件包之外,按 `node_modules` 的结构放在 `dist/<name>.native/` 中,这个目录随单文件包一起发布。其中是运行时加载的文件:插件和共享库所在包的全部文件;其他包则是它们加载的 JavaScript(逐个跟踪得出)和其他文件(它们读取的数据);以及通过无法跟踪的路径加载自身文件的包(`require(path.join(__dirname, name))`)的全部文件。这些包的类型声明、source map、TypeScript 源码和文档会被排除,插件的 C 和 C++ 源码和目标文件(better-sqlite3 带有 SQLite 的源码),以及构建它们时产生的文件也会被排除:`build/` 中 node-gyp 和 CMake 的文件、cargo 的 `target` 目录、静态库和导入库。应用自己的插件(`require('./x.node')`、`createRequire(import.meta.url)('./x.node')
|
|
170
|
+
原生插件(`.node` 文件)无法打进单文件包。打包时,工具会找出含有插件的包,以及通过计算出的路径加载插件的包(例如 sharp),把它们连同运行时加载的内容(它们 require 的 JavaScript,以及插件所链接的共享库所在的包,例如 libvips)排除在单文件包之外,按 `node_modules` 的结构放在 `dist/<name>.native/` 中,这个目录随单文件包一起发布。其中是运行时加载的文件:插件和共享库所在包的全部文件;其他包则是它们加载的 JavaScript(逐个跟踪得出)和其他文件(它们读取的数据);以及通过无法跟踪的路径加载自身文件的包(`require(path.join(__dirname, name))`)的全部文件。这些包的类型声明、source map、TypeScript 源码和文档会被排除,插件的 C 和 C++ 源码和目标文件(better-sqlite3 带有 SQLite 的源码),以及构建它们时产生的文件也会被排除:`build/` 中 node-gyp 和 CMake 的文件、cargo 的 `target` 目录、静态库和导入库。应用自己的插件(`require('./x.node')`、`createRequire(import.meta.url)('./x.node')`)也放进这个目录。框架的包以及基于框架的包,不论依赖什么、自己是否带有插件,总是和应用一起打进单文件包,这样框架、它的类和它的容器都只有一份。它们的原生依赖放进这个目录;它们自己的插件也放进这个目录,前提是插件通过直接 `require` 插件文件、从模块位置构造的路径(`path.join(__dirname, 'prebuilds', ...)`)或包自身的目录(`node-gyp-build`)加载,用其他方式加载的插件会列在警告中。没有安装的可选依赖(应用没有用到的存储驱动:`peerDependenciesMeta` 中标为 optional 的依赖,以及 `optionalDependencies`)会被排除:运行时加载它会抛出异常,和不打包时一样。
|
|
171
171
|
|
|
172
172
|
打包器不会跟踪应用按路径读取的文件:它单独运行的脚本(worker:`new Worker()`、传入文件的 worker 池;子进程:`fork()`;按路径加载的模块:`require(path.join(__dirname, 'x.js'))`),以及它的数据(`fs.readFileSync(path.join(__dirname, 'defaults.json'))`、存放 schema 的目录)。而且单文件包并不在原来各个模块所在的位置:在 `build/config/` 中的模块里,`path.resolve(__dirname, '../../schema')` 是项目的 `schema/` 目录,但打包到 `dist/` 之后就不是了。工具会在应用的模块和它所用包的模块中,找出所有由模块位置构造出的文件路径,不论写在哪里,并改写这些表达式,让它们指向 `.native` 目录中的文件(`dist/<name>.native/.lakutata/files/`,目录结构与项目中相同,从项目外部链接进来的包放在 `node_modules/` 下):
|
|
173
173
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lakutata/cli",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.4",
|
|
4
4
|
"description": "The command line tool of the lakutata framework: create the projects from the templates, run and version the packages of the workspaces, bundle the applications and make their executables (with @lakutata/builder).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lakutata",
|
|
@@ -39,10 +39,10 @@
|
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@inquirer/prompts": "^8.7.2",
|
|
41
41
|
"commander": "^15.0.0",
|
|
42
|
-
"lakutata": "3.1.
|
|
42
|
+
"lakutata": "3.1.4"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"@lakutata/builder": "~3.1.
|
|
45
|
+
"@lakutata/builder": "~3.1.3",
|
|
46
46
|
"@lakutata/ffi": "~3.1.2"
|
|
47
47
|
},
|
|
48
48
|
"peerDependenciesMeta": {
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
}
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@lakutata/builder": "~3.1.
|
|
57
|
+
"@lakutata/builder": "~3.1.3",
|
|
58
58
|
"@lakutata/ffi": "~3.1.2"
|
|
59
59
|
},
|
|
60
60
|
"engines": {
|