From 428a1cdfc78c9581abeeb6d80579fbd8eb14021e Mon Sep 17 00:00:00 2001 From: Jhonatan Sandoval Velasco <122501764+JhontSouth@users.noreply.github.com> Date: Mon, 13 Jan 2025 09:56:36 -0500 Subject: [PATCH] update d3-format and use it with tsup (#4842) --- .gitignore | 3 +++ libraries/adaptive-expressions/package.json | 10 ++++++---- .../src/builtinFunctions/formatNumber.ts | 2 +- .../src/builtinFunctions/string.ts | 2 +- package.json | 6 ++++-- yarn.lock | 8 ++++---- 6 files changed, 19 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index 693133ba2a..1dc6b5c9c3 100644 --- a/.gitignore +++ b/.gitignore @@ -316,3 +316,6 @@ coverage # typescript assets *.tsbuildinfo *.js.map + +# tsup vendors folders +libraries/**/vendors diff --git a/libraries/adaptive-expressions/package.json b/libraries/adaptive-expressions/package.json index c709d5d30b..a04a096a20 100644 --- a/libraries/adaptive-expressions/package.json +++ b/libraries/adaptive-expressions/package.json @@ -36,7 +36,7 @@ "big-integer": "^1.6.52", "@types/xmldom": "^0.1.34", "btoa-lite": "^1.0.0", - "d3-format": "^2.0.0", + "d3-format": "^3.1.0", "dayjs": "^1.11.13", "jspath": "^0.4.0", "lodash": "^4.17.21", @@ -58,18 +58,20 @@ "build:browser": "npm-run-all build:browser:clean build:browser:run", "build:browser:clean": "rimraf --glob lib/browser.*", "build:browser:run": "tsup --config ../../tsup/browser.config.ts", - "clean": "rimraf lib tsconfig.tsbuildinfo", - "depcheck": "depcheck --config ../../.depcheckrc --ignores sinon,@types/xmldom", + "clean": "rimraf lib vendors tsconfig.tsbuildinfo", + "depcheck": "depcheck --config ../../.depcheckrc --ignores @types/xmldom,d3-format,sinon", "build-docs": "typedoc --theme markdown --entryPoint adaptive-expressions --excludePrivate --includeDeclarations --ignoreCompilerErrors --module amd --out ..\\..\\doc\\adaptive-expressions .\\lib\\index.d.ts --hideGenerator --name \"Bot Builder SDK - Expression\" --readme none", "test": "yarn build && mocha tests --timeout 60000", "test:compat": "api-extractor run --verbose", "lint": "eslint .", + "prebuild": "tsup ./node_modules/d3-format/src/*.js --format cjs --out-dir vendors/d3-format --clean --sourcemap", "antlr-build-expression": "antlr4ts src/parser/ExpressionAntlrLexer.g4 -o src/parser/generated && antlr4ts src/parser/ExpressionAntlrParser.g4 -visitor -o src/parser/generated", "antlr-build-commonregex": "antlr4ts src/CommonRegex.g4 -o src/generated -visitor" }, "files": [ "lib", "src", - "types" + "types", + "vendors" ] } diff --git a/libraries/adaptive-expressions/src/builtinFunctions/formatNumber.ts b/libraries/adaptive-expressions/src/builtinFunctions/formatNumber.ts index e07fe83f0d..179ca2839f 100644 --- a/libraries/adaptive-expressions/src/builtinFunctions/formatNumber.ts +++ b/libraries/adaptive-expressions/src/builtinFunctions/formatNumber.ts @@ -6,7 +6,7 @@ * Licensed under the MIT License. */ -import { formatLocale as d3formatLocale, format as d3format } from 'd3-format'; +import { formatLocale as d3formatLocale, format as d3format } from '../../vendors/d3-format'; import { Expression } from '../expression'; import { EvaluateExpressionDelegate, ExpressionEvaluator } from '../expressionEvaluator'; import { ExpressionType } from '../expressionType'; diff --git a/libraries/adaptive-expressions/src/builtinFunctions/string.ts b/libraries/adaptive-expressions/src/builtinFunctions/string.ts index bc3ddc6757..7d8641b32e 100644 --- a/libraries/adaptive-expressions/src/builtinFunctions/string.ts +++ b/libraries/adaptive-expressions/src/builtinFunctions/string.ts @@ -6,7 +6,7 @@ * Licensed under the MIT License. */ -import { formatLocale as d3formatLocale, format as d3format } from 'd3-format'; +import { formatLocale as d3formatLocale, format as d3format } from '../../vendors/d3-format'; import { EvaluateExpressionDelegate, ExpressionEvaluator, ValueWithError } from '../expressionEvaluator'; import { ExpressionType } from '../expressionType'; import { FunctionUtils } from '../functionUtils'; diff --git a/package.json b/package.json index 990f7822bf..50db8395d9 100644 --- a/package.json +++ b/package.json @@ -15,11 +15,13 @@ ], "nohoist": [ "**/@types/selenium-webdriver", - "botbuilder/filenamify" + "botbuilder/filenamify", + "adaptive-expressions/d3-format" ], "nohoistComments": { "**/@types/selenium-webdriver": "This package is excluded from the root @types folder as it requires ES2015+, whereas some BotBuilder libraries support ES5+.", - "botbuilder/filenamify": "This package is excluded because it's compiled as CJS by tsup as it's ESM-only." + "botbuilder/filenamify": "This package is excluded because it's compiled as CJS by tsup as it's ESM-only.", + "adaptive-expressions/d3-format": "This package is excluded because it's compiled as CJS by tsup as it's ESM-only." } }, "scripts": { diff --git a/yarn.lock b/yarn.lock index a85d6d6480..f893dc5a8b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6920,10 +6920,10 @@ csv@^6.2.2: csv-stringify "^6.5.0" stream-transform "^3.3.2" -d3-format@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/d3-format/-/d3-format-2.0.0.tgz#a10bcc0f986c372b729ba447382413aabf5b0767" - integrity sha512-Ab3S6XuE/Q+flY96HXT0jOXcM4EAClYFnRGY5zsjRGNy6qCYrQsMffs7cV5Q9xejb35zxW5hf/guKw34kvIKsA== +d3-format@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/d3-format/-/d3-format-3.1.0.tgz#9260e23a28ea5cb109e93b21a06e24e2ebd55641" + integrity sha512-YyUI6AEuY/Wpt8KWLgZHsIU86atmikuoOmCfommt0LYHiQSPjvX2AcFc38PX0CBpr2RCyZhjex+NS/LPOv6YqA== dashdash@^1.12.0: version "1.14.1"