From 692b7f8e70bee5d33d22d619ad812c74a5d26a54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=A3=E5=90=92?= Date: Thu, 20 May 2021 15:31:39 +0800 Subject: [PATCH] Refact/spell (#275) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * refactor: modify letter spell (#273) Co-authored-by: Frank * refactor: 💡 change all sandboxContructor to sandboxConstructor * chore: 🤖 version * fix: 🐛 eval should not be bind (#302) * fix: 🐛 eval should not be bind ✅ Closes: https://github.com/alibaba/ice/issues/4294 * fix: 🐛 eventlistener should be store in this.eventListeners (#296) * fix: 🐛 eventlistener should be store in this.eventListeners ✅ Closes: #295 * test: 💍 add more tests ✅ Closes: #295 * refactor: 💡 compatible with spell error Co-authored-by: Zan Fu Co-authored-by: Frank --- CHANGELOG.md | 4 ++++ package.json | 2 +- packages/icestark-module/CHANGELOG.md | 4 ++++ packages/icestark-module/package.json | 2 +- packages/icestark-module/src/MicroModule.tsx | 2 +- packages/icestark-module/src/modules.tsx | 4 ++-- packages/icestark-module/tests/index.spec.tsx | 4 ++-- src/apps.ts | 4 ++-- src/util/handleAssets.ts | 4 ++-- 9 files changed, 19 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 413d250e..0844add4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ See [https://github.com/ice-lab/icestark/releases](https://github.com/ice-lab/icestark/releases) for what has changed in each version of icestark. +## 2.3.2 + +- [refact] compatible with sandbox spell error. + ## 2.3.1 - [fix] parse `library` the right way if `library` is an array. ([#287](https://github.com/ice-lab/icestark/issues/287)) diff --git a/package.json b/package.json index a2fcf41f..d7b2b694 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ice/stark", - "version": "2.3.1", + "version": "2.3.2", "description": "Icestark is a JavaScript library for multiple projects, Ice workbench solution.", "scripts": { "install:deps": "rm -rf node_modules && rm -rf ./packages/*/node_modules && yarn install && lerna exec -- npm install", diff --git a/packages/icestark-module/CHANGELOG.md b/packages/icestark-module/CHANGELOG.md index 9e36c33d..ec54bd92 100644 --- a/packages/icestark-module/CHANGELOG.md +++ b/packages/icestark-module/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 1.4.1 + +- [refact] compatible with sandbox spell error. + ## 1.4.0 - [feat] support local component when using ``. ([#205](https://github.com/ice-lab/icestark/issues/205)) diff --git a/packages/icestark-module/package.json b/packages/icestark-module/package.json index cf391cad..decf8dff 100644 --- a/packages/icestark-module/package.json +++ b/packages/icestark-module/package.json @@ -1,6 +1,6 @@ { "name": "@ice/stark-module", - "version": "1.4.0", + "version": "1.4.1", "description": "toolkit for load standard micro-module", "main": "lib/index.js", "scripts": { diff --git a/packages/icestark-module/src/MicroModule.tsx b/packages/icestark-module/src/MicroModule.tsx index e787e27a..f336ddaf 100644 --- a/packages/icestark-module/src/MicroModule.tsx +++ b/packages/icestark-module/src/MicroModule.tsx @@ -19,7 +19,7 @@ interface State { } /** - * default render compoent, mount all modules + * default render component, mount all modules */ export default class MicroModule extends React.Component { private moduleInfo = null; diff --git a/packages/icestark-module/src/modules.tsx b/packages/icestark-module/src/modules.tsx index ba909121..828b30dd 100644 --- a/packages/icestark-module/src/modules.tsx +++ b/packages/icestark-module/src/modules.tsx @@ -1,4 +1,4 @@ -import Sandbox, { SandboxProps, SandboxContructor } from '@ice/sandbox'; +import Sandbox, { SandboxProps, SandboxConstructor } from '@ice/sandbox'; import ModuleLoader from './loader'; import { Runtime, parseRuntime, RuntimeInstance } from './runtimeHelper'; @@ -14,7 +14,7 @@ export interface StarkModule { unmount?: (targetNode: HTMLElement) => void; }; -export type ISandbox = boolean | SandboxProps | SandboxContructor; +export type ISandbox = boolean | SandboxProps | SandboxConstructor; let globalModules = []; let importModules = {}; diff --git a/packages/icestark-module/tests/index.spec.tsx b/packages/icestark-module/tests/index.spec.tsx index 2dde8520..f06c7308 100644 --- a/packages/icestark-module/tests/index.spec.tsx +++ b/packages/icestark-module/tests/index.spec.tsx @@ -4,7 +4,7 @@ import '@testing-library/jest-dom/extend-expect'; import { render } from '@testing-library/react'; import * as fs from 'fs'; import * as path from 'path'; -import Sandbox, { SandboxContructor } from '@ice/sandbox'; +import Sandbox, { SandboxConstructor } from '@ice/sandbox'; import { getModules, @@ -133,7 +133,7 @@ describe('render modules', () => { test('mountModule with custom sandbox', (next) => { const moduleInfo = { name: 'customSandbox', url: '//localhost', mount: defaultMount, unmount: defaultUnmount }; const div = document.createElement('div'); - mountModule(moduleInfo, div, {}, (Sandbox as SandboxContructor)); + mountModule(moduleInfo, div, {}, (Sandbox as SandboxConstructor)); setTimeout(() => { expect(div.innerHTML).toBe('

404

'); unmoutModule(moduleInfo, div); diff --git a/src/apps.ts b/src/apps.ts index aadf242a..d4ed5231 100644 --- a/src/apps.ts +++ b/src/apps.ts @@ -1,4 +1,4 @@ -import Sandbox, { SandboxContructor, SandboxProps } from '@ice/sandbox'; +import Sandbox, { SandboxConstructor, SandboxProps } from '@ice/sandbox'; import * as isEmpty from 'lodash.isempty'; import { NOT_LOADED, NOT_MOUNTED, LOADING_ASSETS, UNMOUNTED, LOAD_ERROR, MOUNTED } from './util/constant'; import { matchActivePath, MatchOptions, PathData, PathOptions } from './util/matchPath'; @@ -29,7 +29,7 @@ export interface BaseConfig extends PathOptions { url?: string | string[]; container?: HTMLElement; status?: string; - sandbox?: boolean | SandboxProps | SandboxContructor; + sandbox?: boolean | SandboxProps | SandboxConstructor; entry?: string; entryContent?: string; /** diff --git a/src/util/handleAssets.ts b/src/util/handleAssets.ts index 1d85b7c0..3936a7a2 100644 --- a/src/util/handleAssets.ts +++ b/src/util/handleAssets.ts @@ -1,5 +1,5 @@ import * as urlParse from 'url-parse'; -import Sandbox, { SandboxProps, SandboxContructor } from '@ice/sandbox'; +import Sandbox, { SandboxProps, SandboxConstructor } from '@ice/sandbox'; import { PREFIX, DYNAMIC, STATIC, IS_CSS_REGEX } from './constant'; import { warn, error } from './message'; import { Fetch, defaultFetch } from '../start'; @@ -515,7 +515,7 @@ export async function loadAndAppendJsAssets(assets: Assets, sandbox?: Sandbox, f ); } -export function createSandbox(sandbox?: boolean | SandboxProps | SandboxContructor) { +export function createSandbox(sandbox?: boolean | SandboxProps | SandboxConstructor) { // Create appSandbox if sandbox is active let appSandbox = null; if (sandbox) {