當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript rollup-plugin-typescript.default函數代碼示例

本文整理匯總了TypeScript中rollup-plugin-typescript.default函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript default函數的具體用法?TypeScript default怎麽用?TypeScript default使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了default函數的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: generateToolsJs

async function generateToolsJs(): Promise<void> {
  for (const bin of ["configure-ui", "dump-data-model"]) {
    const inputFile = path.resolve(INPUT_DIR, `tools/${bin}`);
    const outputFile = path.resolve(OUTPUT_DIR, `tools/${bin}`);
    const bundle = await rollup({
      input: inputFile,
      external: externals,
      acorn: {
        allowHashBang: true
      },
      plugins: [
        rollupReplace({
          delimiters: ["", ""],
          "#!/usr/bin/env -S node -r esm -r ts-node/register/transpile-only": ""
        }),
        typescript({
          tsconfig: "./tsconfig.json",
          include: [`tools/${bin}`, "lib/**/*.ts"]
        }),
        MODE === "production" ? terser() : null
      ]
    });

    await bundle.write({
      format: "cjs",
      preferConst: true,
      banner: "#!/usr/bin/env node",
      file: outputFile
    });

    // Mark as executable
    const mode = fs.statSync(outputFile).mode;
    fs.chmodSync(outputFile, mode | 73);
  }
}
開發者ID:zaidka,項目名稱:genieacs,代碼行數:35,代碼來源:build.ts

示例2: generateBackendJs

async function generateBackendJs(): Promise<void> {
  for (const bin of [
    "genieacs-cwmp",
    "genieacs-ext",
    "genieacs-nbi",
    "genieacs-fs",
    "genieacs-ui"
  ]) {
    const inputFile = path.resolve(INPUT_DIR, `bin/${bin}`);
    const outputFile = path.resolve(OUTPUT_DIR, `bin/${bin}`);
    const bundle = await rollup({
      input: inputFile,
      external: externals,
      acorn: {
        allowHashBang: true
      },
      treeshake: {
        propertyReadSideEffects: false,
        pureExternalModules: true
      },
      plugins: [
        rollupReplace({
          delimiters: ["", ""],
          "#!/usr/bin/env -S node -r esm -r ts-node/register/transpile-only": ""
        }),
        rollupJson({ preferConst: true }),
        {
          resolveId: (importee, importer) => {
            if (importee.endsWith("/package.json")) {
              const p = path.resolve(path.dirname(importer), importee);
              if (p === path.resolve(INPUT_DIR, "package.json"))
                return path.resolve(OUTPUT_DIR, "package.json");
            }
            return null;
          }
        },
        typescript({
          tsconfig: "./tsconfig.json",
          include: [`bin/${bin}`, "lib/**/*.ts"]
        }),
        MODE === "production" ? terser() : null
      ]
    });

    await bundle.write({
      format: "cjs",
      preferConst: true,
      banner: "#!/usr/bin/env node",
      file: outputFile
    });

    // Mark as executable
    const mode = fs.statSync(outputFile).mode;
    fs.chmodSync(outputFile, mode | 73);
  }
}
開發者ID:zaidka,項目名稱:genieacs,代碼行數:56,代碼來源:build.ts

示例3: generateFrontendJs

async function generateFrontendJs(): Promise<void> {
  const inputFile = path.resolve(INPUT_DIR, "ui/app.ts");
  const outputFile = path.resolve(OUTPUT_DIR, "public/app.js");

  const bundle = await rollup({
    input: inputFile,
    external: externals,
    plugins: [
      rollupJson({ preferConst: true }),
      typescript({ tsconfig: "./tsconfig.json" })
    ],
    inlineDynamicImports: true,
    treeshake: {
      propertyReadSideEffects: false,
      pureExternalModules: true
    },
    onwarn: ((warning, warn) => {
      // Ignore circular dependency warnings
      if (warning.code !== "CIRCULAR_DEPENDENCY") warn(warning);
    }) as WarningHandler
  });

  await bundle.write({
    preferConst: true,
    format: "esm",
    file: outputFile
  });

  const webpackConf = {
    mode: MODE,
    entry: outputFile,
    resolve: {
      aliasFields: ["module"]
    },
    output: {
      path: path.resolve(OUTPUT_DIR, "public"),
      filename: "app.js"
    }
  };

  const stats = await promisify(webpack)(webpackConf);
  process.stdout.write(stats.toString({ colors: true }) + "\n");
}
開發者ID:zaidka,項目名稱:genieacs,代碼行數:43,代碼來源:build.ts

示例4: typescript

    .map(entry => {

      const path = entry.replace(/\\/g, '/');

      return rollup.rollup({
        input: `${path}/Script.ts`,
        plugins: [
          typescript({
            typescript: require('typescript'),
            tsconfig: tsconfig
          })
        ]
      })
        .then((bundle: any) => {
          return bundle.write({
            file: `${Config.dist.dev}${path.split('src/')[1]}/Script.js`,
            format: 'iife'
          });
        })
    });
開發者ID:vyakymenko,項目名稱:qlikview-extensions-starter-pack-es6,代碼行數:20,代碼來源:ts.build.dev.ts

示例5: require

const pluginCommonJS = require('rollup-plugin-commonjs')
const pluginImage = require('rollup-plugin-url')
const pluginMarkdown = require('rollup-plugin-md')
const pluginTypescript = require('rollup-plugin-typescript')
const pluginReplace = require('rollup-plugin-replace')
const path = require('path')

export const plugins = [
  pluginImage(),
  pluginMarkdown(),
  pluginNodeResolve(),
  pluginCommonJS(),
  pluginReplace({ 'process.env.NODE_ENV': '"production"' }),
  pluginTypescript({
    tsconfig: false,
    experimentalDecorators: true,
    module: 'es2015'
  }),
  pluginBabel({
    presets: [
      [
        require.resolve('@babel/preset-env'),
        {
          modules: false,
          targets: {
            browsers: ['last 2 versions']
          }
        }
      ]
    ],
    babelrc: false,
開發者ID:liekkas,項目名稱:rollup-plugin-vue,代碼行數:31,代碼來源:plugins.ts

示例6: rollupTypeScript

  output: [
    {
      file: pkg.main,
      format: "cjs",
    },
    {
      file: pkg.module,
      format: "es",
    },
  ],
  external: [
    "tslib",
    // @ts-ignore
    ...Object.keys(process.binding("natives")),
    ...Object.keys(pkg.dependencies || {}),
    ...Object.keys(pkg.peerDependencies || {}),
  ],
  plugins: [
    rollupTypeScript({
      "target": "es5",
      "module": "es6",
    }),
    rollupBabel({
      plugins: [
        "babel-plugin-pure-calls-annotation",
      ],
      exclude: "node_modules/**",
      extensions: [".js", ".jsx", ".ts", ".tsx"],
    }),
  ],
};
開發者ID:querycap,項目名稱:reactorx,代碼行數:31,代碼來源:rollup.config.ts


注:本文中的rollup-plugin-typescript.default函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。