From 3bdf5d4ad8cc04cf8534ea4d3e185687e6d849b9 Mon Sep 17 00:00:00 2001 From: Alexander Gorshenev Date: Fri, 31 Jan 2025 12:38:02 +0300 Subject: [PATCH 1/8] Use ets-tsc instead of memo-tsc Signed-off-by: Alexander Gorshenev --- incremental/common/package.json | 2 +- incremental/compat/package.json | 4 ++-- incremental/compiler-plugin/oh-package.json5 | 4 ++-- incremental/compiler-plugin/package.json | 4 ++-- incremental/compiler-plugin/src/AbstractVisitor.ts | 2 +- incremental/compiler-plugin/src/MemoArgumentDetector.ts | 2 +- incremental/compiler-plugin/src/ScopedVisitor.ts | 2 +- incremental/compiler-plugin/src/analysis-visitor.ts | 2 +- incremental/compiler-plugin/src/diagnostics-visitor.ts | 2 +- incremental/compiler-plugin/src/dump-visitor.ts | 2 +- incremental/compiler-plugin/src/function-transformer.ts | 2 +- incremental/compiler-plugin/src/import-export.ts | 2 +- incremental/compiler-plugin/src/koala-transformer.ts | 2 +- incremental/compiler-plugin/src/parameter-transformer.ts | 2 +- incremental/compiler-plugin/src/return-transformer.ts | 2 +- incremental/compiler-plugin/src/this-transformer.ts | 2 +- incremental/compiler-plugin/src/transformation-context.ts | 2 +- incremental/compiler-plugin/src/util.ts | 2 +- .../compiler-plugin/src/variable-type-transformer.ts | 2 +- incremental/demo-playground/package.json | 4 ++-- incremental/package.json | 2 +- incremental/runtime/package.json | 8 ++++---- incremental/tools/panda/arkts/std-lib/global.d.ts | 2 +- 23 files changed, 30 insertions(+), 30 deletions(-) diff --git a/incremental/common/package.json b/incremental/common/package.json index 4e1f4b778..18b56192a 100644 --- a/incremental/common/package.json +++ b/incremental/common/package.json @@ -31,7 +31,7 @@ } }, "scripts": { - "compile": "memo-tsc -b .", + "compile": "ets-tsc -b .", "clean": "rimraf build", "test": "mocha", "test:coverage": "nyc mocha", diff --git a/incremental/compat/package.json b/incremental/compat/package.json index cbadced82..cfc8e2672 100644 --- a/incremental/compat/package.json +++ b/incremental/compat/package.json @@ -22,8 +22,8 @@ }, "scripts": { "clean": "rimraf build dist", - "compile": "memo-tsc -b .", - "compile:ohos": "memo-tsc -b ./tsconfig-ohos.json", + "compile": "ets-tsc -b .", + "compile:ohos": "ets-tsc -b ./tsconfig-ohos.json", "compile:all": "npm run compile && npm run compile:ohos", "build:compat": "npm run build:compat:inc", "build:compat:inc": "fast-arktsc --input-files ./arktsconfig.json --output-dir ./build --compiler ../tools/panda/arkts/arktsc --link-name compat && ninja ${NINJA_OPTIONS} -f build/build.ninja", diff --git a/incremental/compiler-plugin/oh-package.json5 b/incremental/compiler-plugin/oh-package.json5 index 40e5742a6..eaac79d1b 100644 --- a/incremental/compiler-plugin/oh-package.json5 +++ b/incremental/compiler-plugin/oh-package.json5 @@ -24,9 +24,9 @@ "source-map-support": "^0.5.21" }, "scripts": { - "compile": "memo-tsc -b .", + "compile": "ets-tsc -b .", "clean": "rimraf build dist test/dump", - "unmemoize:tests": "cd test && memo-tsc -p tsconfig-unmemoize.json && rimraf build", + "unmemoize:tests": "cd test && ets-tsc -p tsconfig-unmemoize.json && rimraf build", "test": "npm run unmemoize:tests && npm run compile && mocha", "test:coverage": "nyc mocha" } diff --git a/incremental/compiler-plugin/package.json b/incremental/compiler-plugin/package.json index 146106309..7b3cf9d75 100644 --- a/incremental/compiler-plugin/package.json +++ b/incremental/compiler-plugin/package.json @@ -24,9 +24,9 @@ "source-map-support": "^0.5.21" }, "scripts": { - "compile": "memo-tsc -b .", + "compile": "ets-tsc -b .", "clean": "rimraf build dist test/dump", - "unmemoize:tests": "npm run compile && cd test && memo-tsc -p tsconfig-unmemoize.json && rimraf build", + "unmemoize:tests": "npm run compile && cd test && ets-tsc -p tsconfig-unmemoize.json && rimraf build", "test": "npm run unmemoize:tests && mocha", "test:coverage": "nyc mocha", "canonize": "npm run unmemoize:tests && cp -r ./test/unmemoized/examples ./test/golden/" diff --git a/incremental/compiler-plugin/src/AbstractVisitor.ts b/incremental/compiler-plugin/src/AbstractVisitor.ts index b0e7e279d..d17edb6be 100644 --- a/incremental/compiler-plugin/src/AbstractVisitor.ts +++ b/incremental/compiler-plugin/src/AbstractVisitor.ts @@ -13,7 +13,7 @@ * limitations under the License. */ -import * as ts from 'typescript'; +import * as ts from '@koalaui/ets-tsc'; export abstract class AbstractVisitor { constructor( diff --git a/incremental/compiler-plugin/src/MemoArgumentDetector.ts b/incremental/compiler-plugin/src/MemoArgumentDetector.ts index 8f35a3021..fc963e49a 100644 --- a/incremental/compiler-plugin/src/MemoArgumentDetector.ts +++ b/incremental/compiler-plugin/src/MemoArgumentDetector.ts @@ -13,7 +13,7 @@ * limitations under the License. */ -import * as ts from 'typescript' +import * as ts from '@koalaui/ets-tsc' import { Rewrite } from './transformation-context'; import { AbstractVisitor } from './AbstractVisitor' import { FunctionKind, isAnyMemoKind } from './util'; diff --git a/incremental/compiler-plugin/src/ScopedVisitor.ts b/incremental/compiler-plugin/src/ScopedVisitor.ts index 5df96aff6..50d90e5a5 100644 --- a/incremental/compiler-plugin/src/ScopedVisitor.ts +++ b/incremental/compiler-plugin/src/ScopedVisitor.ts @@ -13,7 +13,7 @@ * limitations under the License. */ -import * as ts from 'typescript'; +import * as ts from '@koalaui/ets-tsc'; import { AbstractVisitor } from "./AbstractVisitor" import { FunctionKind, isAnyMemoKind, isMemoKind } from "./util" diff --git a/incremental/compiler-plugin/src/analysis-visitor.ts b/incremental/compiler-plugin/src/analysis-visitor.ts index bc2b72324..1c2a18898 100644 --- a/incremental/compiler-plugin/src/analysis-visitor.ts +++ b/incremental/compiler-plugin/src/analysis-visitor.ts @@ -13,7 +13,7 @@ * limitations under the License. */ -import * as ts from 'typescript'; +import * as ts from '@koalaui/ets-tsc'; import { AbstractVisitor } from "./AbstractVisitor" import { Rewrite } from './transformation-context'; import { diff --git a/incremental/compiler-plugin/src/diagnostics-visitor.ts b/incremental/compiler-plugin/src/diagnostics-visitor.ts index 10d1f943c..314ffeb0a 100644 --- a/incremental/compiler-plugin/src/diagnostics-visitor.ts +++ b/incremental/compiler-plugin/src/diagnostics-visitor.ts @@ -13,7 +13,7 @@ * limitations under the License. */ -import * as ts from 'typescript'; +import * as ts from '@koalaui/ets-tsc'; import { MemoArgumentDetector } from './MemoArgumentDetector'; import { ScopedVisitor } from './ScopedVisitor'; import { Rewrite } from './transformation-context'; diff --git a/incremental/compiler-plugin/src/dump-visitor.ts b/incremental/compiler-plugin/src/dump-visitor.ts index 4aafe2278..5ef2fac63 100644 --- a/incremental/compiler-plugin/src/dump-visitor.ts +++ b/incremental/compiler-plugin/src/dump-visitor.ts @@ -13,7 +13,7 @@ * limitations under the License. */ -import * as ts from "typescript" +import * as ts from '@koalaui/ets-tsc' import { AbstractVisitor } from "./AbstractVisitor"; import { FunctionKind, FunctionTable, isAnyMemoKind, isFunctionOrMethod, Tracer } from "./util"; diff --git a/incremental/compiler-plugin/src/function-transformer.ts b/incremental/compiler-plugin/src/function-transformer.ts index 780bed617..7f37a8b6a 100644 --- a/incremental/compiler-plugin/src/function-transformer.ts +++ b/incremental/compiler-plugin/src/function-transformer.ts @@ -13,7 +13,7 @@ * limitations under the License. */ -import * as ts from 'typescript'; +import * as ts from '@koalaui/ets-tsc'; import { AbstractVisitor } from "./AbstractVisitor" import { Rewrite } from './transformation-context'; import { diff --git a/incremental/compiler-plugin/src/import-export.ts b/incremental/compiler-plugin/src/import-export.ts index 6ead61791..92b619d08 100644 --- a/incremental/compiler-plugin/src/import-export.ts +++ b/incremental/compiler-plugin/src/import-export.ts @@ -13,7 +13,7 @@ * limitations under the License. */ -import * as ts from 'typescript'; +import * as ts from '@koalaui/ets-tsc'; import { arrayAt, error, diff --git a/incremental/compiler-plugin/src/koala-transformer.ts b/incremental/compiler-plugin/src/koala-transformer.ts index 38a12939f..035fd7dad 100644 --- a/incremental/compiler-plugin/src/koala-transformer.ts +++ b/incremental/compiler-plugin/src/koala-transformer.ts @@ -13,7 +13,7 @@ * limitations under the License. */ -import * as ts from 'typescript'; +import * as ts from '@koalaui/ets-tsc'; import * as path from "path" import { AnalysisVisitor } from './analysis-visitor'; import { DiagnosticsVisitor } from './diagnostics-visitor'; diff --git a/incremental/compiler-plugin/src/parameter-transformer.ts b/incremental/compiler-plugin/src/parameter-transformer.ts index 6bc8bf28c..3cd1651e4 100644 --- a/incremental/compiler-plugin/src/parameter-transformer.ts +++ b/incremental/compiler-plugin/src/parameter-transformer.ts @@ -13,7 +13,7 @@ * limitations under the License. */ -import * as ts from 'typescript'; +import * as ts from '@koalaui/ets-tsc'; import { ScopedVisitor } from './ScopedVisitor'; import { FunctionKind, diff --git a/incremental/compiler-plugin/src/return-transformer.ts b/incremental/compiler-plugin/src/return-transformer.ts index 9a3e9c630..74df10cd3 100644 --- a/incremental/compiler-plugin/src/return-transformer.ts +++ b/incremental/compiler-plugin/src/return-transformer.ts @@ -13,7 +13,7 @@ * limitations under the License. */ -import * as ts from 'typescript'; +import * as ts from '@koalaui/ets-tsc'; import { ScopedVisitor } from "./ScopedVisitor" import { FunctionKind, isFunctionOrMethod, isMemoKind, isThis, isThisStable, isVoidOrNotSpecified, runtimeIdentifier, RuntimeNames } from './util' diff --git a/incremental/compiler-plugin/src/this-transformer.ts b/incremental/compiler-plugin/src/this-transformer.ts index b2d7f9263..d7f6c348f 100644 --- a/incremental/compiler-plugin/src/this-transformer.ts +++ b/incremental/compiler-plugin/src/this-transformer.ts @@ -13,7 +13,7 @@ * limitations under the License. */ -import * as ts from 'typescript'; +import * as ts from '@koalaui/ets-tsc'; import { ScopedVisitor } from './ScopedVisitor'; import { FunctionKind, diff --git a/incremental/compiler-plugin/src/transformation-context.ts b/incremental/compiler-plugin/src/transformation-context.ts index 73c7ae48b..78909e1fb 100644 --- a/incremental/compiler-plugin/src/transformation-context.ts +++ b/incremental/compiler-plugin/src/transformation-context.ts @@ -13,7 +13,7 @@ * limitations under the License. */ -import * as ts from "typescript" +import * as ts from '@koalaui/ets-tsc' import { CallTable, EntryTable, FunctionKind, FunctionTable, PositionalIdTracker, TransformerOptions, VariableTable } from "./util" export class Rewrite { diff --git a/incremental/compiler-plugin/src/util.ts b/incremental/compiler-plugin/src/util.ts index 7f8fe0fd1..de42c978d 100644 --- a/incremental/compiler-plugin/src/util.ts +++ b/incremental/compiler-plugin/src/util.ts @@ -13,7 +13,7 @@ * limitations under the License. */ -import * as ts from 'typescript'; +import * as ts from '@koalaui/ets-tsc'; import * as fs from "fs" import { UniqueId } from "@koalaui/common" import { Rewrite } from './transformation-context'; diff --git a/incremental/compiler-plugin/src/variable-type-transformer.ts b/incremental/compiler-plugin/src/variable-type-transformer.ts index 64e836954..a8cb74eb5 100644 --- a/incremental/compiler-plugin/src/variable-type-transformer.ts +++ b/incremental/compiler-plugin/src/variable-type-transformer.ts @@ -13,7 +13,7 @@ * limitations under the License. */ -import * as ts from "typescript" +import * as ts from '@koalaui/ets-tsc' import { AbstractVisitor } from "./AbstractVisitor"; import { Rewrite } from "./transformation-context"; import { createContextTypeImport, FunctionKind, hiddenParameters, skipParenthesizedType, Tracer } from "./util"; diff --git a/incremental/demo-playground/package.json b/incremental/demo-playground/package.json index 6b06290c1..2a01209b2 100644 --- a/incremental/demo-playground/package.json +++ b/incremental/demo-playground/package.json @@ -16,11 +16,11 @@ }, "scripts": { "compile": "WEBPACK_NO_MINIMIZE=true webpack --config webpack.config.node.js", - "compile:unmemoize": "memo-tsc -b tsconfig-unmemoize.json", + "compile:unmemoize": "ets-tsc -b tsconfig-unmemoize.json", "compile:run-unmemoized": "npm run compile -- --env tsconfig=tsconfig-run-unmemoized.json --env unmemoized=unmemoized", "compile:unmemoizing": "npm run compile:unmemoize && npm run compile:run-unmemoized", "compile:arkts": "bash ../tools/panda/arkts/arktsc --arktsconfig arktsconfig.json", - "compile:arkts:unmemoize": "memo-tsc -b tsconfig-unmemoize.json", + "compile:arkts:unmemoize": "ets-tsc -b tsconfig-unmemoize.json", "compile:arkts:unmemoized": "bash ../tools/panda/arkts/arktsc --arktsconfig arktsconfig-run-unmemoized.json build/unmemoized/src/main.ts --output build/unmemoized/src/main.abc", "compile:arkts:unmemoizing": "npm run compile:unmemoize && npm run compile:arkts:unmemoized", "panda:sdk:install": "cd ../tools/panda && npm run panda:sdk:install", diff --git a/incremental/package.json b/incremental/package.json index f698a4de5..aa7ae3006 100644 --- a/incremental/package.json +++ b/incremental/package.json @@ -25,7 +25,7 @@ }, "dependencies": { "@koalaui/fast-arktsc": "next", - "@koalaui/memo-tsc": "4.9.5", + "@koalaui/ets-tsc": "4.9.5-r4", "circular-dependency-plugin": "^5.2.2", "copy-webpack-plugin": "^12.0.2", "source-map-loader": "^5.0.0", diff --git a/incremental/runtime/package.json b/incremental/runtime/package.json index 546f115e7..73cdc7e89 100644 --- a/incremental/runtime/package.json +++ b/incremental/runtime/package.json @@ -10,9 +10,9 @@ "oh-package.json5" ], "scripts": { - "compile": "memo-tsc -p .", - "compile:unmemoize": "memo-tsc -p tsconfig-unmemoize.json", - "compile:test": "memo-tsc -b tsconfig-test.json", + "compile": "ets-tsc -p .", + "compile:unmemoize": "ets-tsc -p tsconfig-unmemoize.json", + "compile:test": "ets-tsc -b tsconfig-test.json", "clean": "rimraf build", "test": "mocha", "test:coverage": "nyc mocha", @@ -22,7 +22,7 @@ "arkts:run:test:harness": "find build/test/app -name test.abc -exec bash ../tools/panda/arkts/ark --ark-boot-files $(find ../compat/build/abc ../common/build/abc ./build/test/lib -name '*.abc' | paste -sd ':' -) {} \\;", "arkts:compile:test": "npm run compile:arkts && npm run arkts:compile:test:lib && npm run arkts:compile:test:app", "arkts:run:test": "npm run clean && npm run panda:sdk:install && npm run arkts:compile:test && npm run arkts:run:test:harness", - "unmemoize": "memo-tsc -b arktsconfig-unmemoize.json", + "unmemoize": "ets-tsc -b arktsconfig-unmemoize.json", "compile:arkts": "npm run unmemoize && ../tools/panda/arkts/arktsc --arktsconfig arktsconfig-run-unmemoized.json --ets-module", "build:compat": "npm run build:compat --prefix ../compat", "build:compat:inc": "npm run build:compat:inc --prefix ../compat", diff --git a/incremental/tools/panda/arkts/std-lib/global.d.ts b/incremental/tools/panda/arkts/std-lib/global.d.ts index d19270e33..d455eef06 100644 --- a/incremental/tools/panda/arkts/std-lib/global.d.ts +++ b/incremental/tools/panda/arkts/std-lib/global.d.ts @@ -3,7 +3,7 @@ declare type int8 = number declare type float32 = number // This is to allow symbols of arkts stdlib -// to be visible during memo-tsc preprocessing +// to be visible during ets-tsc preprocessing declare class StringBuilder { constructor(value: string) -- Gitee From ef3f67feaeaa723962e346405fabed423777fbb7 Mon Sep 17 00:00:00 2001 From: Alexander Gorshenev Date: Fri, 31 Jan 2025 13:37:18 +0300 Subject: [PATCH 2/8] more Signed-off-by: Alexander Gorshenev --- incremental/demo-playground/webpack.config.node.js | 1 + incremental/test-utils/scripts/register.js | 1 + 2 files changed, 2 insertions(+) diff --git a/incremental/demo-playground/webpack.config.node.js b/incremental/demo-playground/webpack.config.node.js index fabae4291..e88918692 100644 --- a/incremental/demo-playground/webpack.config.node.js +++ b/incremental/demo-playground/webpack.config.node.js @@ -43,6 +43,7 @@ const makeConfig = ({ os, arch, tsconfig, unmemoized }) => ({ test: /\.ts$/, loader: "ts-loader", options: { + compiler: "@koalaui/ets-tsc", "projectReferences": true, configFile: tsconfig } diff --git a/incremental/test-utils/scripts/register.js b/incremental/test-utils/scripts/register.js index 63c14bc6a..6e7df5f8c 100644 --- a/incremental/test-utils/scripts/register.js +++ b/incremental/test-utils/scripts/register.js @@ -29,4 +29,5 @@ tsNode.register({ // If uncommented, running tests doesn't perform type checks. // transpileOnly: true, project: path.resolve(`test`, `tsconfig${unmemoized_suffix}.json`), + compiler: "@koalaui/ets-tsc" }) -- Gitee From 89a91c42fa27618d9282b47c63bff39abe74664f Mon Sep 17 00:00:00 2001 From: Alexander Gorshenev Date: Fri, 31 Jan 2025 16:36:17 +0300 Subject: [PATCH 3/8] more Signed-off-by: Alexander Gorshenev --- arkoala-arkts/arkui/package.json | 2 +- arkoala-arkts/libarkts/package.json | 4 ++-- arkoala-arkts/loader/webpack.config.node.js | 2 +- arkoala-arkts/package.json | 1 - arkoala-arkts/shopping/package.json | 2 +- arkoala-arkts/user/package.json | 2 +- arkoala/arkui-common/package.json | 4 ++-- arkoala/arkui/package.json | 2 +- arkoala/ets-plugin/package.json | 3 +-- arkoala/extension-component/package.json | 4 ++-- arkoala/framework/package.json | 10 +++++----- arkoala/loader/package.json | 8 ++++---- arkoala/loader/webpack.config.base.js | 2 +- arkoala/loader/webpack.config.node-perf.js | 2 +- arkoala/loader/webpack.config.node-test.js | 2 +- arkoala/package.json | 1 - arkoala/tests/webpack.config.node-test.js | 2 +- arkoala/tools/arkoala-transformer/rollup.config.js | 2 +- arkoala/tools/ets-memo-tsc/package.json | 10 +++++----- arkoala/tools/ets-memo-tsc/scripts/pack.mjs | 4 ++-- interop/package.json | 4 ++-- 21 files changed, 35 insertions(+), 38 deletions(-) diff --git a/arkoala-arkts/arkui/package.json b/arkoala-arkts/arkui/package.json index 65c91aa8f..60d32802b 100644 --- a/arkoala-arkts/arkui/package.json +++ b/arkoala-arkts/arkui/package.json @@ -9,6 +9,6 @@ "clean:arkui-no-common": "npm run clean", "build:arkui-no-common:inc": "npm run unmemoize && fast-arktsc --input-files ./arktsconfig-unmemoized.json --output-dir ./build --compiler ../../incremental/tools/panda/arkts/arktsc --link-name arkui-no-common && ninja ${NINJA_OPTIONS} -f build/build.ninja", "build:arkui-no-common": "npm run unmemoize && fast-arktsc --input-files ./arktsconfig-unmemoized.json --output-dir ./build --compiler ../../incremental/tools/panda/arkts/arktsc --link-name arkui-no-common && ninja ${NINJA_OPTIONS} -f build/build.ninja", - "unmemoize": "memo-tsc -b ./tsconfig-unmemoize.json && cp -r ./src/generated/arkts ./build/unmemoized/src/generated" + "unmemoize": "ets-tsc -b ./tsconfig-unmemoize.json && cp -r ./src/generated/arkts ./build/unmemoized/src/generated" } } diff --git a/arkoala-arkts/libarkts/package.json b/arkoala-arkts/libarkts/package.json index 92f587c9d..c6d5d7394 100644 --- a/arkoala-arkts/libarkts/package.json +++ b/arkoala-arkts/libarkts/package.json @@ -18,9 +18,9 @@ "compile:meson": "cd native && meson setup build && meson compile -C build", "copy:.node": "mkdir -p ./build/native/build && cp ./native/build/es2panda.node ./build/native/build", "compile:native": "npm run compile:koala:interop && npm run compile:meson && npm run copy:.node", - "compile:src": "npx memo-tsc -p ./tsconfig.json", + "compile:src": "npx ets-tsc -p ./tsconfig.json", "compile": "npm run compile:native && npm run compile:src", - "compile:plugin": "npx memo-tsc -p examples/tsconfig.json", + "compile:plugin": "npx ets-tsc -p examples/tsconfig.json", "run:js": "PANDA_SDK_PATH=../../incremental/tools/panda/node_modules/@panda/sdk node . --file ./examples/input/main.sts --arktsconfig ./arktsconfig.json --output ./build/abc/main.abc --dump-plugin-ast", "run": "npm run compile && npm run compile:plugin && npm run run:js", "mocha": "PANDA_SDK_PATH=../../incremental/tools/panda/node_modules/@panda/sdk TS_NODE_PROJECT=./test/tsconfig.json mocha -r tsconfig-paths/register --reporter-option maxDiffSize=0", diff --git a/arkoala-arkts/loader/webpack.config.node.js b/arkoala-arkts/loader/webpack.config.node.js index a80246ddb..47c01bb62 100644 --- a/arkoala-arkts/loader/webpack.config.node.js +++ b/arkoala-arkts/loader/webpack.config.node.js @@ -40,7 +40,7 @@ const makeConfig = ({ os, arch, tsconfig }) => ({ options: { "projectReferences": true, configFile: tsconfig, - compiler: "@koalaui/memo-tsc" + compiler: "@koalaui/ets-tsc" } }, ] diff --git a/arkoala-arkts/package.json b/arkoala-arkts/package.json index cdc4e2c95..3eea7644a 100644 --- a/arkoala-arkts/package.json +++ b/arkoala-arkts/package.json @@ -17,7 +17,6 @@ "devDependencies": { "@koalaui/ets-tsc": "4.9.5-r4", "@koalaui/fast-arktsc": "next", - "@koalaui/memo-tsc": "4.9.5", "@types/chai": "^4.3.1", "@types/mocha": "^9.1.0", "bin-links": "^4.0.4", diff --git a/arkoala-arkts/shopping/package.json b/arkoala-arkts/shopping/package.json index 70904a3e9..cb1b82ff7 100644 --- a/arkoala-arkts/shopping/package.json +++ b/arkoala-arkts/shopping/package.json @@ -6,7 +6,7 @@ "clean": "rimraf build generated unmemoized js_output abc lib app/shopping/build app/shopping/libs", "compile:plugin": "cd ../../arkoala/ets-plugin && npm run compile", "compile:ets": "npm run compile:plugin && cd src/ets && ets-tsc -p ./etsconfig.json", - "unmemoize": "npm run compile:ets && memo-tsc -p tsconfig-unmemoize.json", + "unmemoize": "npm run compile:ets && ets-tsc -p tsconfig-unmemoize.json", "unmemoize:runtime": "npm run unmemoize --prefix ../../incremental/runtime", "unmemoize:arkui-no-common": "npm run unmemoize --prefix ../arkui", "unmemoize:arkui-common": "npm run unmemoize --prefix ../../arkoala/arkui-common", diff --git a/arkoala-arkts/user/package.json b/arkoala-arkts/user/package.json index 8fb7fe817..9fced01c0 100644 --- a/arkoala-arkts/user/package.json +++ b/arkoala-arkts/user/package.json @@ -6,7 +6,7 @@ "clean": "rimraf build generated unmemoized js_output abc lib app/user/build", "compile:plugin": "cd ../../arkoala/ets-plugin && npm run compile", "compile:ets": "npm run compile:plugin && cd src/ets && ets-tsc -p ./etsconfig.json", - "unmemoize": "npm run compile:ets && memo-tsc -p tsconfig-unmemoize.json", + "unmemoize": "npm run compile:ets && ets-tsc -p tsconfig-unmemoize.json", "unmemoize:runtime": "npm run unmemoize --prefix ../../incremental/runtime", "unmemoize:arkui-no-common": "npm run unmemoize --prefix ../arkui", "unmemoize:arkui-common": "npm run unmemoize --prefix ../../arkoala/arkui-common", diff --git a/arkoala/arkui-common/package.json b/arkoala/arkui-common/package.json index c6ccef336..ab29b0278 100644 --- a/arkoala/arkui-common/package.json +++ b/arkoala/arkui-common/package.json @@ -35,8 +35,8 @@ "scripts": { "clean": "rimraf build dist; npm run ets:clean", "docs": "typedoc", - "unmemoize": "memo-tsc -b tsconfig-unmemoize.json", - "compile": "npm run ohos-sdk && memo-tsc -b .", + "unmemoize": "ets-tsc -b tsconfig-unmemoize.json", + "compile": "npm run ohos-sdk && ets-tsc -b .", "compile:arkts": "../../incremental/tools/panda/arkts/arktsc --ets-module --arktsconfig arktsconfig.json", "build:arkui-common": "npm run unmemoize && npm run build:arkui-common:inc", "build:arkui-common:inc": "npm run unmemoize && fast-arktsc --input-files ./arktsconfig.json --output-dir ./build --compiler ../../incremental/tools/panda/arkts/arktsc --link-name arkui-common && ninja ${NINJA_OPTIONS} -f build/build.ninja", diff --git a/arkoala/arkui/package.json b/arkoala/arkui/package.json index 4e389bea4..2577042ee 100644 --- a/arkoala/arkui/package.json +++ b/arkoala/arkui/package.json @@ -34,7 +34,7 @@ ], "scripts": { "docs": "typedoc", - "compile": "npm run ohos-sdk --prefix ../arkui-common && memo-tsc -b .", + "compile": "npm run ohos-sdk --prefix ../arkui-common && ets-tsc -b .", "compile:arkts": "bash ../../incremental/tools/panda/arkts/arktsc --arktsconfig arktsconfig.json", "clean": "rimraf build dist ; npm run ets:clean", "ets:test": "cd test/ets; ets-tsc", diff --git a/arkoala/ets-plugin/package.json b/arkoala/ets-plugin/package.json index 5aac259a2..e7f1dbbec 100644 --- a/arkoala/ets-plugin/package.json +++ b/arkoala/ets-plugin/package.json @@ -35,7 +35,7 @@ "test:koala:spec": "npm run compile:koala:spec && mocha --config mocharc.koala.spec.json", "test:spec": "npm run test:arkoala:spec && npm run test:arkts:spec && npm run test:koala:spec", "test:all": "npm run compile && npm run test:ets && npm run sync:spec && npm run test:spec", - "compile:sync:spec": "cd test/scripts && memo-tsc -p tsconfig-sync-specification.json", + "compile:sync:spec": "cd test/scripts && ets-tsc -p tsconfig-sync-specification.json", "sync:spec": "npm run compile:sync:spec && cd build/test/scripts && node sync-specification.js", "clean": "rimraf build test/spec test/specification/ets2bundle" }, @@ -43,7 +43,6 @@ "dependencies": {}, "devDependencies": { "@koalaui/ets-tsc": "4.9.5-r4", - "@koalaui/memo-tsc": "4.9.5", "@types/chai": "^4.3.1", "@types/mocha": "^9.1.0", "@typescript-eslint/eslint-plugin": "^5.20.0", diff --git a/arkoala/extension-component/package.json b/arkoala/extension-component/package.json index 2fb3686f9..eee5e39c0 100644 --- a/arkoala/extension-component/package.json +++ b/arkoala/extension-component/package.json @@ -11,8 +11,8 @@ }, "keywords": [], "scripts": { - "compile": "memo-tsc -b .", - "unmemoize": "memo-tsc && memo-tsc -b tsconfig-unmemoize.json" + "compile": "ets-tsc -b .", + "unmemoize": "ets-tsc && ets-tsc -b tsconfig-unmemoize.json" }, "author": "", "license": "ISC" diff --git a/arkoala/framework/package.json b/arkoala/framework/package.json index 921ffde19..8c774a74b 100644 --- a/arkoala/framework/package.json +++ b/arkoala/framework/package.json @@ -28,7 +28,7 @@ "prepare:arm32": "npm run prepare:compiler && npm run install:sysroot:arm32 --prefix ../tools/compiler", "prepare:wincrt:bz": "node ../ohos-sdk/scripts/openlab-cli.mjs download -p wincrt -f wincrt-14.33.173.tar.gz -v 14.33.173 -d prebuilt/wincrt", "prepare:wincrt:yz": "node ../ohos-sdk/scripts/gitlab-cli.mjs download -p wincrt -f wincrt-14.33.173.tar.gz -v 14.33.173 -d prebuilt/wincrt", - "clean": "memo-tsc -b . --clean && rimraf -g build dist lib generated native/build-* *.ini", + "clean": "ets-tsc -b . --clean && rimraf -g build dist lib generated native/build-* *.ini", "configure:native-node-host": "cd native && meson setup -D vm_kind=node build-node-host", "compile:native-node-host": "npm run configure:native-node-host && cd native && meson compile -C build-node-host && meson install -C build-node-host", "configure:native-hzvm-host": "cd native && meson setup -D vm_kind=hzvm build-hzvm-host", @@ -54,7 +54,7 @@ "configure:native-hzvm-ohos-arm32": "npm run prepare:arm32 && cd native && node ../scripts/configure.mjs hzvm-ohos-arm32", "compile:native-hzvm-ohos-arm32": "npm run configure:native-hzvm-ohos-arm32 && cd native && meson compile -C build-hzvm-ohos-arm32 && meson install -C build-hzvm-ohos-arm32", "configure:native-hzvm-ohos": "npm run configure:native-hzvm-ohos-arm64", - "compile:native-hzvm-ohos": "memo-tsc -b . && npm run compile:native-hzvm-ohos-arm64", + "compile:native-hzvm-ohos": "ets-tsc -b . && npm run compile:native-hzvm-ohos-arm64", "configure:native-panda-ohos-arm64": "npm run prepare:arm64 && cd native && node ../scripts/configure.mjs panda-ohos-arm64", "compile:native-panda-ohos-arm64": "npm run configure:native-panda-ohos-arm64 && cd native && meson compile -C build-panda-ohos-arm64 && meson install -C build-panda-ohos-arm64", "configure:native-panda-ohos-arm32": "npm run prepare:arm32 && cd native && node ../scripts/configure.mjs panda-ohos-arm32", @@ -65,9 +65,9 @@ "compile:native-panda-with-hzvm-ohos-arm64": "npm run configure:native-panda-with-hzvm-ohos-arm64 && npm run compile:native-panda-ohos-arm64 && cd native && meson compile -C build-hzvm-ohos-arm64-vmloader && meson install -C build-hzvm-ohos-arm64-vmloader && npm run copy:libcpp:arm64 --prefix ../../tools/compiler", "configure:native-panda-with-hzvm-ohos-arm32": "npm run configure:native-panda-ohos-arm32 && cd native && node ../scripts/configure.mjs hzvm-ohos-arm32-vmloader", "compile:native-panda-with-hzvm-ohos-arm32": "npm run configure:native-panda-with-hzvm-ohos-arm32 && npm run compile:native-panda-ohos-arm32 && cd native && meson compile -C build-hzvm-ohos-arm32-vmloader && meson install -C build-hzvm-ohos-arm32-vmloader && npm run copy:libcpp:arm32 --prefix ../../tools/compiler", - "compile:node-host": "memo-tsc -b . && npm run compile:native-node-host", + "compile:node-host": "ets-tsc -b . && npm run compile:native-node-host", "compile": "npm run compile:node-host", - "compile:hzvm-host": "memo-tsc -b . && npm run compile:native-hzvm-host", - "compile:hzvm-ohos": "memo-tsc -b . && npm run compile:native-hzvm-ohos" + "compile:hzvm-host": "ets-tsc -b . && npm run compile:native-hzvm-host", + "compile:hzvm-ohos": "ets-tsc -b . && npm run compile:native-hzvm-ohos" } } diff --git a/arkoala/loader/package.json b/arkoala/loader/package.json index ffea321a4..67306b372 100644 --- a/arkoala/loader/package.json +++ b/arkoala/loader/package.json @@ -16,13 +16,13 @@ "plugins:compile": "cd ../; npm run compile -w koala-arkui && npm run compiler:plugin:compile && npm run ets:plugin:compile", "ets": "cd src/ets; ets-tsc", "test:hzvm:loader": "npm run compile:hzvm-host", - "clean": "memo-tsc -b . --clean && rimraf build dist lib generated unmemoized", - "compile:node-test-host": "npm run gen-resources && npm run -C ../framework compile:native-node-host && memo-tsc -b ../extension-component && npm run ets && npm run compile:node-test", - "compile:node-test-host:unmemoizing": "npm run gen-resources && npm run unmemoize --prefix ../extension-component && npm run ets && memo-tsc -b tsconfig-unmemoize.json && npm run compile:node-test:unmemoizing", + "clean": "ets-tsc -b . --clean && rimraf build dist lib generated unmemoized", + "compile:node-test-host": "npm run gen-resources && npm run -C ../framework compile:native-node-host && ets-tsc -b ../extension-component && npm run ets && npm run compile:node-test", + "compile:node-test-host:unmemoizing": "npm run gen-resources && npm run unmemoize --prefix ../extension-component && npm run ets && ets-tsc -b tsconfig-unmemoize.json && npm run compile:node-test:unmemoizing", "compile:node-test": "WEBPACK_NO_MINIMIZE=true webpack --config webpack.config.node-test.js", "compile:node-test:unmemoizing": "WEBPACK_NO_MINIMIZE=true webpack --config webpack.config.node-test.js --env tsconfig=tsconfig-run-unmemoized.json --env unmemoized=unmemoized", "compile:node-test:unmemoizing:arkts": "bash ../external/incremental/tools/panda/arkts/arktsc --extension sts unmemoized/generated/ets/page.ts --arktsconfig arktsconfig-run-unmemoized.json", - "compile:perf-ets": "npm run plugins:compile && HOS_SDK_HOME='../ohos-sdk/ohos-sdk/HarmonyOS-NEXT-DB1/openharmony' npm run gen-resources && memo-tsc -p ../extension-component && npm run ets", + "compile:perf-ets": "npm run plugins:compile && HOS_SDK_HOME='../ohos-sdk/ohos-sdk/HarmonyOS-NEXT-DB1/openharmony' npm run gen-resources && ets-tsc -p ../extension-component && npm run ets", "compile:perf-node": "WEBPACK_NO_MINIMIZE=true webpack --config webpack.config.node-perf.js", "compile:web": "WEBPACK_NO_MINIMIZE=true webpack serve --open --config webpack.config.web.js", "pack:perf": "npm run compile:perf-ets && npm run compile:perf-node && webpack ./lib/index-perf.js && echo 'Packed to dist/main.js'", diff --git a/arkoala/loader/webpack.config.base.js b/arkoala/loader/webpack.config.base.js index 50c15d6d0..b6bc35d15 100644 --- a/arkoala/loader/webpack.config.base.js +++ b/arkoala/loader/webpack.config.base.js @@ -42,7 +42,7 @@ const makeConfig = ({ os, arch }) => ({ loader: "ts-loader", options: { "projectReferences": true, - compiler: "@koalaui/memo-tsc" + compiler: "@koalaui/ets-tsc" } }, // Bundle already existing source maps for dependencies diff --git a/arkoala/loader/webpack.config.node-perf.js b/arkoala/loader/webpack.config.node-perf.js index 5cd5429a7..93993fcb4 100644 --- a/arkoala/loader/webpack.config.node-perf.js +++ b/arkoala/loader/webpack.config.node-perf.js @@ -43,7 +43,7 @@ const makeConfig = ({ os, arch }) => ({ loader: "ts-loader", options: { "projectReferences": true, - compiler: "@koalaui/memo-tsc" + compiler: "@koalaui/ets-tsc" } }, // Bundle already existing source maps for dependencies diff --git a/arkoala/loader/webpack.config.node-test.js b/arkoala/loader/webpack.config.node-test.js index 8d8d5641e..b3b788852 100644 --- a/arkoala/loader/webpack.config.node-test.js +++ b/arkoala/loader/webpack.config.node-test.js @@ -52,7 +52,7 @@ const makeConfig = ({ os, arch, tsconfig, unmemoized }) => ({ options: { "projectReferences": true, configFile: tsconfig, - compiler: "@koalaui/memo-tsc" + compiler: "@koalaui/ets-tsc" } }, { test: /\.node$/, loader: "node-loader", diff --git a/arkoala/package.json b/arkoala/package.json index bc4c1cd9d..f525dbd05 100644 --- a/arkoala/package.json +++ b/arkoala/package.json @@ -22,7 +22,6 @@ ], "devDependencies": { "@koalaui/ets-tsc": "4.9.5-r4", - "@koalaui/memo-tsc": "4.9.5", "typescript": "4.9.5", "bin-links": "^4.0.4", "read-package-json-fast": "^3.0.2", diff --git a/arkoala/tests/webpack.config.node-test.js b/arkoala/tests/webpack.config.node-test.js index ef492286f..2c408ea17 100644 --- a/arkoala/tests/webpack.config.node-test.js +++ b/arkoala/tests/webpack.config.node-test.js @@ -42,7 +42,7 @@ const makeConfig = ({ os, arch }) => ({ loader: "ts-loader", options: { configFile: "tsconfig-test.json", - compiler: "@koalaui/memo-tsc", + compiler: "@koalaui/ets-tsc", "projectReferences": true, } }, diff --git a/arkoala/tools/arkoala-transformer/rollup.config.js b/arkoala/tools/arkoala-transformer/rollup.config.js index 826457f02..252beb996 100644 --- a/arkoala/tools/arkoala-transformer/rollup.config.js +++ b/arkoala/tools/arkoala-transformer/rollup.config.js @@ -11,7 +11,7 @@ module.exports = { format: "commonjs", exports: "default", }, - external: ["typescript", "ohos-typescript", "@koalaui/ets-tsc", "@koalaui/memo-tsc"], + external: ["typescript", "ohos-typescript", "@koalaui/ets-tsc", "@koalaui/ets-tsc"], plugins: [ replace({ values: { diff --git a/arkoala/tools/ets-memo-tsc/package.json b/arkoala/tools/ets-memo-tsc/package.json index 420e4545b..7b740574e 100644 --- a/arkoala/tools/ets-memo-tsc/package.json +++ b/arkoala/tools/ets-memo-tsc/package.json @@ -1,5 +1,5 @@ { - "name": "ets-memo-tsc", + "name": "ets-ets-tsc", "private": true, "devDependencies": { "ohos-typescript": "4.9.5-r4", @@ -13,11 +13,11 @@ "patch:ts-patch": "node ./scripts/patch-ts-patch.mjs ./node_modules/ts-patch", "patch:typescript": "cd prebuilt/typescript && ts-patch install -s", "patch:ohos-typescript": "npm run patch:ts-patch && cd prebuilt/ohos-typescript && ts-patch install -s", - "pack:memo-tsc": "npm run copy:typescript && npm run patch:typescript && node scripts/pack.mjs memo-tsc", + "pack:ets-tsc": "npm run copy:typescript && npm run patch:typescript && node scripts/pack.mjs ets-tsc", "pack:ets-tsc": "npm run copy:ohos-typescript && npm run patch:ohos-typescript && node scripts/pack.mjs ets-tsc", - "pack:all": "npm run pack:memo-tsc && npm run pack:ets-tsc", - "publish:memo-tsc": "npm run pack:memo-tsc && cd prebuilt/typescript && npm publish", + "pack:all": "npm run pack:ets-tsc && npm run pack:ets-tsc", + "publish:ets-tsc": "npm run pack:ets-tsc && cd prebuilt/typescript && npm publish", "publish:ets-tsc": "npm run pack:ets-tsc && cd prebuilt/ohos-typescript && npm publish", - "publish:all": "npm run publish:memo-tsc && npm run publish:ets-tsc" + "publish:all": "npm run publish:ets-tsc && npm run publish:ets-tsc" } } \ No newline at end of file diff --git a/arkoala/tools/ets-memo-tsc/scripts/pack.mjs b/arkoala/tools/ets-memo-tsc/scripts/pack.mjs index 70b6fa928..3da7cfbb2 100644 --- a/arkoala/tools/ets-memo-tsc/scripts/pack.mjs +++ b/arkoala/tools/ets-memo-tsc/scripts/pack.mjs @@ -27,9 +27,9 @@ function rename(oldName, newName) { function main() { - if (compiler === "memo-tsc") { + if (compiler === "ets-tsc") { copy(typescriptPath, path.join(prebuilt, "typescript")) - rename("typescript", "memo-tsc") + rename("typescript", "ets-tsc") } if (compiler === "ets-tsc") { diff --git a/interop/package.json b/interop/package.json index 50327dcde..810fb3e3b 100644 --- a/interop/package.json +++ b/interop/package.json @@ -41,7 +41,7 @@ }, "scripts": { "clean": "rimraf dist build types", - "compile": "memo-tsc -b .", + "compile": "ets-tsc -b .", "build:interop": "npm run build:interop:inc", "build:interop:inc": "fast-arktsc --input-files ./arktsconfig.json --output-dir ./build --compiler ../incremental/tools/panda/arkts/arktsc --link-name interop && ninja ${NINJA_OPTIONS} -f build/build.ninja", "clean:interop": "npm run clean", @@ -71,7 +71,7 @@ "eslint-plugin-unused-imports": "^2.0.0", "mocha": "^9.2.2", "source-map-support": "^0.5.21", - "@koalaui/memo-tsc": "4.9.5", + "@koalaui/ets-tsc": "4.9.5-r4", "@koalaui/fast-arktsc": "next" } } \ No newline at end of file -- Gitee From c94c362931ffaada3fd63ed4097b61b680d93145 Mon Sep 17 00:00:00 2001 From: Alexander Gorshenev Date: Fri, 31 Jan 2025 17:37:25 +0300 Subject: [PATCH 4/8] more Signed-off-by: Alexander Gorshenev --- .../compiler-plugin/test/diagnostics/diagnostics.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/incremental/compiler-plugin/test/diagnostics/diagnostics.test.ts b/incremental/compiler-plugin/test/diagnostics/diagnostics.test.ts index e1236265e..f7bf8a981 100644 --- a/incremental/compiler-plugin/test/diagnostics/diagnostics.test.ts +++ b/incremental/compiler-plugin/test/diagnostics/diagnostics.test.ts @@ -19,7 +19,7 @@ import * as path from "path" function runTsc(file: string) { let npx = process.platform === "win32" ? "npx.cmd" : "npx" - return child.spawnSync(npx, ["tsc", path.join('test', 'diagnostics', 'input', file)]) + return child.spawnSync(npx, ["ets-tsc", path.join('test', 'diagnostics', 'input', file)]) } function diagnostics(name: string, file: string, message: string) { -- Gitee From 2a9350021df4357d474edfa343250422fabdcbcd Mon Sep 17 00:00:00 2001 From: Alexander Gorshenev Date: Fri, 31 Jan 2025 18:31:14 +0300 Subject: [PATCH 5/8] rebased to master Signed-off-by: Alexander Gorshenev --- arkoala/arkui-common/package.json | 6 +++--- arkoala/arkui/package.json | 4 ++-- arkoala/ets-plugin/package.json | 4 ++-- arkoala/tools/ets-memo-tsc/scripts/pack.mjs | 6 +++--- incremental/common/package.json | 4 ++-- incremental/compat/package.json | 6 +++--- incremental/compiler-plugin/package.json | 6 +++--- interop/package.json | 6 +++--- 8 files changed, 21 insertions(+), 21 deletions(-) diff --git a/arkoala/arkui-common/package.json b/arkoala/arkui-common/package.json index ab29b0278..23277cbfa 100644 --- a/arkoala/arkui-common/package.json +++ b/arkoala/arkui-common/package.json @@ -35,8 +35,8 @@ "scripts": { "clean": "rimraf build dist; npm run ets:clean", "docs": "typedoc", - "unmemoize": "ets-tsc -b tsconfig-unmemoize.json", - "compile": "npm run ohos-sdk && ets-tsc -b .", + "unmemoize": "ets-tsc -b tsconfig-unmemoize.json", + "compile": "npm run ohos-sdk && ets-tsc -b .", "compile:arkts": "../../incremental/tools/panda/arkts/arktsc --ets-module --arktsconfig arktsconfig.json", "build:arkui-common": "npm run unmemoize && npm run build:arkui-common:inc", "build:arkui-common:inc": "npm run unmemoize && fast-arktsc --input-files ./arktsconfig.json --output-dir ./build --compiler ../../incremental/tools/panda/arkts/arktsc --link-name arkui-common && ninja ${NINJA_OPTIONS} -f build/build.ninja", @@ -59,4 +59,4 @@ "@koalaui/ets-tsc": "4.9.5-r4", "@koalaui/fast-arktsc": "next" } -} \ No newline at end of file +} diff --git a/arkoala/arkui/package.json b/arkoala/arkui/package.json index 2577042ee..0024f459c 100644 --- a/arkoala/arkui/package.json +++ b/arkoala/arkui/package.json @@ -34,7 +34,7 @@ ], "scripts": { "docs": "typedoc", - "compile": "npm run ohos-sdk --prefix ../arkui-common && ets-tsc -b .", + "compile": "npm run ohos-sdk --prefix ../arkui-common && ets-tsc -b .", "compile:arkts": "bash ../../incremental/tools/panda/arkts/arktsc --arktsconfig arktsconfig.json", "clean": "rimraf build dist ; npm run ets:clean", "ets:test": "cd test/ets; ets-tsc", @@ -64,4 +64,4 @@ "mocha": "^9.2.2", "source-map-support": "^0.5.21" } -} \ No newline at end of file +} diff --git a/arkoala/ets-plugin/package.json b/arkoala/ets-plugin/package.json index e7f1dbbec..a3b719fde 100644 --- a/arkoala/ets-plugin/package.json +++ b/arkoala/ets-plugin/package.json @@ -35,7 +35,7 @@ "test:koala:spec": "npm run compile:koala:spec && mocha --config mocharc.koala.spec.json", "test:spec": "npm run test:arkoala:spec && npm run test:arkts:spec && npm run test:koala:spec", "test:all": "npm run compile && npm run test:ets && npm run sync:spec && npm run test:spec", - "compile:sync:spec": "cd test/scripts && ets-tsc -p tsconfig-sync-specification.json", + "compile:sync:spec": "cd test/scripts && ets-tsc -p tsconfig-sync-specification.json", "sync:spec": "npm run compile:sync:spec && cd build/test/scripts && node sync-specification.js", "clean": "rimraf build test/spec test/specification/ets2bundle" }, @@ -53,4 +53,4 @@ "mocha": "^9.2.2", "source-map-support": "^0.5.21" } -} \ No newline at end of file +} diff --git a/arkoala/tools/ets-memo-tsc/scripts/pack.mjs b/arkoala/tools/ets-memo-tsc/scripts/pack.mjs index 3da7cfbb2..3939a0d91 100644 --- a/arkoala/tools/ets-memo-tsc/scripts/pack.mjs +++ b/arkoala/tools/ets-memo-tsc/scripts/pack.mjs @@ -27,9 +27,9 @@ function rename(oldName, newName) { function main() { - if (compiler === "ets-tsc") { + if (compiler === "memo-tsc") { copy(typescriptPath, path.join(prebuilt, "typescript")) - rename("typescript", "ets-tsc") + rename("typescript", "memo-tsc") } if (compiler === "ets-tsc") { @@ -39,4 +39,4 @@ function main() { } -main() \ No newline at end of file +main() diff --git a/incremental/common/package.json b/incremental/common/package.json index 18b56192a..94a1617f8 100644 --- a/incremental/common/package.json +++ b/incremental/common/package.json @@ -31,7 +31,7 @@ } }, "scripts": { - "compile": "ets-tsc -b .", + "compile": "ets-tsc -b .", "clean": "rimraf build", "test": "mocha", "test:coverage": "nyc mocha", @@ -56,4 +56,4 @@ "mocha": "^9.2.2", "source-map-support": "^0.5.21" } -} \ No newline at end of file +} diff --git a/incremental/compat/package.json b/incremental/compat/package.json index cfc8e2672..4c487c2e4 100644 --- a/incremental/compat/package.json +++ b/incremental/compat/package.json @@ -22,8 +22,8 @@ }, "scripts": { "clean": "rimraf build dist", - "compile": "ets-tsc -b .", - "compile:ohos": "ets-tsc -b ./tsconfig-ohos.json", + "compile": "ets-tsc -b .", + "compile:ohos": "ets-tsc -b ./tsconfig-ohos.json", "compile:all": "npm run compile && npm run compile:ohos", "build:compat": "npm run build:compat:inc", "build:compat:inc": "fast-arktsc --input-files ./arktsconfig.json --output-dir ./build --compiler ../tools/panda/arkts/arktsc --link-name compat && ninja ${NINJA_OPTIONS} -f build/build.ninja", @@ -43,4 +43,4 @@ "mocha": "^9.2.2", "source-map-support": "^0.5.21" } -} \ No newline at end of file +} diff --git a/incremental/compiler-plugin/package.json b/incremental/compiler-plugin/package.json index 7b3cf9d75..d623af787 100644 --- a/incremental/compiler-plugin/package.json +++ b/incremental/compiler-plugin/package.json @@ -24,11 +24,11 @@ "source-map-support": "^0.5.21" }, "scripts": { - "compile": "ets-tsc -b .", + "compile": "ets-tsc -b .", "clean": "rimraf build dist test/dump", - "unmemoize:tests": "npm run compile && cd test && ets-tsc -p tsconfig-unmemoize.json && rimraf build", + "unmemoize:tests": "npm run compile && cd test && ets-tsc -p tsconfig-unmemoize.json && rimraf build", "test": "npm run unmemoize:tests && mocha", "test:coverage": "nyc mocha", "canonize": "npm run unmemoize:tests && cp -r ./test/unmemoized/examples ./test/golden/" } -} \ No newline at end of file +} diff --git a/interop/package.json b/interop/package.json index 810fb3e3b..909462aa0 100644 --- a/interop/package.json +++ b/interop/package.json @@ -41,7 +41,7 @@ }, "scripts": { "clean": "rimraf dist build types", - "compile": "ets-tsc -b .", + "compile": "ets-tsc -b .", "build:interop": "npm run build:interop:inc", "build:interop:inc": "fast-arktsc --input-files ./arktsconfig.json --output-dir ./build --compiler ../incremental/tools/panda/arkts/arktsc --link-name interop && ninja ${NINJA_OPTIONS} -f build/build.ninja", "clean:interop": "npm run clean", @@ -71,7 +71,7 @@ "eslint-plugin-unused-imports": "^2.0.0", "mocha": "^9.2.2", "source-map-support": "^0.5.21", - "@koalaui/ets-tsc": "4.9.5-r4", + "@koalaui/ets-tsc": "4.9.5-r4", "@koalaui/fast-arktsc": "next" } -} \ No newline at end of file +} -- Gitee From 5e9fe6b3447fc4b4637f0a375288902893a68c1a Mon Sep 17 00:00:00 2001 From: Alexander Gorshenev Date: Thu, 30 Jan 2025 12:22:55 +0300 Subject: [PATCH 6/8] An attempt to change jsdoc memo to a decorator Signed-off-by: Alexander Gorshenev --- .../compiler-plugin/src/koala-transformer.ts | 33 +++++++++++++++++++ incremental/runtime/src/memo/remember.ts | 3 ++ incremental/runtime/tsconfig.json | 2 +- 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/incremental/compiler-plugin/src/koala-transformer.ts b/incremental/compiler-plugin/src/koala-transformer.ts index 035fd7dad..9a8699aad 100644 --- a/incremental/compiler-plugin/src/koala-transformer.ts +++ b/incremental/compiler-plugin/src/koala-transformer.ts @@ -63,6 +63,38 @@ export function memoTransform( return variableTransformer.visitor(transformedReturn) as ts.SourceFile } + +function isAnnotationIssue(sourceFile: ts.SourceFile, message: ts.Diagnostic, text: string): boolean { + if (message.file == sourceFile && + // TODO: how stable are typescript message codes? + message.code == 1206 && + text.startsWith("Decorators are not valid here") + ) { + return true + } + return false +} + + +export function filterOutDiagnostics(sourceFile: ts.SourceFile, extras?: ts.TransformerExtras) { + const indicesToRemove: number[] = [] + + extras?.diagnostics.forEach((message, index) => { + const messageText = message.messageText + const text: string = typeof messageText === "string" ? messageText : messageText.messageText + + if (isAnnotationIssue(sourceFile, message, text) + ) { + + indicesToRemove.unshift(index) + } + }) + + indicesToRemove.forEach(index => { + extras?.removeDiagnostic(index) + }) +} + export default function koala_transformer(program: ts.Program, pluginOptions: TransformerOptions, extras: ts.TransformerExtras) { const printer = ts.createPrinter() const tracer = new Tracer(pluginOptions, printer) @@ -73,6 +105,7 @@ export default function koala_transformer(program: ts.Program, pluginOptions: Tr const rewrite = new Rewrite(sourceFile, pluginOptions) const dumpVisitor = new DumpVisitor(tracer, sourceFile, rewrite.functionTable, ctx) const result = memoTransform(sourceFile, typechecker, ctx, extras, tracer, rewrite) + filterOutDiagnostics(sourceFile, extras) dumpVisitor.visitor(result) if (pluginOptions.only_unmemoize) { const content = tracer.printer.printNode(ts.EmitHint.Unspecified, result, sourceFile) diff --git a/incremental/runtime/src/memo/remember.ts b/incremental/runtime/src/memo/remember.ts index 090c1a8b9..1c86c826f 100644 --- a/incremental/runtime/src/memo/remember.ts +++ b/incremental/runtime/src/memo/remember.ts @@ -18,6 +18,9 @@ import { __context, __id } from "../internals" import { scheduleCallback } from "../states/GlobalStateManager" import { ArrayState, ControlledScope, MutableState } from "../states/State" +@memo +function foo() {} + /** * It calculates the value of the given lambda and caches its result. * In contrast to the `remember` function, the given lambda can be recalculated diff --git a/incremental/runtime/tsconfig.json b/incremental/runtime/tsconfig.json index 1cbc06787..7c6fce706 100644 --- a/incremental/runtime/tsconfig.json +++ b/incremental/runtime/tsconfig.json @@ -6,7 +6,7 @@ "rootDirs": ["src", "test"], "module": "CommonJS", "plugins": [ - { "transform": "@koalaui/compiler-plugin/build/lib/src/koala-transformer.js", "contextImport": "../../src/internals", "trace": false } + { "transform": "../compiler-plugin/build/lib/src/koala-transformer.js", "contextImport": "../../src/internals", "trace": false } ] }, "include": ["src/**/*"], -- Gitee From d3dc05a31192979aff2d3dae262dcbeaadb6cf57 Mon Sep 17 00:00:00 2001 From: Alexander Gorshenev Date: Fri, 31 Jan 2025 20:13:54 +0300 Subject: [PATCH 7/8] somewhat working Signed-off-by: Alexander Gorshenev --- incremental/compiler-plugin/src/koala-transformer.ts | 6 ++---- incremental/runtime/tsconfig.json | 3 +++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/incremental/compiler-plugin/src/koala-transformer.ts b/incremental/compiler-plugin/src/koala-transformer.ts index 9a8699aad..873feadb7 100644 --- a/incremental/compiler-plugin/src/koala-transformer.ts +++ b/incremental/compiler-plugin/src/koala-transformer.ts @@ -83,9 +83,7 @@ export function filterOutDiagnostics(sourceFile: ts.SourceFile, extras?: ts.Tran const messageText = message.messageText const text: string = typeof messageText === "string" ? messageText : messageText.messageText - if (isAnnotationIssue(sourceFile, message, text) - ) { - + if (isAnnotationIssue(sourceFile, message, text)) { indicesToRemove.unshift(index) } }) @@ -105,7 +103,6 @@ export default function koala_transformer(program: ts.Program, pluginOptions: Tr const rewrite = new Rewrite(sourceFile, pluginOptions) const dumpVisitor = new DumpVisitor(tracer, sourceFile, rewrite.functionTable, ctx) const result = memoTransform(sourceFile, typechecker, ctx, extras, tracer, rewrite) - filterOutDiagnostics(sourceFile, extras) dumpVisitor.visitor(result) if (pluginOptions.only_unmemoize) { const content = tracer.printer.printNode(ts.EmitHint.Unspecified, result, sourceFile) @@ -116,6 +113,7 @@ export default function koala_transformer(program: ts.Program, pluginOptions: Tr } else if (pluginOptions.trace) { tracer.trace("OUTPUT:\n" + printer.printNode(ts.EmitHint.SourceFile, result, sourceFile)) } + filterOutDiagnostics(sourceFile, extras) return result } } diff --git a/incremental/runtime/tsconfig.json b/incremental/runtime/tsconfig.json index 7c6fce706..46d8d8a94 100644 --- a/incremental/runtime/tsconfig.json +++ b/incremental/runtime/tsconfig.json @@ -5,6 +5,9 @@ "rootDir": ".", "rootDirs": ["src", "test"], "module": "CommonJS", + "noEmitOnError": false, + "composite": false, + "incremental": false, "plugins": [ { "transform": "../compiler-plugin/build/lib/src/koala-transformer.js", "contextImport": "../../src/internals", "trace": false } ] -- Gitee From d4f8633388b44998dcdfe09430668d3ae2dc2f42 Mon Sep 17 00:00:00 2001 From: Alexander Gorshenev Date: Fri, 31 Jan 2025 20:49:57 +0300 Subject: [PATCH 8/8] an attempt to use @mmemo in tests Signed-off-by: Alexander Gorshenev --- .../compiler-plugin/src/analysis-visitor.ts | 19 +++++++++++++++++-- .../compiler-plugin/src/koala-transformer.ts | 3 +++ incremental/compiler-plugin/src/util.ts | 5 +++++ incremental/runtime/test/tsconfig.json | 4 ++++ 4 files changed, 29 insertions(+), 2 deletions(-) diff --git a/incremental/compiler-plugin/src/analysis-visitor.ts b/incremental/compiler-plugin/src/analysis-visitor.ts index 1c2a18898..7b59319f8 100644 --- a/incremental/compiler-plugin/src/analysis-visitor.ts +++ b/incremental/compiler-plugin/src/analysis-visitor.ts @@ -30,6 +30,7 @@ import { findFunctionDeclaration, isMemoEntry, skipParenthesizedExpression, + hasMemoDecorator, } from "./util" import { ImportExport } from './import-export'; @@ -71,9 +72,23 @@ export class AnalysisVisitor extends AbstractVisitor { } } - immediateFunctionKind(source: ts.SourceFile, node: ts.Node, name: string): FunctionKind { + functionKindFromDecorator(node: ts.Node): FunctionKind { + if (hasMemoDecorator(node)) return FunctionKind.MEMO + return FunctionKind.REGULAR + } + + functionKindFromComment(source: ts.SourceFile, node: ts.Node): FunctionKind { const comment = getComment(source, node) - let kind = parseComment(comment) + return parseComment(comment) + } + + immediateFunctionKind(source: ts.SourceFile, node: ts.Node, name: string): FunctionKind { + const decoratorKind = this.functionKindFromDecorator(node) + const commentKind = this.functionKindFromDecorator(node) + + // Decorator has a precedence + const kind = decoratorKind ? decoratorKind : commentKind + this.traceAnnotation(name, kind, node) return kind } diff --git a/incremental/compiler-plugin/src/koala-transformer.ts b/incremental/compiler-plugin/src/koala-transformer.ts index 873feadb7..f00817ffe 100644 --- a/incremental/compiler-plugin/src/koala-transformer.ts +++ b/incremental/compiler-plugin/src/koala-transformer.ts @@ -96,6 +96,7 @@ export function filterOutDiagnostics(sourceFile: ts.SourceFile, extras?: ts.Tran export default function koala_transformer(program: ts.Program, pluginOptions: TransformerOptions, extras: ts.TransformerExtras) { const printer = ts.createPrinter() const tracer = new Tracer(pluginOptions, printer) + console.log(extras.diagnostics) return (ctx: ts.TransformationContext) => { const typechecker = program.getTypeChecker(); return (sourceFile: ts.SourceFile) => { @@ -103,6 +104,7 @@ export default function koala_transformer(program: ts.Program, pluginOptions: Tr const rewrite = new Rewrite(sourceFile, pluginOptions) const dumpVisitor = new DumpVisitor(tracer, sourceFile, rewrite.functionTable, ctx) const result = memoTransform(sourceFile, typechecker, ctx, extras, tracer, rewrite) + filterOutDiagnostics(sourceFile, extras) dumpVisitor.visitor(result) if (pluginOptions.only_unmemoize) { const content = tracer.printer.printNode(ts.EmitHint.Unspecified, result, sourceFile) @@ -113,6 +115,7 @@ export default function koala_transformer(program: ts.Program, pluginOptions: Tr } else if (pluginOptions.trace) { tracer.trace("OUTPUT:\n" + printer.printNode(ts.EmitHint.SourceFile, result, sourceFile)) } + console.log(extras.diagnostics) filterOutDiagnostics(sourceFile, extras) return result } diff --git a/incremental/compiler-plugin/src/util.ts b/incremental/compiler-plugin/src/util.ts index de42c978d..cfd81eb72 100644 --- a/incremental/compiler-plugin/src/util.ts +++ b/incremental/compiler-plugin/src/util.ts @@ -460,6 +460,11 @@ export function hasStaticModifier(node: ts.MethodDeclaration): boolean { return node.modifiers?.find(it => it.kind == ts.SyntaxKind.StaticKeyword) != undefined } +export function hasMemoDecorator(node: ts.Node): boolean { + const decorators = ts.getAllDecorators(node) + return !!decorators.find(it => ts.isIdentifier(it.expression) && ts.idText(it.expression) == "memo") +} + export function error(message: any): any { console.log(message) console.trace() diff --git a/incremental/runtime/test/tsconfig.json b/incremental/runtime/test/tsconfig.json index 88cfa1678..dcc472ea0 100644 --- a/incremental/runtime/test/tsconfig.json +++ b/incremental/runtime/test/tsconfig.json @@ -1,6 +1,10 @@ { "extends": "../tsconfig.json", "compilerOptions": { + "experimentalDecorators": true, + "noEmitOnError": false, + "composite": false, + "incremental": false, "baseUrl": "./", "outDir": "build/test", "module": "CommonJS", -- Gitee