From 643278162c9cbb8db7bff4858df38f1d6b8b178c Mon Sep 17 00:00:00 2001 From: Wang Yiwen Date: Fri, 29 Mar 2024 20:32:17 +0800 Subject: [PATCH 01/10] Rename core.index as Typescript --- packages/core/{index.js => index.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename packages/core/{index.js => index.ts} (100%) diff --git a/packages/core/index.js b/packages/core/index.ts similarity index 100% rename from packages/core/index.js rename to packages/core/index.ts From b0b566aeac56fcfedeeafca249d05fb2bd77b413 Mon Sep 17 00:00:00 2001 From: Wang Yiwen Date: Fri, 29 Mar 2024 20:59:20 +0800 Subject: [PATCH 02/10] Adapt code/index to Typescript Adapt code/index to Typescript --- .eslintignore | 1 + .gitignore | 1 + packages/cli/src/cmd/build.js | 2 +- packages/cli/src/cmd/deploy.js | 2 +- packages/cli/src/cmd/serve.js | 2 +- packages/core/index.ts | 9 +++------ 6 files changed, 8 insertions(+), 9 deletions(-) diff --git a/.eslintignore b/.eslintignore index 1bf59375c8..25ce62734d 100644 --- a/.eslintignore +++ b/.eslintignore @@ -24,6 +24,7 @@ packages/core/src/Site/*.js packages/core/src/utils/*.js packages/core/src/variables/*.js packages/core/test/unit/**/*.js +packages/core/index.js # Rules for pure JS files packages/core/src/lib/markdown-it/patches/* diff --git a/.gitignore b/.gitignore index ff59cd5fff..1162c69117 100644 --- a/.gitignore +++ b/.gitignore @@ -89,5 +89,6 @@ packages/core/src/Site/*.js packages/core/src/utils/*.js packages/core/src/variables/*.js packages/core/test/unit/**/*.js +packages/core/index.js # --- packages/core end --- diff --git a/packages/cli/src/cmd/build.js b/packages/cli/src/cmd/build.js index 6c73ac863d..3f6f54bde9 100755 --- a/packages/cli/src/cmd/build.js +++ b/packages/cli/src/cmd/build.js @@ -1,6 +1,6 @@ const path = require('path'); -const { Site } = require('@markbind/core').Site; +const { Site } = require('@markbind/core'); const cliUtil = require('../util/cliUtil'); const logger = require('../util/logger'); diff --git a/packages/cli/src/cmd/deploy.js b/packages/cli/src/cmd/deploy.js index 475fed36cf..f38c79ade9 100755 --- a/packages/cli/src/cmd/deploy.js +++ b/packages/cli/src/cmd/deploy.js @@ -1,6 +1,6 @@ const path = require('path'); -const { Site } = require('@markbind/core').Site; +const { Site } = require('@markbind/core'); const cliUtil = require('../util/cliUtil'); const logger = require('../util/logger'); diff --git a/packages/cli/src/cmd/serve.js b/packages/cli/src/cmd/serve.js index a43f33187e..21ff8e65dc 100755 --- a/packages/cli/src/cmd/serve.js +++ b/packages/cli/src/cmd/serve.js @@ -2,7 +2,7 @@ const chokidar = require('chokidar'); const path = require('path'); const readline = require('readline'); -const { Site } = require('@markbind/core').Site; +const { Site } = require('@markbind/core'); const { pageVueServerRenderer } = require('@markbind/core/src/Page/PageVueServerRenderer'); const fsUtil = require('@markbind/core/src/utils/fsUtil'); diff --git a/packages/core/index.ts b/packages/core/index.ts index 6aac50828f..fdcba93a6d 100644 --- a/packages/core/index.ts +++ b/packages/core/index.ts @@ -1,7 +1,4 @@ -const Site = require('./src/Site'); -const { Template } = require('./src/Site/template'); +import { Site } from './src/Site'; +import { Template } from './src/Site/template'; -module.exports = { - Site, - Template, -}; +export { Site, Template }; From 69ec838cb1c2ddb0cf58359d5a576fb7ec5e8663 Mon Sep 17 00:00:00 2001 From: "Lee Xiong Jie, Isaac" <68138671+luminousleek@users.noreply.github.com> Date: Thu, 4 Apr 2024 23:34:05 +0800 Subject: [PATCH 03/10] Standardise NodeProcessor.data.ts constant names (#2483) Currently, there are two naming formats for constant names. This has led to a redundant test being created in a previous PR. Let's standardise the naming format to make the purpose of these constants clearer. Let's also split some constants to test for one overridden attribute at a time. --- .../core/test/unit/html/NodeProcessor.data.ts | 89 +++++++++++-------- .../core/test/unit/html/NodeProcessor.test.ts | 25 +++--- 2 files changed, 65 insertions(+), 49 deletions(-) diff --git a/packages/core/test/unit/html/NodeProcessor.data.ts b/packages/core/test/unit/html/NodeProcessor.data.ts index b255e4de57..0f6900c05a 100644 --- a/packages/core/test/unit/html/NodeProcessor.data.ts +++ b/packages/core/test/unit/html/NodeProcessor.data.ts @@ -19,26 +19,6 @@ export const PROCESS_PANEL_ATTRIBUTES_EXPECTED = ` `; export const PROCESS_PANEL_HEADER_SLOT_TAKES_PRIORITY = ` - -
- This existing header slot should be preserved in favour over header attribute, with a logger warning for repeated attributes. -
- Header attribute should be ignored and deleted while header slot is reserved. -
-`; - -export const PROCESS_PANEL_HEADER_SLOT_TAKES_PRIORITY_EXPECTED = ` - - - Header attribute should be ignored and deleted while header slot is reserved. - -`; - -export const PROCESS_PANEL_HEADER_SLOT_TAKES_PRIORITY_WARN_MSG = "panel has a header slot, 'header' attribute has no effect."; - -export const PROCESS_PANEL_HEADER_NO_OVERRIDE = `
This existing header slot should be preserved in favour over header attribute. @@ -49,7 +29,7 @@ export const PROCESS_PANEL_HEADER_NO_OVERRIDE = ` `; -export const PROCESS_PANEL_HEADER_NO_OVERRIDE_EXPECTED = ` +export const PROCESS_PANEL_HEADER_SLOT_TAKES_PRIORITY_EXPECTED = `