Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions packages/debug-theme/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,6 @@
"name": "@msinternal/botframework-webchat-debug-theme",
"version": "0.0.0-0",
"description": "botframework-webchat-debug-theme package",
"main": "./dist/botframework-webchat-debug-theme.js",
"types": "./dist/botframework-webchat-debug-theme.d.ts",
"exports": {
".": {
"import": {
"types": "./dist/botframework-webchat-debug-theme.d.mts",
"default": "./dist/botframework-webchat-debug-theme.mjs"
},
"require": {
"types": "./dist/botframework-webchat-debug-theme.d.ts",
"default": "./dist/botframework-webchat-debug-theme.js"
}
},
"./tsconfig.json": "./src/ts-config/config.json",
"./env": {
"types": "./src/env.d.ts"
}
},
"author": "Microsoft Corporation",
"license": "MIT",
"private": true,
Expand Down
35 changes: 11 additions & 24 deletions packages/debug-theme/tsdown.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { join } from 'node:path';
import { fileURLToPath } from 'node:url';
import { defineConfig, type Rolldown } from 'tsdown';

import { createDualFormatConfigs, iifeOptions, type Config } from '../../tsdown.base.config.mts';
import { applyConfig, iifeOptions, type Config } from '../../tsdown.base.config.mts';

const EXTERNAL_UMD_PATH = join(fileURLToPath(import.meta.url), '../src/external.umd');

Expand All @@ -22,31 +22,18 @@ const umdResolvePlugin: Rolldown.Plugin = {
}
};

const [esmConfig, cjsConfig] = createDualFormatConfigs(
{ 'botframework-webchat-debug-theme': './src/index.ts' },
{
cjs: config => ({ define: { ...config.define, 'globalThis.WEB_CHAT_BUILD_INFO_MODULE_FORMAT': '"commonjs"' } }),
esm: config => ({ define: { ...config.define, 'globalThis.WEB_CHAT_BUILD_INFO_MODULE_FORMAT': '"esmodules"' } })
}
);

// Only the scripts are built: the test pages load them, nothing imports the package.
function createIIFEConfig(name: 'development' | 'production.min'): Config {
return {
...esmConfig,
...iifeOptions(esmConfig),
define: { ...esmConfig.define, 'globalThis.WEB_CHAT_BUILD_INFO_MODULE_FORMAT': '"global"' },
return applyConfig(config => ({
...config,
...iifeOptions(config),
define: { ...config.define, 'globalThis.WEB_CHAT_BUILD_INFO_MODULE_FORMAT': '"global"' },
entry: { [`botframework-webchat-debug-theme.${name}`]: './src/bundle.ts' },
minify: name === 'production.min' || esmConfig.minify,
onSuccess: undefined,
plugins: [...esmConfig.plugins, umdResolvePlugin],
minify: name === 'production.min' || config.minify,
plugins: [...config.plugins, umdResolvePlugin],
// Unlike the bundle, the theme scripts are not lowered to ES2019.
target: esmConfig.target
};
target: config.target
}));
}

export default defineConfig([
esmConfig,
cjsConfig,
createIIFEConfig('development'),
createIIFEConfig('production.min')
]);
export default defineConfig([createIIFEConfig('development'), createIIFEConfig('production.min')]);
Loading