Skip to content

Commit 5c784c1

Browse files
committed
Move to globalThis.WEB_CHAT_BUILD_INFO_*
1 parent ce088ba commit 5c784c1

19 files changed

Lines changed: 68 additions & 56 deletions

File tree

packages/api/src/buildInfo.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { createBuildInfo } from '@msinternal/botframework-webchat-base/utils';
22

33
const buildInfo = createBuildInfo('botframework-webchat:api');
44

5-
buildInfo.set('buildTool', WEB_CHAT_BUILD_INFO_BUILD_TOOL);
6-
buildInfo.set('moduleFormat', WEB_CHAT_BUILD_INFO_MODULE_FORMAT);
7-
buildInfo.set('version', WEB_CHAT_BUILD_INFO_VERSION);
5+
buildInfo.set('buildTool', globalThis.WEB_CHAT_BUILD_INFO_BUILD_TOOL);
6+
buildInfo.set('moduleFormat', globalThis.WEB_CHAT_BUILD_INFO_MODULE_FORMAT);
7+
buildInfo.set('version', globalThis.WEB_CHAT_BUILD_INFO_VERSION);
88

99
export default buildInfo;

packages/api/src/env.d.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
// For adding things to `globalThis`, TypeScript need `var`, not `const` or `let`.
2+
/* eslint-disable no-var */
13
declare global {
2-
const WEB_CHAT_BUILD_INFO_BUILD_TOOL: string | undefined;
3-
const WEB_CHAT_BUILD_INFO_MODULE_FORMAT: string | undefined;
4-
const WEB_CHAT_BUILD_INFO_VERSION: string | undefined;
4+
var WEB_CHAT_BUILD_INFO_BUILD_TOOL: string | undefined;
5+
var WEB_CHAT_BUILD_INFO_MODULE_FORMAT: string | undefined;
6+
var WEB_CHAT_BUILD_INFO_VERSION: string | undefined;
57
}
68

79
export {};

packages/api/tsup.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ const commonConfig: typeof baseConfig = {
1818
export default defineConfig([
1919
{
2020
...commonConfig,
21-
define: { ...commonConfig.define, WEB_CHAT_BUILD_INFO_MODULE_FORMAT: '"esmodules"' },
21+
define: { ...commonConfig.define, 'globalThis.WEB_CHAT_BUILD_INFO_MODULE_FORMAT': '"esmodules"' },
2222
format: 'esm',
2323
noExternal: ['globalize']
2424
},
2525
{
2626
...commonConfig,
27-
define: { ...commonConfig.define, WEB_CHAT_BUILD_INFO_MODULE_FORMAT: '"commonjs"' },
27+
define: { ...commonConfig.define, 'globalThis.WEB_CHAT_BUILD_INFO_MODULE_FORMAT': '"commonjs"' },
2828
format: 'cjs',
2929
target: [...commonConfig.target, 'es2019']
3030
}

packages/bundle/src/buildInfo.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { createBuildInfo } from '@msinternal/botframework-webchat-base/utils';
22

33
const buildInfo = createBuildInfo('botframework-webchat');
44

5-
buildInfo.set('buildTool', WEB_CHAT_BUILD_INFO_BUILD_TOOL);
6-
buildInfo.set('moduleFormat', WEB_CHAT_BUILD_INFO_MODULE_FORMAT);
7-
buildInfo.set('version', WEB_CHAT_BUILD_INFO_VERSION);
5+
buildInfo.set('buildTool', globalThis.WEB_CHAT_BUILD_INFO_BUILD_TOOL);
6+
buildInfo.set('moduleFormat', globalThis.WEB_CHAT_BUILD_INFO_MODULE_FORMAT);
7+
buildInfo.set('version', globalThis.WEB_CHAT_BUILD_INFO_VERSION);
88

99
export default buildInfo;

packages/bundle/src/env.d.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
// For adding things to `globalThis`, TypeScript need `var`, not `const` or `let`.
2+
/* eslint-disable no-var */
13
declare global {
2-
const WEB_CHAT_BUILD_INFO_BUILD_TOOL: string | undefined;
3-
const WEB_CHAT_BUILD_INFO_MODULE_FORMAT: string | undefined;
4-
const WEB_CHAT_BUILD_INFO_VERSION: string | undefined;
4+
var WEB_CHAT_BUILD_INFO_BUILD_TOOL: string | undefined;
5+
var WEB_CHAT_BUILD_INFO_MODULE_FORMAT: string | undefined;
6+
var WEB_CHAT_BUILD_INFO_VERSION: string | undefined;
57
}
68

79
export {};

packages/bundle/tsup.config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export default defineConfig([
6363
// Build IIFE before CJS/ESM to make npm start faster.
6464
{
6565
...commonConfig,
66-
define: { ...commonConfig.define, WEB_CHAT_BUILD_INFO_MODULE_FORMAT: '"global"' },
66+
define: { ...commonConfig.define, 'globalThis.WEB_CHAT_BUILD_INFO_MODULE_FORMAT': '"global"' },
6767
dts: false,
6868
entry: {
6969
webchat: './src/boot/bundle/full.ts',
@@ -80,12 +80,12 @@ export default defineConfig([
8080
},
8181
{
8282
...commonConfig,
83-
define: { ...commonConfig.define, WEB_CHAT_BUILD_INFO_MODULE_FORMAT: '"esmodules"' },
83+
define: { ...commonConfig.define, 'globalThis.WEB_CHAT_BUILD_INFO_MODULE_FORMAT': '"esmodules"' },
8484
format: 'esm'
8585
},
8686
{
8787
...commonConfig,
88-
define: { ...commonConfig.define, WEB_CHAT_BUILD_INFO_MODULE_FORMAT: '"commonjs"' },
88+
define: { ...commonConfig.define, 'globalThis.WEB_CHAT_BUILD_INFO_MODULE_FORMAT': '"commonjs"' },
8989
format: 'cjs',
9090
target: [...commonConfig.target, 'es2019']
9191
}

packages/component/src/buildInfo.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { createBuildInfo } from '@msinternal/botframework-webchat-base/utils';
22

33
const buildInfo = createBuildInfo('botframework-webchat:component');
44

5-
buildInfo.set('buildTool', WEB_CHAT_BUILD_INFO_BUILD_TOOL);
6-
buildInfo.set('moduleFormat', WEB_CHAT_BUILD_INFO_MODULE_FORMAT);
7-
buildInfo.set('version', WEB_CHAT_BUILD_INFO_VERSION);
5+
buildInfo.set('buildTool', globalThis.WEB_CHAT_BUILD_INFO_BUILD_TOOL);
6+
buildInfo.set('moduleFormat', globalThis.WEB_CHAT_BUILD_INFO_MODULE_FORMAT);
7+
buildInfo.set('version', globalThis.WEB_CHAT_BUILD_INFO_VERSION);
88

99
export default buildInfo;

packages/component/src/env.d.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
/// <reference types="@msinternal/botframework-webchat-styles/env" />
22

3+
// For adding things to `globalThis`, TypeScript need `var`, not `const` or `let`.
4+
/* eslint-disable no-var */
35
declare global {
4-
const WEB_CHAT_BUILD_INFO_BUILD_TOOL: string | undefined;
5-
const WEB_CHAT_BUILD_INFO_MODULE_FORMAT: string | undefined;
6-
const WEB_CHAT_BUILD_INFO_VERSION: string | undefined;
6+
var WEB_CHAT_BUILD_INFO_BUILD_TOOL: string | undefined;
7+
var WEB_CHAT_BUILD_INFO_MODULE_FORMAT: string | undefined;
8+
var WEB_CHAT_BUILD_INFO_VERSION: string | undefined;
79
}
810

911
export {};

packages/component/tsup.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ const commonConfig: typeof baseConfig = {
2525
export default defineConfig([
2626
{
2727
...commonConfig,
28-
define: { ...commonConfig.define, WEB_CHAT_BUILD_INFO_MODULE_FORMAT: '"esmodules"' },
28+
define: { ...commonConfig.define, 'globalThis.WEB_CHAT_BUILD_INFO_MODULE_FORMAT': '"esmodules"' },
2929
format: 'esm'
3030
},
3131
{
3232
...commonConfig,
33-
define: { ...commonConfig.define, WEB_CHAT_BUILD_INFO_MODULE_FORMAT: '"commonjs"' },
33+
define: { ...commonConfig.define, 'globalThis.WEB_CHAT_BUILD_INFO_MODULE_FORMAT': '"commonjs"' },
3434
format: 'cjs',
3535
target: [...commonConfig.target, 'es2019']
3636
}

packages/core/src/buildInfo.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { createBuildInfo } from '@msinternal/botframework-webchat-base/utils';
22

33
const buildInfo = createBuildInfo('botframework-webchat:core');
44

5-
buildInfo.set('buildTool', WEB_CHAT_BUILD_INFO_BUILD_TOOL);
6-
buildInfo.set('moduleFormat', WEB_CHAT_BUILD_INFO_MODULE_FORMAT);
7-
buildInfo.set('version', WEB_CHAT_BUILD_INFO_VERSION);
5+
buildInfo.set('buildTool', globalThis.WEB_CHAT_BUILD_INFO_BUILD_TOOL);
6+
buildInfo.set('moduleFormat', globalThis.WEB_CHAT_BUILD_INFO_MODULE_FORMAT);
7+
buildInfo.set('version', globalThis.WEB_CHAT_BUILD_INFO_VERSION);
88

99
export default buildInfo;

0 commit comments

Comments
 (0)