Skip to content

Commit 63284ee

Browse files
authored
[Fat module] fluent-theme should imports from bundle only (#5584)
* fluent-theme should depends on bundle only * Add entry * Transform esm-only packages * Move entry * Workaround unplugin bug * Add validation * Fix validation
1 parent a67544e commit 63284ee

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+984
-4597
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ Notes: web developers are advised to use [`~` (tilde range)](https://github.com/
131131
- The `position` property takes precedence over existing sequence ID
132132
- Unified build info and injection of `<meta>` tag, in PR [#5571](https://github.com/microsoft/BotFramework-WebChat/pull/5571), by [@compulim](https://github.com/compulim)
133133
- Added documentation for `isPartOf` property, in PR [#5573](https://github.com/microsoft/BotFramework-WebChat/pull/5573), by [@compulim](https://github.com/compulim)
134+
- `fluent-theme`: Changed dependencies to import solely from the "bundle" package, in PR [#5584](https://github.com/microsoft/BotFramework-WebChat/pull/5584), by [@compulim](https://github.com/compulim)
134135

135136
### Changed
136137

jest.legacy.config.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,12 @@ const TRANSFORM_IGNORE_PACKAGES = [
3939
'micromark',
4040
'mime',
4141
'unist-util-stringify-position',
42-
'uuid'
42+
'uuid',
43+
44+
// Related to Adaptive Cards.
45+
'dom7',
46+
'ssr-window',
47+
'swiper'
4348
];
4449

4550
module.exports = {

package-lock.json

Lines changed: 845 additions & 4502 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/bundle/internal.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// This is required for Webpack 4 which does not support named exports.
2+
// eslint-disable-next-line no-undef
3+
module.exports = require('./dist/botframework-webchat.internal.js');

packages/bundle/package.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,16 @@
1515
"default": "./dist/botframework-webchat.js"
1616
}
1717
},
18+
"./internal": {
19+
"import": {
20+
"types": "./dist/botframework-webchat.internal.d.mts",
21+
"default": "./dist/botframework-webchat.internal.mjs"
22+
},
23+
"require": {
24+
"types": "./dist/botframework-webchat.internal.d.ts",
25+
"default": "./dist/botframework-webchat.internal.js"
26+
}
27+
},
1828
"./middleware": {
1929
"import": {
2030
"types": "./dist/botframework-webchat.middleware.d.mts",
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// We should review exports in this file to make sure 1P = 3P.
2+
export { type ActivityMiddleware, type TypingIndicatorMiddleware } from 'botframework-webchat-api';
3+
export {
4+
createActivityBorderMiddleware,
5+
createActivityGroupingMiddleware,
6+
DecoratorComposer,
7+
type DecoratorMiddleware
8+
} from 'botframework-webchat-api/decorator';
9+
export { WebChatDecorator } from 'botframework-webchat-component/decorator';
10+
export { createIconComponent, PartGrouping, useLiveRegion } from 'botframework-webchat-component/internal';
11+
export { getOrgSchemaMessage, type DirectLineCardAction, type WebChatActivity } from 'botframework-webchat-core';

packages/bundle/tsup.config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ const commonConfig = applyConfig(config => ({
3333
entry: {
3434
'botframework-webchat': './src/boot/exports/full.ts',
3535
'botframework-webchat.es5': './src/boot/exports/full-es5.ts',
36+
'botframework-webchat.internal': './src/boot/exports/internal.ts',
3637
'botframework-webchat.middleware': './src/boot/exports/middleware.ts',
3738
'botframework-webchat.minimal': './src/boot/exports/minimal.ts'
3839
},
@@ -43,8 +44,7 @@ const commonConfig = applyConfig(config => ({
4344
SPEECH_CONDUCT_OCSP_CHECK: '',
4445
SPEECH_OCSP_CACHE_ROOT: ''
4546
},
46-
// Intentionally overriding existing esbuild plugins.
47-
esbuildPlugins: [resolveCognitiveServicesToES2015],
47+
esbuildPlugins: [...(config.esbuildPlugins ?? []), resolveCognitiveServicesToES2015],
4848
noExternal: [
4949
...(config.noExternal ?? []),
5050
'@babel/runtime',
@@ -75,7 +75,7 @@ export default defineConfig([
7575
'webchat-es5': './src/boot/bundle/full-es5.ts',
7676
'webchat-minimal': './src/boot/bundle/minimal.ts'
7777
},
78-
esbuildPlugins: [...commonConfig.esbuildPlugins, resolveReact],
78+
esbuildPlugins: [...(commonConfig.esbuildPlugins ?? []), resolveReact],
7979
format: 'iife',
8080
outExtension() {
8181
return { js: '.js' };

packages/component/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@
5555
],
5656
"homepage": "https://github.com/microsoft/BotFramework-WebChat/tree/main/packages/component#readme",
5757
"scripts": {
58-
"build": "tsup",
58+
"build": "npm run build:tsup && npm run build:validate",
59+
"build:tsup": "tsup",
60+
"build:validate": "grep -L '.webchat .w' dist/*.css 2>/dev/null || { echo \"Error: dist/*.css is not compiled by Lightning CSS\" >&2; exit 1; }",
5961
"bump": "npm run bump:prod && npm run bump:dev && (npm audit fix || exit 0)",
6062
"bump:dev": "PACKAGES_TO_BUMP=$(cat package.json | jq -r '(.pinDependencies // {}) as $P | (.localDependencies // {} | keys) as $L | (.devDependencies // {}) | to_entries | map(select(.key as $K | $L | contains([$K]) | not)) | map(.key + \"@\" + ($P[.key] // [\"latest\"])[0]) | join(\" \")') && [ ! -z \"$PACKAGES_TO_BUMP\" ] && npm install $PACKAGES_TO_BUMP || true",
6163
"bump:prod": "PACKAGES_TO_BUMP=$(cat package.json | jq -r '(.pinDependencies // {}) as $P | (.localDependencies // {} | keys) as $L | (.dependencies // {}) | to_entries | map(select(.key as $K | $L | contains([$K]) | not)) | map(.key + \"@\" + ($P[.key] // [\"latest\"])[0]) | join(\" \")') && [ ! -z \"$PACKAGES_TO_BUMP\" ] && npm install --save-exact $PACKAGES_TO_BUMP || true",

packages/directlinespeech/tsup.config.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ const config = applyConfig(config => ({
3131
SPEECH_CONDUCT_OCSP_CHECK: '',
3232
SPEECH_OCSP_CACHE_ROOT: ''
3333
},
34-
// Intentionally overriding existing esbuild plugins.
35-
esbuildPlugins: [resolveCognitiveServicesToES2015],
34+
esbuildPlugins: [...(config.esbuildPlugins ?? []), resolveCognitiveServicesToES2015],
3635
// We need to internalize event-target-shim because it appear as transient packages with a different version.
3736
noExternal: [...(config.noExternal ?? []), 'event-target-shim']
3837
}));

packages/fluent-theme/package.json

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@
3838
"src/**/*"
3939
],
4040
"scripts": {
41-
"build": "tsup",
41+
"build": "npm run build:tsup && npm run build:validate",
42+
"build:tsup": "tsup",
43+
"build:validate": "grep -L '.webchat-fluent .w' dist/*.css 2>/dev/null || { echo \"Error: dist/*.css is not compiled by Lightning CSS\" >&2; exit 1; }",
4244
"bump": "npm run bump:prod && npm run bump:dev && (npm audit fix || exit 0)",
4345
"bump:dev": "PACKAGES_TO_BUMP=$(cat package.json | jq -r '(.pinDependencies // {}) as $P | (.localDependencies // {} | keys) as $L | (.devDependencies // {}) | to_entries | map(select(.key as $K | $L | contains([$K]) | not)) | map(.key + \"@\" + ($P[.key] // [\"latest\"])[0]) | join(\" \")') && [ ! -z \"$PACKAGES_TO_BUMP\" ] && npm install $PACKAGES_TO_BUMP || true",
4446
"bump:prod": "PACKAGES_TO_BUMP=$(cat package.json | jq -r '(.pinDependencies // {}) as $P | (.localDependencies // {} | keys) as $L | (.dependencies // {}) | to_entries | map(select(.key as $K | $L | contains([$K]) | not)) | map(.key + \"@\" + ($P[.key] // [\"latest\"])[0]) | join(\" \")') && [ ! -z \"$PACKAGES_TO_BUMP\" ] && npm install --save-exact $PACKAGES_TO_BUMP || true",
@@ -51,12 +53,8 @@
5153
"start": "npm run build -- --watch"
5254
},
5355
"localDependencies": {
54-
"@msinternal/botframework-webchat-base": "development",
55-
"@msinternal/botframework-webchat-styles": "development",
5656
"@msinternal/botframework-webchat-tsconfig": "development",
57-
"botframework-webchat-api": "production",
58-
"botframework-webchat-component": "production",
59-
"botframework-webchat-core": "production"
57+
"botframework-webchat": "production"
6058
},
6159
"pinDependencies": {
6260
"@types/react": [
@@ -69,8 +67,6 @@
6967
]
7068
},
7169
"devDependencies": {
72-
"@msinternal/botframework-webchat-base": "0.0.0-0",
73-
"@msinternal/botframework-webchat-styles": "0.0.0-0",
7470
"@msinternal/botframework-webchat-tsconfig": "^0.0.0-0",
7571
"@types/math-random": "^1.0.2",
7672
"@types/node": "^24.1.0",
@@ -79,9 +75,7 @@
7975
"typescript": "~5.8.3"
8076
},
8177
"dependencies": {
82-
"botframework-webchat-api": "0.0.0-0",
83-
"botframework-webchat-component": "0.0.0-0",
84-
"botframework-webchat-core": "0.0.0-0",
78+
"botframework-webchat": "0.0.0-0",
8579
"classnames": "2.5.1",
8680
"inject-meta-tag": "0.0.1",
8781
"math-random": "2.0.1",

0 commit comments

Comments
 (0)