1 Star 0 Fork 0

Cocos / gift

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

Yet another tool to generate bundled .d.ts.

The tool is essentially used in https://github.com/cocos-creator/engine .

For instance, this tool bundles

declare module "index" {
    export * from "math";
}
declare module "math" {
    export { Vec2 } from "math/vec2";
    export { Vec3 } from "math/vec3";
    import * as utils from "math/utils";
    export { utils };
}
declare module "math/vec2" {
    export class Vec2 {}
}
declare module "math/vec3" {
    export class Vec3 {}
}
declare module "math/utils" {
    export function sin();
    export function cos();
}

into

declare module "my-module" {
    export class Vec2 {}
    export class Vec3 {}
    namespace utils {
        export function sin(n: number);
        export function cos(n: number);
    }
}

Getting started

How-to

Install this package, such as, from npm:

npm install -g tfig

Compile your TypeScript project, make sure to let tsc generate a single declaration file. eg. Have the option outFile in tsconfig.json:

{
    outFile: "out.js",
}

Bundle:

gift-cli --input "out.d.ts" --root "name-of-the-root-module-in-your-project" --output "path-to-your-output-dir" --name "your-bundle-name"

Comman line arguments

input

Path to the unbundled *.d.ts file. In general, this file this produced by tsc.

root

Name of the root module to bundle.

output

Output path. Can be directory or file.

name

The generated module name.

空文件

简介

暂无描述 展开 收起
TypeScript 等 2 种语言
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/cocos/gift.git
git@gitee.com:cocos/gift.git
cocos
gift
gift
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891