MCPcopy Index your code
hub / github.com/tinyplex/tinybase / compileModule

Function compileModule

gulpfile.mjs:528–655  ·  view source on GitHub ↗
(module, dir = DIST_DIR, min = false)

Source from the content-addressed store, hash-verified

526};
527
528const compileModule = async (module, dir = DIST_DIR, min = false) => {
529 const {default: esbuild} = await import('rollup-plugin-esbuild');
530 const {rollup} = await import('rollup');
531 const {babel} = await import('@rollup/plugin-babel');
532 const {default: replace} = await import('@rollup/plugin-replace');
533 const {default: prettierPlugin} = await import('rollup-plugin-prettier');
534 const {default: shebang} = await import('rollup-plugin-preserve-shebang');
535 const {default: image} = await import('@rollup/plugin-image');
536 const {default: terser} = await import('@rollup/plugin-terser');
537 const sveltePlugin = moduleIsSvelte(module)
538 ? (await import('rollup-plugin-svelte')).default
539 : null;
540 const uiModule = getUiModule(module);
541
542 let inputFile = `src/${module}/index.ts`;
543 if (!existsSync(inputFile)) {
544 inputFile += 'x';
545 }
546
547 const inputConfig = {
548 external: [
549 'cloudflare:workers',
550 'expo-sqlite',
551 'fs',
552 'fs/promises',
553 'path',
554 'prettier/standalone',
555 'prettier/plugins/estree',
556 'prettier/plugins/typescript',
557 'react',
558 'react-dom',
559 'react/jsx-runtime',
560 'solid-js',
561 'solid-js/web',
562 'solid-js/jsx-runtime',
563 'url',
564 'yjs',
565 ...(module == 'omni'
566 ? []
567 : ['tinybase/store', '../ui-react', '../ui-solid', '../' + uiModule]),
568 ...(moduleIsSvelte(module) ? [/^svelte/] : []),
569 ],
570 input: inputFile,
571 plugins: [
572 esbuild({
573 target: 'esnext',
574 legalComments: 'inline',
575 logOverride: {'unsupported-jsx-comment': 'silent'},
576 tsconfig: moduleIsSolid(module) ? false : undefined,
577 jsx: moduleIsSolid(module) ? 'preserve' : 'automatic',
578 }),
579 moduleIsSolid(module)
580 ? babel({
581 babelHelpers: 'bundled',
582 extensions: ['.tsx'],
583 include: 'src/**/*.tsx',
584 presets: [['solid', {delegateEvents: false}]],
585 })

Callers 4

compileModulesForProdFunction · 0.85
compileForTestFunction · 0.85
compileSvelteModuleFunction · 0.85

Calls 11

moduleIsSvelteFunction · 0.85
getUiModuleFunction · 0.85
moduleIsSolidFunction · 0.85
getUiModuleReplacementsFunction · 0.85
getPrettierConfigFunction · 0.85
ensureDirFunction · 0.85
getGlobalNameFunction · 0.85
copyWithReplaceFunction · 0.85
allOfFunction · 0.85
gzipFileFunction · 0.85
joinFunction · 0.50

Tested by 1

compileSvelteModuleFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…