feat: TypeScript 4.8+ support and NativeClass decorator improvements (#10081)

This commit is contained in:
Nathan Walker
2022-11-08 15:18:10 -08:00
committed by GitHub
parent 59ca35b44b
commit 7f069a7093
24 changed files with 143 additions and 149 deletions

View File

@ -14,7 +14,7 @@
"@nativescript/android": "~8.3.0", "@nativescript/android": "~8.3.0",
"@nativescript/ios": "~8.3.0", "@nativescript/ios": "~8.3.0",
"@nativescript/webpack": "file:../../dist/packages/nativescript-webpack.tgz", "@nativescript/webpack": "file:../../dist/packages/nativescript-webpack.tgz",
"typescript": "4.7.3" "typescript": "4.8.4"
}, },
"gitHead": "c06800e52ee1a184ea2dffd12a6702aaa43be4e3", "gitHead": "c06800e52ee1a184ea2dffd12a6702aaa43be4e3",
"readme": "NativeScript Application" "readme": "NativeScript Application"

View File

@ -1,4 +1,5 @@
{ {
"name": "apps-automated",
"$schema": "../../node_modules/nx/schemas/project-schema.json", "$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/automated/app", "sourceRoot": "apps/automated/app",
"projectType": "application", "projectType": "application",

View File

@ -556,7 +556,7 @@ export function test_setting_font_shorthand_property() {
test_font_shorthand_property('normal normal normal 15px/30px Arial', 'Arial', 15, 'normal', 'normal'); test_font_shorthand_property('normal normal normal 15px/30px Arial', 'Arial', 15, 'normal', 'normal');
} }
function test_font_shorthand_property(short: string, family: string, size: number, style: string, weight: string) { function test_font_shorthand_property(short: string, family: string, size: number, style: string, weight: string | number) {
const testView = new Button(); const testView = new Button();
(<any>testView.style)['font'] = short; (<any>testView.style)['font'] = short;

View File

@ -15,6 +15,6 @@
"@nativescript/android": "~8.3.0", "@nativescript/android": "~8.3.0",
"@nativescript/ios": "~8.3.0", "@nativescript/ios": "~8.3.0",
"@nativescript/webpack": "file:../../dist/packages/nativescript-webpack.tgz", "@nativescript/webpack": "file:../../dist/packages/nativescript-webpack.tgz",
"typescript": "4.7.3" "typescript": "4.8.4"
} }
} }

View File

@ -1,4 +1,5 @@
{ {
"name": "apps-toolbox",
"$schema": "../../node_modules/nx/schemas/project-schema.json", "$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/toolbox/src", "sourceRoot": "apps/toolbox/src",
"projectType": "application", "projectType": "application",

View File

@ -14,7 +14,7 @@
"@nativescript/android": "~8.3.0", "@nativescript/android": "~8.3.0",
"@nativescript/ios": "~8.3.0", "@nativescript/ios": "~8.3.0",
"@nativescript/webpack": "file:../../dist/packages/nativescript-webpack.tgz", "@nativescript/webpack": "file:../../dist/packages/nativescript-webpack.tgz",
"typescript": "4.7.3" "typescript": "4.8.4"
}, },
"gitHead": "8ab7726d1ee9991706069c1359c552e67ee0d1a4", "gitHead": "8ab7726d1ee9991706069c1359c552e67ee0d1a4",
"readme": "NativeScript Application", "readme": "NativeScript Application",

View File

@ -1,4 +1,5 @@
{ {
"name": "apps-ui",
"$schema": "../../node_modules/nx/schemas/project-schema.json", "$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/ui/src", "sourceRoot": "apps/ui/src",
"projectType": "application", "projectType": "application",

22
nx.json
View File

@ -4,13 +4,6 @@
"appsDir": "apps", "appsDir": "apps",
"libsDir": "packages" "libsDir": "packages"
}, },
"implicitDependencies": {
"workspace.json": "*",
"tsconfig.json": "*",
"tslint.json": "*",
"nx.json": "*",
".eslintrc.json": "*"
},
"tasksRunnerOptions": { "tasksRunnerOptions": {
"default": { "default": {
"runner": "nx/tasks-runners/default", "runner": "nx/tasks-runners/default",
@ -82,5 +75,18 @@
"affected": { "affected": {
"defaultBase": "master" "defaultBase": "master"
}, },
"$schema": "./node_modules/nx/schemas/nx-schema.json" "$schema": "./node_modules/nx/schemas/nx-schema.json",
"namedInputs": {
"default": ["{projectRoot}/**/*", "sharedGlobals"],
"sharedGlobals": ["{workspaceRoot}/workspace.json", "{workspaceRoot}/tsconfig.json", "{workspaceRoot}/tslint.json", "{workspaceRoot}/nx.json"],
"production": ["default", "!{projectRoot}/**/?(*.)+(spec|test).[jt]s?(x)?(.snap)", "!{projectRoot}/tsconfig.spec.json", "!{projectRoot}/jest.config.[jt]s"]
},
"targetDefaults": {
"build": {
"inputs": ["production", "^production"]
},
"test": {
"inputs": ["default", "^production", "{workspaceRoot}/jest.preset.js"]
}
}
} }

View File

@ -23,18 +23,18 @@
"devDependencies": { "devDependencies": {
"@nativescript/hook": "^2.0.0", "@nativescript/hook": "^2.0.0",
"@nativescript/nx": "~4.0.0", "@nativescript/nx": "~4.0.0",
"@nrwl/cli": "14.5.4", "@nrwl/cli": "15.0.12",
"@nrwl/eslint-plugin-nx": "14.5.4", "@nrwl/eslint-plugin-nx": "15.0.12",
"@nrwl/jest": "14.5.4", "@nrwl/jest": "15.0.12",
"@nrwl/node": "14.5.4", "@nrwl/node": "15.0.12",
"@nrwl/workspace": "14.5.4", "@nrwl/workspace": "15.0.12",
"@nstudio/focus": "^14.3.0", "@nstudio/focus": "^14.3.0",
"@nstudio/nps-i": "~2.0.0", "@nstudio/nps-i": "~2.0.0",
"@prettier/plugin-xml": "^2.2.0", "@prettier/plugin-xml": "^2.2.0",
"@types/chai": "^4.2.11", "@types/chai": "^4.2.11",
"@types/jest": "27.4.1", "@types/jest": "28.1.8",
"@types/mocha": "^7.0.2", "@types/mocha": "^7.0.2",
"@types/node": "18.0.0", "@types/node": "18.7.1",
"@typescript-eslint/eslint-plugin": "^5.30.0", "@typescript-eslint/eslint-plugin": "^5.30.0",
"@typescript-eslint/parser": "^5.30.0", "@typescript-eslint/parser": "^5.30.0",
"chai": "^4.2.0", "chai": "^4.2.0",
@ -47,7 +47,7 @@
"eslint-config-prettier": "^8.1.0", "eslint-config-prettier": "^8.1.0",
"gonzales": "^1.0.7", "gonzales": "^1.0.7",
"husky": "^8.0.1", "husky": "^8.0.1",
"jest": "27.5.1", "jest": "28.1.3",
"lint-staged": "^13.0.1", "lint-staged": "^13.0.1",
"mocha": "^8.0.1", "mocha": "^8.0.1",
"mocha-typescript": "^1.1.17", "mocha-typescript": "^1.1.17",
@ -61,15 +61,15 @@
"sass": "^1.45.2", "sass": "^1.45.2",
"shady-css-parser": "^0.1.0", "shady-css-parser": "^0.1.0",
"tree-kill": "^1.2.2", "tree-kill": "^1.2.2",
"ts-jest": "27.1.4", "ts-jest": "28.0.8",
"ts-node": "10.8.1", "ts-node": "10.9.1",
"ts-patch": "^2.0.1", "ts-patch": "^2.0.1",
"tslint": "6.1.3", "tslint": "6.1.3",
"tslint-to-eslint-config": "^2.13.0", "tslint-to-eslint-config": "^2.13.0",
"typedoc": "^0.22.17", "typedoc": "^0.22.17",
"typescript": "~4.7.3", "typescript": "4.8.4",
"zx": "^7.0.5", "zx": "^7.0.5",
"nx": "14.5.4" "nx": "15.0.12"
}, },
"lint-staged": { "lint-staged": {
"**/*": [ "**/*": [

View File

@ -1,4 +1,5 @@
{ {
"name": "core",
"$schema": "../../node_modules/nx/schemas/project-schema.json", "$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "packages/core", "sourceRoot": "packages/core",
"projectType": "library", "projectType": "library",
@ -16,11 +17,11 @@
"jestConfig": "packages/core/jest.config.ts", "jestConfig": "packages/core/jest.config.ts",
"passWithNoTests": true "passWithNoTests": true
}, },
"outputs": ["coverage/packages/core"] "outputs": ["{workspaceRoot}/coverage/packages/core"]
}, },
"build": { "build": {
"executor": "@nrwl/workspace:run-commands", "executor": "nx:run-commands",
"outputs": ["dist/packages"], "outputs": ["{workspaceRoot}/dist/packages"],
"options": { "options": {
"commands": [ "commands": [
"npx rimraf dist/packages/core", "npx rimraf dist/packages/core",
@ -34,7 +35,7 @@
} }
}, },
"unit": { "unit": {
"executor": "@nrwl/workspace:run-commands", "executor": "nx:run-commands",
"options": { "options": {
"commands": ["../../../node_modules/.bin/tsc -p tsconfig.json && ../../../node_modules/.bin/mocha --config=.mocharc.yml"], "commands": ["../../../node_modules/.bin/tsc -p tsconfig.json && ../../../node_modules/.bin/mocha --config=.mocharc.yml"],
"cwd": "packages/core/__tests__", "cwd": "packages/core/__tests__",
@ -42,7 +43,7 @@
} }
}, },
"unit.watch": { "unit.watch": {
"executor": "@nrwl/workspace:run-commands", "executor": "nx:run-commands",
"options": { "options": {
"commands": ["../../../node_modules/.bin/tsc -p tsconfig.json && ../../../node_modules/.bin/mocha --watch --config=.mocharc.yml"], "commands": ["../../../node_modules/.bin/tsc -p tsconfig.json && ../../../node_modules/.bin/mocha --watch --config=.mocharc.yml"],
"cwd": "packages/core/__tests__", "cwd": "packages/core/__tests__",

View File

@ -2,37 +2,37 @@
public static default: Font; public static default: Font;
public fontFamily: string; public fontFamily: string;
public fontStyle: FontStyle; public fontStyle: FontStyleType;
public fontWeight: FontWeight; public fontWeight: FontWeightType;
public fontSize: number; public fontSize: number;
public fontScale: number; public fontScale: number;
public isBold: boolean; public isBold: boolean;
public isItalic: boolean; public isItalic: boolean;
constructor(family: string, size: number, style?: FontStyle, weight?: FontWeight, scale?: number); constructor(family: string, size: number, style?: FontStyleType, weight?: FontWeightType, scale?: number);
public getAndroidTypeface(): any /* android.graphics.Typeface */; public getAndroidTypeface(): any /* android.graphics.Typeface */;
public getUIFont(defaultFont: any /* UIFont */): any /* UIFont */; public getUIFont(defaultFont: any /* UIFont */): any /* UIFont */;
public withFontFamily(family: string): Font; public withFontFamily(family: string): Font;
public withFontStyle(style: FontStyle): Font; public withFontStyle(style: FontStyleType): Font;
public withFontWeight(weight: FontWeight): Font; public withFontWeight(weight: FontWeightType): Font;
public withFontSize(size: number): Font; public withFontSize(size: number): Font;
public withFontScale(scale: number): Font; public withFontScale(scale: number): Font;
public static equals(value1: Font, value2: Font): boolean; public static equals(value1: Font, value2: Font): boolean;
} }
export type FontStyle = 'normal' | 'italic'; export type FontStyleType = 'normal' | 'italic';
export namespace FontStyle { export namespace FontStyle {
export const NORMAL: 'normal'; export const NORMAL: 'normal';
export const ITALIC: 'italic'; export const ITALIC: 'italic';
export function isValid(value: any): boolean; export function isValid(value: any): boolean;
export function parse(value: string): FontStyle; export function parse(value: string): FontStyleType;
} }
export type FontWeight = '100' | '200' | '300' | 'normal' | '400' | '500' | '600' | 'bold' | '700' | '800' | '900' | number; export type FontWeightType = '100' | '200' | '300' | 'normal' | '400' | '500' | '600' | 'bold' | '700' | '800' | '900' | number;
export namespace FontWeight { export namespace FontWeight {
export const THIN: '100'; export const THIN: '100';
export const EXTRA_LIGHT: '200'; export const EXTRA_LIGHT: '200';
@ -44,13 +44,13 @@ export namespace FontWeight {
export const EXTRA_BOLD: '800'; export const EXTRA_BOLD: '800';
export const BLACK: '900'; export const BLACK: '900';
export function isValid(value: any): boolean; export function isValid(value: any): boolean;
export function parse(value: string): FontWeight; export function parse(value: string): FontWeightType;
} }
export interface ParsedFont { export interface ParsedFont {
fontStyle?: FontStyle; fontStyle?: FontStyleType;
fontVariant?: string; fontVariant?: string;
fontWeight?: FontWeight; fontWeight?: FontWeightType;
lineHeight?: string; lineHeight?: string;
fontSize?: string; fontSize?: string;
fontFamily?: string; fontFamily?: string;

View File

@ -17,6 +17,7 @@ import { CoreTypes } from '../../core-types';
import { parseBackground } from '../../css/parser'; import { parseBackground } from '../../css/parser';
import { LinearGradient } from './linear-gradient'; import { LinearGradient } from './linear-gradient';
import { CSSShadow, parseCSSShadow } from './css-shadow'; import { CSSShadow, parseCSSShadow } from './css-shadow';
import { FontStyleType, FontWeightType } from './font-common';
function equalsCommon(a: CoreTypes.LengthType, b: CoreTypes.LengthType): boolean; function equalsCommon(a: CoreTypes.LengthType, b: CoreTypes.LengthType): boolean;
function equalsCommon(a: CoreTypes.PercentLengthType, b: CoreTypes.PercentLengthType): boolean; function equalsCommon(a: CoreTypes.PercentLengthType, b: CoreTypes.PercentLengthType): boolean;
@ -1362,7 +1363,7 @@ export const fontSizeProperty = new InheritedCssProperty<Style, number>({
}); });
fontSizeProperty.register(Style); fontSizeProperty.register(Style);
export const fontStyleProperty = new InheritedCssProperty<Style, FontStyle>({ export const fontStyleProperty = new InheritedCssProperty<Style, FontStyleType>({
name: 'fontStyle', name: 'fontStyle',
cssName: 'font-style', cssName: 'font-style',
affectsLayout: global.isIOS, affectsLayout: global.isIOS,
@ -1378,7 +1379,7 @@ export const fontStyleProperty = new InheritedCssProperty<Style, FontStyle>({
}); });
fontStyleProperty.register(Style); fontStyleProperty.register(Style);
export const fontWeightProperty = new InheritedCssProperty<Style, FontWeight>({ export const fontWeightProperty = new InheritedCssProperty<Style, FontWeightType>({
name: 'fontWeight', name: 'fontWeight',
cssName: 'font-weight', cssName: 'font-weight',
affectsLayout: global.isIOS, affectsLayout: global.isIOS,

View File

@ -1,6 +1,6 @@
import { Style as StyleDefinition } from '.'; import { Style as StyleDefinition } from '.';
import { Color } from '../../../color'; import { Color } from '../../../color';
import { Font, FontStyle, FontWeight } from '../font'; import { Font, FontStyleType, FontWeightType } from '../font';
import { Background } from '../background'; import { Background } from '../background';
import { ViewBase } from '../../core/view-base'; import { ViewBase } from '../../core/view-base';
import { LinearGradient } from '../../styling/linear-gradient'; import { LinearGradient } from '../../styling/linear-gradient';
@ -150,8 +150,8 @@ export class Style extends Observable implements StyleDefinition {
public fontSize: number; public fontSize: number;
public fontFamily: string; public fontFamily: string;
public fontStyle: FontStyle; public fontStyle: FontStyleType;
public fontWeight: FontWeight; public fontWeight: FontWeightType;
public font: string; public font: string;
public maxLines: CoreTypes.MaxLinesType; public maxLines: CoreTypes.MaxLinesType;

View File

@ -5,7 +5,7 @@ import { ObservableArray, ChangedData } from '../../data/observable-array';
import { AddArrayFromBuilder, AddChildFromBuilder } from '../core/view'; import { AddArrayFromBuilder, AddChildFromBuilder } from '../core/view';
import { ViewBase } from '../core/view-base'; import { ViewBase } from '../core/view-base';
import { Color } from '../../color'; import { Color } from '../../color';
import { FontStyle, FontWeight } from '../styling/font'; import { FontStyleType, FontWeightType } from '../styling/font';
import { CoreTypes } from '../../core-types'; import { CoreTypes } from '../../core-types';
export class FormattedString extends ViewBase implements FormattedStringDefinition, AddArrayFromBuilder, AddChildFromBuilder { export class FormattedString extends ViewBase implements FormattedStringDefinition, AddArrayFromBuilder, AddChildFromBuilder {
@ -31,17 +31,17 @@ export class FormattedString extends ViewBase implements FormattedStringDefiniti
this.style.fontSize = value; this.style.fontSize = value;
} }
get fontStyle(): FontStyle { get fontStyle(): FontStyleType {
return this.style.fontStyle; return this.style.fontStyle;
} }
set fontStyle(value: FontStyle) { set fontStyle(value: FontStyleType) {
this.style.fontStyle = value; this.style.fontStyle = value;
} }
get fontWeight(): FontWeight { get fontWeight(): FontWeightType {
return this.style.fontWeight; return this.style.fontWeight;
} }
set fontWeight(value: FontWeight) { set fontWeight(value: FontWeightType) {
this.style.fontWeight = value; this.style.fontWeight = value;
} }

View File

@ -1,7 +1,7 @@
import { Color } from '../../color'; import { Color } from '../../color';
import { Span as SpanDefinition } from './span'; import { Span as SpanDefinition } from './span';
import { ViewBase } from '../core/view-base'; import { ViewBase } from '../core/view-base';
import { FontStyle, FontWeight } from '../styling/font'; import { FontStyleType, FontWeightType } from '../styling/font';
import { CoreTypes } from '../../core-types'; import { CoreTypes } from '../../core-types';
import { EventData } from '../../data/observable'; import { EventData } from '../../data/observable';
import { isNullOrUndefined, isString } from '../../utils/types'; import { isNullOrUndefined, isString } from '../../utils/types';
@ -26,18 +26,18 @@ export class Span extends ViewBase implements SpanDefinition {
} }
// Italic // Italic
get fontStyle(): FontStyle { get fontStyle(): FontStyleType {
return this.style.fontStyle; return this.style.fontStyle;
} }
set fontStyle(value: FontStyle) { set fontStyle(value: FontStyleType) {
this.style.fontStyle = value; this.style.fontStyle = value;
} }
// Bold // Bold
get fontWeight(): FontWeight { get fontWeight(): FontWeightType {
return this.style.fontWeight; return this.style.fontWeight;
} }
set fontWeight(value: FontWeight) { set fontWeight(value: FontWeightType) {
this.style.fontWeight = value; this.style.fontWeight = value;
} }

View File

@ -1,23 +1,18 @@
{ {
"$schema": "../../node_modules/nx/schemas/project-schema.json", "name": "types-android",
"sourceRoot": "packages/types-android/src", "$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "library", "sourceRoot": "packages/types-android/src",
"generators": {}, "projectType": "library",
"targets": { "generators": {},
"build": { "targets": {
"executor": "@nrwl/workspace:run-commands", "build": {
"outputs": [ "executor": "nx:run-commands",
"dist/packages" "outputs": ["{workspaceRoot}/dist/packages"],
], "options": {
"options": { "commands": ["mkdir -p ../../dist/packages/types-android", "cp -R src/* ../../dist/packages/types-android", "cp package.json *.md ../../dist/packages/types-android"],
"commands": [ "cwd": "packages/types-android",
"mkdir -p ../../dist/packages/types-android", "parallel": false
"cp -R src/* ../../dist/packages/types-android", }
"cp package.json *.md ../../dist/packages/types-android" }
], }
"cwd": "packages/types-android",
"parallel": false
}
}
}
} }

View File

@ -1,24 +1,17 @@
{ {
"$schema": "../../node_modules/nx/schemas/project-schema.json", "name": "types-ios",
"sourceRoot": "packages/types-ios/src", "$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "library", "sourceRoot": "packages/types-ios/src",
"generators": {}, "projectType": "library",
"targets": { "generators": {},
"build": { "targets": {
"executor": "@nrwl/workspace:run-commands", "build": {
"outputs": [ "executor": "nx:run-commands",
"dist/packages" "outputs": ["{workspaceRoot}/dist/packages"],
], "options": {
"options": { "commands": ["./tools/scripts/typings-gen.sh latest", "mkdir -p dist/packages/types-ios", "cp -R packages/types-ios/src/* dist/packages/types-ios", "cp packages/types-ios/package.json dist/packages/types-ios", "cp packages/types-ios/README.md dist/packages/types-ios/README.md"],
"commands": [ "parallel": false
"./tools/scripts/typings-gen.sh latest", }
"mkdir -p dist/packages/types-ios", }
"cp -R packages/types-ios/src/* dist/packages/types-ios", }
"cp packages/types-ios/package.json dist/packages/types-ios",
"cp packages/types-ios/README.md dist/packages/types-ios/README.md"
],
"parallel": false
}
}
}
} }

View File

@ -1,24 +1,17 @@
{ {
"$schema": "../../node_modules/nx/schemas/project-schema.json", "name": "types-minimal",
"sourceRoot": "packages/types-minimal/src", "$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "library", "sourceRoot": "packages/types-minimal/src",
"generators": {}, "projectType": "library",
"targets": { "generators": {},
"build": { "targets": {
"executor": "@nrwl/workspace:run-commands", "build": {
"outputs": [ "executor": "nx:run-commands",
"dist/packages" "outputs": ["{workspaceRoot}/dist/packages"],
], "options": {
"options": { "commands": ["./tools/scripts/typings-minimal-copy.sh", "mkdir -p dist/packages/types-minimal", "cp -R packages/types-minimal/src/* dist/packages/types-minimal", "cp packages/types-minimal/package.json dist/packages/types-minimal", "cp packages/types-minimal/README.md dist/packages/types-minimal/README.md"],
"commands": [ "parallel": false
"./tools/scripts/typings-minimal-copy.sh", }
"mkdir -p dist/packages/types-minimal", }
"cp -R packages/types-minimal/src/* dist/packages/types-minimal", }
"cp packages/types-minimal/package.json dist/packages/types-minimal",
"cp packages/types-minimal/README.md dist/packages/types-minimal/README.md"
],
"parallel": false
}
}
}
} }

View File

@ -1,12 +1,13 @@
{ {
"name": "types",
"$schema": "../../node_modules/nx/schemas/project-schema.json", "$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "packages/types", "sourceRoot": "packages/types",
"projectType": "library", "projectType": "library",
"generators": {}, "generators": {},
"targets": { "targets": {
"build": { "build": {
"executor": "@nrwl/workspace:run-commands", "executor": "nx:run-commands",
"outputs": ["dist/packages"], "outputs": ["{workspaceRoot}/dist/packages"],
"options": { "options": {
"commands": ["mkdir -p ../../dist/packages/types", "cp -R * ../../dist/packages/types"], "commands": ["mkdir -p ../../dist/packages/types", "cp -R * ../../dist/packages/types"],
"cwd": "packages/types", "cwd": "packages/types",

View File

@ -1,19 +1,17 @@
{ {
"$schema": "../../node_modules/nx/schemas/project-schema.json", "name": "ui-mobile-base",
"sourceRoot": "packages/ui-mobile-base", "$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "library", "sourceRoot": "packages/ui-mobile-base",
"generators": {}, "projectType": "library",
"targets": { "generators": {},
"build": { "targets": {
"executor": "@nrwl/workspace:run-commands", "build": {
"options": { "executor": "nx:run-commands",
"commands": [ "options": {
"./build.sh", "commands": ["./build.sh", "cp -R dist/package/platforms/* ../../packages/core/platforms"],
"cp -R dist/package/platforms/* ../../packages/core/platforms" "cwd": "packages/ui-mobile-base",
], "parallel": false
"cwd": "packages/ui-mobile-base", }
"parallel": false }
} }
}
}
} }

View File

@ -67,7 +67,7 @@
"jest-matcher-utils": "29.1.2", "jest-matcher-utils": "29.1.2",
"nativescript-vue-template-compiler": "2.9.3", "nativescript-vue-template-compiler": "2.9.3",
"ts-jest": "29.0.3", "ts-jest": "29.0.3",
"typescript": "4.7.4" "typescript": "4.8.4"
}, },
"peerDependencies": { "peerDependencies": {
"nativescript-vue-template-compiler": "^2.8.1" "nativescript-vue-template-compiler": "^2.8.1"

View File

@ -1,4 +1,5 @@
{ {
"name": "webpack5",
"$schema": "../../node_modules/nx/schemas/project-schema.json", "$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "packages/webpack5", "sourceRoot": "packages/webpack5",
"projectType": "library", "projectType": "library",
@ -11,8 +12,8 @@
} }
}, },
"build": { "build": {
"executor": "@nrwl/workspace:run-commands", "executor": "nx:run-commands",
"outputs": ["dist/packages"], "outputs": ["{workspaceRoot}/dist/packages"],
"options": { "options": {
"command": "npx zx ./tools/scripts/pack-webpack5.mjs" "command": "npx zx ./tools/scripts/pack-webpack5.mjs"
} }

View File

@ -8,8 +8,9 @@ import ts from 'typescript';
export default function (ctx: ts.TransformationContext) { export default function (ctx: ts.TransformationContext) {
function isNativeClassExtension(node: ts.ClassDeclaration) { function isNativeClassExtension(node: ts.ClassDeclaration) {
return ( return (
node.decorators && ts.canHaveDecorators(node) &&
node.decorators.filter((d) => { ts.getDecorators(node) &&
ts.getDecorators(node).filter((d) => {
const fullText = d.getFullText().trim(); const fullText = d.getFullText().trim();
return fullText.indexOf('@NativeClass') > -1; return fullText.indexOf('@NativeClass') > -1;
}).length > 0 }).length > 0
@ -24,14 +25,14 @@ export default function (ctx: ts.TransformationContext) {
function createHelper(node: ts.Node) { function createHelper(node: ts.Node) {
// we remove the decorator for now! // we remove the decorator for now!
return ts.createIdentifier( return ts.factory.createIdentifier(
ts ts
.transpileModule( .transpileModule(
node.getText().replace(/@NativeClass(\((.|\n)*?\))?/gm, ''), node.getText().replace(/@NativeClass(\((.|\n)*?\))?/gm, ''),
{ {
compilerOptions: { compilerOptions: {
noEmitHelpers: true, noEmitHelpers: true,
module: ts.ModuleKind.CommonJS, module: ts.ModuleKind.ESNext,
target: ts.ScriptTarget.ES5, target: ts.ScriptTarget.ES5,
}, },
} }
@ -44,7 +45,7 @@ export default function (ctx: ts.TransformationContext) {
} }
return (source: ts.SourceFile) => return (source: ts.SourceFile) =>
ts.updateSourceFileNode( ts.factory.updateSourceFile(
source, source,
ts.visitNodes(source.statements, visitNode) ts.visitNodes(source.statements, visitNode)
); );

View File

@ -1,12 +1,13 @@
{ {
"name": "core-api-docs",
"$schema": "../../node_modules/nx/schemas/project-schema.json", "$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "tools/scripts", "sourceRoot": "tools/scripts",
"projectType": "library", "projectType": "library",
"generators": {}, "generators": {},
"targets": { "targets": {
"build": { "build": {
"executor": "@nrwl/workspace:run-commands", "executor": "nx:run-commands",
"outputs": ["tools/scripts/dist"], "outputs": ["{projectRoot}/dist"],
"options": { "options": {
"commands": ["./build-docs.sh"], "commands": ["./build-docs.sh"],
"cwd": "tools/scripts", "cwd": "tools/scripts",