Fixes #1025

### Platforms Impacted
- [ ] iOS
- [ ] macOS
- [ ] win32 (Office)
- [ ] windows
- [ ] android

### Description of changes

Declare tslib dependency where tslib is used and we have importHelpers in tsconfig.ts in our framework package. Version of tslib is ^1.13.0 as that's the latest release that's supported due to our current typescript version (we need 3.9 or above to bump to 2.0 or later)

Also took the opportunity to use importHelpers in other packages that could use it, specifically for spreadArray so that is saves on bundle size. But if that change isn't desired, I can undo the last two commits and just fix the existing importHeaders

### Verification

Change builds, verifying that the bundle works properly on win32 and windows.

| Before                                       | After                                      |
|----------------------------------------------|--------------------------------------------|
| Screenshot or description before this change | Screenshot or description with this change |

### Pull request checklist

This PR has considered (when applicable):
- [ ] Automated Tests
- [ ] Documentation and examples
- [ ] Keyboard Accessibility
- [ ] Voiceover
- [ ] Internationalization and Right-to-left Layouts
This commit is contained in:
Ruriko Araki 2021-10-25 12:05:52 -07:00 коммит произвёл GitHub
Родитель d4016c370e
Коммит f6578742d6
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
54 изменённых файлов: 182 добавлений и 29 удалений

Просмотреть файл

@ -52,7 +52,8 @@
"@fluentui/react-native": ">=0.26.5 <1.0.0",
"@react-native-community/slider": "^3.0.3",
"@react-native-menu/menu": "^0.1.2",
"@react-native-picker/picker": "^1.16.7"
"@react-native-picker/picker": "^1.16.7",
"tslib": "^1.13.0"
},
"devDependencies": {
"@rnx-kit/cli": "^0.5.27",

Просмотреть файл

@ -2,6 +2,7 @@
"extends": "../../tsconfig.json",
"compilerOptions": {
"baseUrl": ".",
"importHelpers": true,
"outDir": "lib",
"paths": {
"*": ["*", "*.win32", "./*"],

Просмотреть файл

@ -31,7 +31,8 @@
"@fluentui-react-native/tester": "^0.45.1",
"react": "16.13.1",
"react-native": "^0.63.2",
"react-native-svg": "^12.1.1"
"react-native-svg": "^12.1.1",
"tslib": "^1.13.0"
},
"devDependencies": {
"@office-iss/react-native-win32": "^0.63.7",

Просмотреть файл

@ -2,6 +2,7 @@
"extends": "../../tsconfig.json",
"compilerOptions": {
"baseUrl": ".",
"importHelpers": true,
"paths": {
"*": ["*", "*.win32"],
"src/*": ["./src/*"]

Просмотреть файл

@ -21,7 +21,8 @@
"react": "16.13.1",
"react-native": "^0.63.2",
"react-native-svg": "^12.1.1",
"react-native-windows": "^0.64.0"
"react-native-windows": "^0.64.0",
"tslib": "^1.13.0"
},
"devDependencies": {
"@babel/core": "^7.6.2",

Просмотреть файл

@ -2,6 +2,7 @@
"extends": "../../tsconfig.json",
"compilerOptions": {
"baseUrl": ".",
"importHelpers": true,
"paths": {
"*": ["*", "*.win32"],
"src/*": ["./src/*"]

Просмотреть файл

@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Use tslib where spreadArray is used",
"packageName": "@fluentui-react-native/experimental-button",
"email": "ruaraki@microsoft.com",
"dependentChangeType": "patch"
}

Просмотреть файл

@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Use tslib where spreadArray is used",
"packageName": "@fluentui-react-native/experimental-checkbox",
"email": "ruaraki@microsoft.com",
"dependentChangeType": "patch"
}

Просмотреть файл

@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Use tslib where spreadArray is used",
"packageName": "@fluentui-react-native/experimental-tabs",
"email": "ruaraki@microsoft.com",
"dependentChangeType": "patch"
}

Просмотреть файл

@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Use tslib where spreadArray is used",
"packageName": "@fluentui-react-native/experimental-text",
"email": "ruaraki@microsoft.com",
"dependentChangeType": "patch"
}

Просмотреть файл

@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Fix dependency",
"packageName": "@fluentui-react-native/framework",
"email": "ruaraki@microsoft.com",
"dependentChangeType": "patch"
}

Просмотреть файл

@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Use tslib where spreadArray is used",
"packageName": "@fluentui-react-native/immutable-merge",
"email": "ruaraki@microsoft.com",
"dependentChangeType": "patch"
}

Просмотреть файл

@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Use tslib where spreadArray is used",
"packageName": "@fluentui-react-native/interactive-hooks",
"email": "ruaraki@microsoft.com",
"dependentChangeType": "patch"
}

Просмотреть файл

@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Use tslib where spreadArray is used",
"packageName": "@fluentui-react-native/memo-cache",
"email": "ruaraki@microsoft.com",
"dependentChangeType": "patch"
}

Просмотреть файл

@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Use tslib where spreadArray is used",
"packageName": "@fluentui-react-native/merge-props",
"email": "ruaraki@microsoft.com",
"dependentChangeType": "patch"
}

Просмотреть файл

@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Use tslib where spreadArray is used",
"packageName": "@fluentui-react-native/tester",
"email": "ruaraki@microsoft.com",
"dependentChangeType": "patch"
}

Просмотреть файл

@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Use tslib where spreadArray is used",
"packageName": "@fluentui-react-native/tester-win32",
"email": "ruaraki@microsoft.com",
"dependentChangeType": "patch"
}

Просмотреть файл

@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Use tslib where spreadArray is used",
"packageName": "@fluentui-react-native/tokens",
"email": "ruaraki@microsoft.com",
"dependentChangeType": "patch"
}

Просмотреть файл

@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Use tslib where spreadArray is used",
"packageName": "@fluentui-react-native/use-slot",
"email": "ruaraki@microsoft.com",
"dependentChangeType": "patch"
}

Просмотреть файл

@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Use tslib where spreadArray is used",
"packageName": "@fluentui-react-native/use-styling",
"email": "ruaraki@microsoft.com",
"dependentChangeType": "patch"
}

Просмотреть файл

@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Use tslib where spreadArray is used",
"packageName": "@fluentui-react-native/use-tokens",
"email": "ruaraki@microsoft.com",
"dependentChangeType": "patch"
}

Просмотреть файл

@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Use tslib where spreadArray is used",
"packageName": "@fluentui-react-native/win32-theme",
"email": "ruaraki@microsoft.com",
"dependentChangeType": "patch"
}

Просмотреть файл

@ -28,7 +28,8 @@
"@fluentui-react-native/use-styling": ">=0.7.1 <1.0.0",
"@fluentui-react-native/icon": "0.8.27",
"@fluentui-react-native/theme-tokens": ">=0.9.0 <1.0.0",
"@fluentui-react-native/styling-utils": ">=0.2.0 <1.0.0"
"@fluentui-react-native/styling-utils": ">=0.2.0 <1.0.0",
"tslib": "^1.13.0"
},
"devDependencies": {
"@fluentui-react-native/test-tools": ">=0.1.1 <1.0.0",

Просмотреть файл

@ -1,6 +1,7 @@
{
"extends": "@uifabricshared/build-native/tsconfig.json",
"compilerOptions": {
"importHelpers": true,
"outDir": "lib",
"types": ["node", "jest"]
},

Просмотреть файл

@ -27,7 +27,8 @@
"@fluentui-react-native/tokens": ">=0.10.1 <1.0.0",
"@fluentui-react-native/use-styling": ">=0.7.1 <1.0.0",
"@fluentui-react-native/adapters": ">=0.7.5 <1.0.0",
"@fluentui-react-native/pressable": ">=0.7.27 <1.0.0"
"@fluentui-react-native/pressable": ">=0.7.27 <1.0.0",
"tslib": "^1.13.0"
},
"devDependencies": {
"@office-iss/react-native-win32": "^0.63.7",

Просмотреть файл

@ -1,6 +1,7 @@
{
"extends": "@uifabricshared/build-native/tsconfig.json",
"compilerOptions": {
"importHelpers": true,
"outDir": "lib",
"types": ["node", "jest"]
},

Просмотреть файл

@ -32,7 +32,8 @@
"@uifabricshared/build-native": "^0.1.1",
"@uifabricshared/eslint-config-rules": "^0.1.1",
"react": "16.13.1",
"react-native": "^0.63.4"
"react-native": "^0.63.4",
"tslib": "^1.13.0"
},
"peerDependencies": {
"react": ">=16.13.1",

Просмотреть файл

@ -1,6 +1,7 @@
{
"extends": "@uifabricshared/build-native/tsconfig.json",
"compilerOptions": {
"importHelpers": true,
"outDir": "lib",
"types": ["node", "jest"]
},

Просмотреть файл

@ -28,7 +28,8 @@
"@fluentui-react-native/tokens": ">=0.10.1 <1.0.0",
"@fluentui-react-native/use-styling": ">=0.7.1 <1.0.0",
"@fluentui-react-native/icon": "0.8.27",
"@fluentui-react-native/adapters": "0.7.5"
"@fluentui-react-native/adapters": "0.7.5",
"tslib": "^1.13.0"
},
"devDependencies": {
"@fluentui-react-native/test-tools": ">=0.1.1 <1.0.0",

Просмотреть файл

@ -1,6 +1,7 @@
{
"extends": "@uifabricshared/build-native/tsconfig.json",
"compilerOptions": {
"importHelpers": true,
"outDir": "lib",
"types": ["node", "jest"]
},

Просмотреть файл

@ -22,7 +22,8 @@
},
"dependencies": {
"@fluentui-react-native/adapters": ">=0.7.5 <1.0.0",
"@fluentui-react-native/framework": "0.6.3"
"@fluentui-react-native/framework": "0.6.3",
"tslib": "^1.13.0"
},
"devDependencies": {
"@fluentui-react-native/test-tools": ">=0.1.1 <1.0.0",

Просмотреть файл

@ -1,6 +1,7 @@
{
"extends": "@uifabricshared/build-native/tsconfig.json",
"compilerOptions": {
"importHelpers": true,
"outDir": "lib",
"types": ["node", "jest"]
},

Просмотреть файл

@ -35,7 +35,8 @@
"@fluentui-react-native/use-slots": ">=0.5.8 <1.0.0",
"@fluentui-react-native/use-tokens": ">=0.1.6 <1.0.0",
"@fluentui-react-native/memo-cache": "^1.1.4",
"@fluentui-react-native/tokens": ">=0.10.1 <1.0.0"
"@fluentui-react-native/tokens": ">=0.10.1 <1.0.0",
"tslib": "^1.13.0"
},
"devDependencies": {
"@types/react": ">=16.9.34 < 16.14.0",

Просмотреть файл

@ -31,6 +31,9 @@
"keywords": [],
"author": "",
"license": "MIT",
"dependencies": {
"tslib": "^1.13.0"
},
"devDependencies": {
"@types/jest": "^26.0.0",
"@types/node": "^10.3.5",

Просмотреть файл

@ -1,6 +1,7 @@
{
"extends": "@uifabricshared/build-native/tsconfig.json",
"compilerOptions": {
"importHelpers": true,
"outDir": "lib"
},
"include": ["src"]

Просмотреть файл

@ -35,6 +35,7 @@
"@types/jest": "^26.0.0",
"@types/node": "^10.3.5",
"@uifabricshared/build-native": "^0.1.1",
"@uifabricshared/eslint-config-rules": "^0.1.1"
"@uifabricshared/eslint-config-rules": "^0.1.1",
"tslib": "^1.13.0"
}
}

Просмотреть файл

@ -1,6 +1,7 @@
{
"extends": "@uifabricshared/build-native/tsconfig.json",
"compilerOptions": {
"importHelpers": true,
"outDir": "lib"
},
"include": ["src"]

Просмотреть файл

@ -33,7 +33,8 @@
"license": "MIT",
"dependencies": {
"@fluentui-react-native/immutable-merge": "^1.1.3",
"@fluentui-react-native/memo-cache": "^1.1.4"
"@fluentui-react-native/memo-cache": "^1.1.4",
"tslib": "^1.13.0"
},
"devDependencies": {
"@types/jest": "^26.0.0",

Просмотреть файл

@ -1,6 +1,7 @@
{
"extends": "@uifabricshared/build-native/tsconfig.json",
"compilerOptions": {
"importHelpers": true,
"outDir": "lib"
},
"include": ["src"]

Просмотреть файл

@ -32,7 +32,8 @@
"author": "",
"license": "MIT",
"dependencies": {
"@fluentui-react-native/merge-props": ">=0.3.4 <1.0.0"
"@fluentui-react-native/merge-props": ">=0.3.4 <1.0.0",
"tslib": "^1.13.0"
},
"devDependencies": {
"@uifabricshared/build-native": "^0.1.1",

Просмотреть файл

@ -1,6 +1,7 @@
{
"extends": "@uifabricshared/build-native/tsconfig.json",
"compilerOptions": {
"importHelpers": true,
"outDir": "lib",
"types": ["node", "jest"]
},

Просмотреть файл

@ -33,7 +33,8 @@
"license": "MIT",
"dependencies": {
"@fluentui-react-native/memo-cache": "^1.1.4",
"@fluentui-react-native/use-tokens": "^0.1.6"
"@fluentui-react-native/use-tokens": "^0.1.6",
"tslib": "^1.13.0"
},
"devDependencies": {
"@types/jest": "^26.0.0",

Просмотреть файл

@ -1,6 +1,7 @@
{
"extends": "@uifabricshared/build-native/tsconfig.json",
"compilerOptions": {
"importHelpers": true,
"outDir": "lib"
},
"include": ["src"]

Просмотреть файл

@ -33,7 +33,8 @@
"license": "MIT",
"dependencies": {
"@fluentui-react-native/immutable-merge": "^1.1.3",
"@fluentui-react-native/memo-cache": "^1.1.4"
"@fluentui-react-native/memo-cache": "^1.1.4",
"tslib": "^1.13.0"
},
"devDependencies": {
"@fluentui-react-native/merge-props": "^0.3.4",

Просмотреть файл

@ -1,6 +1,7 @@
{
"extends": "@uifabricshared/build-native/tsconfig.json",
"compilerOptions": {
"importHelpers": true,
"outDir": "lib"
},
"include": ["src"]

Просмотреть файл

@ -37,7 +37,8 @@
"@fluentui-react-native/theme-tokens": ">=0.9.0 <1.0.0",
"@fluentui-react-native/theme-types": ">=0.12.3 <1.0.0",
"@fluentui-react-native/theme": ">=0.5.21 <1.0.0",
"@fluentui-react-native/theming-utils": ">=0.7.6 <1.0.0"
"@fluentui-react-native/theming-utils": ">=0.7.6 <1.0.0",
"tslib": "^1.13.0"
},
"devDependencies": {
"@types/react": ">=16.9.34 < 16.14.0",

Просмотреть файл

@ -1,6 +1,7 @@
{
"extends": "@uifabricshared/build-native/tsconfig.json",
"compilerOptions": {
"importHelpers": true,
"outDir": "lib",
"types": ["node", "jest"]
},

Просмотреть файл

@ -21,7 +21,8 @@
"prettier-fix": "fluentui-scripts prettier --fix true"
},
"dependencies": {
"invariant": "^2.2.0"
"invariant": "^2.2.0",
"tslib": "^1.13.0"
},
"devDependencies": {
"@office-iss/react-native-win32": "^0.63.7",

Просмотреть файл

@ -1,6 +1,7 @@
{
"extends": "@uifabricshared/build-native/tsconfig.json",
"compilerOptions": {
"importHelpers": true,
"outDir": "lib"
},
"include": ["src"]

Просмотреть файл

@ -24,7 +24,8 @@
"@fluentui-react-native/adapters": ">=0.7.5 <1.0.0",
"@fluentui-react-native/theme-types": ">=0.12.3 <1.0.0",
"@uifabricshared/foundation-tokens": ">=0.10.2 <1.0.0",
"@uifabricshared/theming-ramp": ">=0.15.9 <1.0.0"
"@uifabricshared/theming-ramp": ">=0.15.9 <1.0.0",
"tslib": "^1.13.0"
},
"devDependencies": {
"@types/react-native": "^0.63.0",

Просмотреть файл

@ -1,6 +1,7 @@
{
"extends": "@uifabricshared/build-native/tsconfig.json",
"compilerOptions": {
"importHelpers": true,
"outDir": "lib"
},
"include": ["src"]

Просмотреть файл

@ -1,6 +1,6 @@
function mergeOneLevel(a, b = {}) {
const result = { ...a, ...b };
Object.keys(a).forEach(key => {
Object.keys(a).forEach((key) => {
if (Array.isArray(b[key]) && Array.isArray(a[key])) {
result[key] = [].concat(a[key], b[key]);
}
@ -14,7 +14,7 @@ function scriptsDevDeps() {
}
function depcheckTask() {
return function(done) {
return function (done) {
const { logger } = require('just-scripts');
const depcheck = require('depcheck');
const path = require('path');
@ -22,31 +22,31 @@ function depcheckTask() {
const options = mergeOneLevel(
{
ignorePatterns: ['*eslint*', '/lib/*', '/lib-commonjs/*'],
ignoreMatches: ['@uifabricshared/build-native', '@uifabricshared/eslint-config-rules', ...scriptsDevDeps()],
specials: [depcheck.special.eslint, depcheck.special.webpack, depcheck.special.jest]
ignoreMatches: ['@uifabricshared/build-native', '@uifabricshared/eslint-config-rules', 'tslib', ...scriptsDevDeps()],
specials: [depcheck.special.eslint, depcheck.special.webpack, depcheck.special.jest],
},
config.depcheck
config.depcheck,
);
return depcheck(process.cwd(), options, result => {
return depcheck(process.cwd(), options, (result) => {
try {
if (result.devDependencies.length > 0) {
logger.warn('Unused devDependencies');
result.devDependencies.forEach(dependency => {
result.devDependencies.forEach((dependency) => {
logger.warn(`-- ${dependency}`);
});
}
if (result.dependencies.length > 0 || Object.keys(result.missing).length > 0) {
if (result.dependencies.length > 0) {
logger.error('Unused dependencies');
result.dependencies.forEach(dependency => {
result.dependencies.forEach((dependency) => {
logger.error(`-- ${dependency}`);
});
}
Object.keys(result.missing).forEach(dependency => {
Object.keys(result.missing).forEach((dependency) => {
logger.error(`Missing dependency on ${dependency}`);
result.missing[dependency].forEach(file => {
result.missing[dependency].forEach((file) => {
logger.error(`-- ${file}`);
});
});

Просмотреть файл

@ -2,6 +2,5 @@
"extends": "@uifabricshared/build-native/tsconfig.json",
"compilerOptions": {
"outDir": "lib"
},
"include": ["src"]
}
}

Просмотреть файл

@ -17188,6 +17188,11 @@ tslib@^1.10.0, tslib@^1.8.1, tslib@^1.9.0, tslib@^1.9.3:
resolved "https://registry.npmjs.org/tslib/-/tslib-1.13.0.tgz#c881e13cc7015894ed914862d276436fa9a47043"
integrity sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q==
tslib@^1.13.0:
version "1.14.1"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"
integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==
tslib@^2.0.0, tslib@^2.0.1:
version "2.3.1"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.3.1.tgz#e8a335add5ceae51aa261d32a490158ef042ef01"