How to use the dts-bundle.bundle function in dts-bundle

To help you get started, we’ve selected a few dts-bundle examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sony / cdp-js / packages / master-tasks / tasks / bundle-finalizer.js View on Github external
function normalize_lib_d_ts() {
    const dts   = require('dts-bundle');
    const tsfmt = require('typescript-formatter');
    const TYPE_DEF_FILE = path.join(__dirname, '..', config.dir.pkg, config.dir.types, PACKAGE_NAME, config.main.bundle_d_ts);

    // concat d.ts
    dts.bundle(config.dts_bundle);

    // format d.ts
    tsfmt.processStream(TYPE_DEF_FILE, fs.createReadStream(TYPE_DEF_FILE), {
        tsfmt: tsfmt,
    })
    .then((content) => {
        let src = '\ufeff' + banner('.d.ts') + content.message
            .replace(/^\ufeff/gm, '')
            .replace(/\r\n/gm, '\n')
            .replace(/^\/\/ Generated by dts-bundle[\s\S]*?\n/g, '')
            .replace(/^        \*/gm, '     *')
            .replace(/^            \*/gm, '         *')
            .replace(/^                \*/gm, '             *')
            .replace(/'/gm, '"')
        ;
        fs.writeFileSync(TYPE_DEF_FILE, src);
github thalesmello / typematch / gulpfile.js View on Github external
gulp.task('bundle_definitions', (done) => {
	var opts = {
		name: 'typematch',
		main: 'bin/src/typematch.d.ts',
		baseDir: 'bin',
		out: 'src/bundle.d.ts',
	};

	// require module
	var dts = require('dts-bundle');

	// run it
	dts.bundle(opts);
	return done();
})
github hpcc-systems / Visualization / tests / test-util / src / types.spec.ts View on Github external
function calcExternals(main: string = "types/index.d.ts", out: string = "dist/index.d.ts") {
    const bundleInfo: any = dts.bundle({
        name: "__dummy__",
        baseDir: ".",
        main,
        out,
        outputAsModuleFolder: true
    });
    const externals: string[] = [];
    for (const key in bundleInfo.fileMap) {
        for (const external of bundleInfo.fileMap[key].externalImports) {
            if (externals.indexOf(external) < 0) {
                externals.push(external);
            }
        }
    }
    return externals;
}
github surveyjs / survey-library / webpack.config.js View on Github external
var percentage_handler = function handler(percentage, msg) {
    if (0 === percentage) {
      console.log("Build started... good luck!");
    } else if (1 === percentage) {
      if (options.buildType === "prod") {
        dts.bundle({
          name: "../../survey." + options.platformPrefix,
          main: packagePath + "typings/entries/" + options.platform + ".d.ts",
          outputAsModuleFolder: true,
          headerText: dts_banner
        });

        if (options.platform === "vue") {
          replace(
            {
              files: packagePath + "survey.vue.d.ts",
              from: /export default\s+\w+;/g,
              to: ""
            },
            (error, changes) => {
              if (error) {
                return console.error("Error occurred:", error);
github nikeee / node-ts / bundle.js View on Github external
require("dts-bundle").bundle({
  name: "node-ts",
  main: "build/node-ts.d.ts",
  out: "node-ts.d.ts"
});
github icek / ash / webpack.config.js View on Github external
compiler.plugin( 'done', () => {
        let {opts} = this;
        require( 'dts-bundle' ).bundle( opts );
        if( opts.removeSource && opts.removeSourceDir ) require( 'rimraf' )( opts.removeSourceDir, () => {} );
    } );
};

dts-bundle

Export TypeScript .d.ts files as an external module definition

MIT
Latest version published 7 years ago

Package Health Score

51 / 100
Full package analysis

Popular dts-bundle functions