Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}),
ignore(packageConfig.ignore || []),
ts({
check: !hasTSChecked,
tsconfig: path.resolve(__dirname, 'tsconfig.json'),
cacheRoot: path.resolve(__dirname, 'node_modules/.rts2_cache'),
tsconfigOverride: {
include: ['packages/**/src/**/*.ts'],
exclude: ['packages/**/src/__tests__/**/*.ts'],
compilerOptions: {
declaration: !hasTSChecked,
declarationMap: !hasTSChecked,
},
},
}),
alias(aliasOptions),
...transpilerPlugins,
...compressorPlugins,
filesize({
showMinifiedSize: false,
showGzippedSize: true,
}),
],
output,
onwarn(msg, warn) {
if (!/Circular/.test(msg)) {
warn(msg);
}
},
});
// We just generate TS declarations once for each package.
env: 'development',
minify: false,
isBrowser: false,
}
) {
// force production mode when minifying
if (minify) env = 'production'
const config = {
input,
plugins: [
replace({
__VERSION__: pkg.version,
'process.env.NODE_ENV': `'${env}'`,
}),
alias({
resolve: ['.ts', '.js'],
entries: [{ find: 'firebase', replacement: path.join(__dirname, './stub') }],
}),
],
output: {
banner,
file: `dist/${pkg.name}.UNKNOWN.js`,
format,
},
}
if (format === 'iife') {
config.output.file = pkg.unpkg
config.output.name = exportName
} else if (format === 'es') {
config.output.file = isBrowser ? pkg.browser : pkg.module
let copyTargets = [''];
let copyOutput = 'public';
// prod only options
if (env === 'prod') {
postcssExtract = 'dist/cedar-compiled.css';
copyOutput = 'dist';
}
// dev and prod options
if (env !== 'test') {
copyTargets = ['static/cdr-fonts.css'];
}
const plugins = [
(env == 'test' || env == 'dev') && alias({
resolve: ['.json', '.js', '.jsx', '.scss', '.vue'],
entries: {
srcdir: resolve('src'),
cssdir: resolve('src/css'),
assetsdir: resolve('src/assets'),
componentsdir: resolve('src/components'),
mixinsdir: resolve('src/mixins'),
},
}),
nodeResolve({
mainFields: ['module', 'jsnext:main', 'main'],
extensions: ['.mjs', '.js', '.jsx', '.json'],
}),
env !== 'prod' && vue({
style: {
postcssModulesOptions: {
type === "umd" &&
cjs({
include: ["**/node_modules/**", "node_modules/**"]
}),
(type === "browser" || type === "umd") &&
replace({
["typeof " + "document"]: JSON.stringify("object"),
["typeof " + "window"]: JSON.stringify("object")
}),
rewriteBabelRuntimeHelpers(),
json({
// @ts-ignore
namedExports: false
}),
type === "umd" &&
alias({
entries: rollupAliases
}),
resolve({
extensions: EXTENSIONS,
customResolveOptions: {
moduleDirectory: type === "umd" ? "node_modules" : []
}
}),
(type === "umd" || type === "node-prod") &&
replace({
// tricking static analysis is fun...
["process" + ".env.NODE_ENV"]: '"production"'
}),
type === "umd" && terser(),
type === "node-prod" &&
terser({
input = 'src/index.ts', // entry point
env = 'development', // NODE_ENV variable
minify = false,
isBrowser = false, // produce a browser module version or not
}) {
// force production mode when minifying
if (minify) env = 'production'
const config = {
input,
plugins: [
replace({
__VERSION__: pkg.version,
'process.env.NODE_ENV': `'${env}'`,
}),
alias({
resolve: ['.ts', '.js'],
// entries: [{ find: 'firebase', replacement: path.join(__dirname, './stub') }],
}),
],
output: {
banner,
file: `dist/${pkg.name}.UNKNOWN.js`,
format,
globals: {
'@vue/composition-api': 'VueCompositionApi',
},
},
}
if (format === 'iife') {
function genConfig(name) {
const opts = builds[name];
const config = {
input: opts.entry,
external: ["vue"],
plugins: [
css({
output: "dist/vue-finder.css"
}),
vue({ compileTemplate: true, css: false }),
alias({
entries: [
{
find: "@",
replacement: path.resolve("src")
}
]
}),
resolve({
browser: true,
preferBuiltins: false,
extensions: [".js", ".json", ".vue"]
}),
json(),
babel({
exclude: "node_modules/**",
sourceMap: true,
function setAlias() {
const projectRootDir = path.resolve(__dirname);
return alias({
resolve: [".svelte", ".js"],
entries: [
{
find: "src",
replacement: path.resolve(projectRootDir, "src")
}
]
});
}
import { terser } from "rollup-plugin-terser";
import typescript from "rollup-plugin-typescript2";
import path from "path";
import pkg from "./package.json";
const name = "ReactDayPicker";
const input = "./src/index.ts";
const globals = { react: "React" };
const external = Object.keys(globals);
const typescriptPlugin = typescript({
rollupCommonJSResolveHack: true,
clean: true,
verbosity: 2
});
const aliasPlugin = alias({
resolve: ["*.ts", "*.tsx"],
entries: {
components: path.resolve("./src/components")
}
});
const replaceProduction = replace({
"process.env.NODE_ENV": JSON.stringify("production")
});
export default [
{
input,
output: {
file: "lib/index.umd.js",
format: "umd",
name,