Skip to content

Commit

Permalink
perf(platform): defer load monaco-editor
Browse files Browse the repository at this point in the history
edit react-monaco-editor to meta3d-react-monaco-editor: add monaco param instead of dependent on it;

(refer to https://segmentfault.com/a/1190000041564651#item-5-1)
  • Loading branch information
yyc-git committed Dec 24, 2023
1 parent 7a3a02d commit 9751763
Show file tree
Hide file tree
Showing 33 changed files with 981 additions and 37 deletions.
24 changes: 18 additions & 6 deletions doc/1.0.0-beta.3.org
Original file line number Diff line number Diff line change
Expand Up @@ -212,22 +212,34 @@ pass bdd test

TODO wait for previous task

* DONE 优化:减小platform文件体积

refer to

* TODO 优化:减小engine-whole、editor-whole包体积
https://segmentfault.com/a/1190000041564651#item-5-1

TODO 延迟/预加载 monaco-editor

* TODO 优化:减小发布的app的大小

fix:
first load not show
onChange not work
theme

new value error
switch between action
# switch between input, action

* TODO 优化:减小platform文件体积

refer to
# * TODO guide: add end guide button


* TODO 优化:减小engine-whole、editor-whole包体积


* TODO 优化:减小发布的app的大小

https://segmentfault.com/a/1190000041564651#item-5-1

TODO 延迟/预加载 monaco-editor



Expand Down
3 changes: 3 additions & 0 deletions externals/meta3d-react-monaco-editor/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
example/node_modules
node_modules
src/*.js
45 changes: 45 additions & 0 deletions externals/meta3d-react-monaco-editor/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"extends": [
"prettier",
"airbnb",
"plugin:react/recommended",
"plugin:prettier/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json"
},
"plugins": ["react", "prettier", "@typescript-eslint", "react-hooks"],
"rules": {
"@typescript-eslint/ban-ts-comment": 0,
"@typescript-eslint/explicit-module-boundary-types": 0,
"@typescript-eslint/no-empty-function": 0,
"@typescript-eslint/no-explicit-any": 0,
"@typescript-eslint/no-unsafe-call": 0,
"@typescript-eslint/no-unsafe-member-access": 0,
"@typescript-eslint/no-unused-vars": 0,
"array-bracket-spacing": 0,
"camelcase": 0,
"comma-dangle": 0,
"import/extensions": 0,
"import/no-unresolved": 0,
"jsx-a11y/href-no-hash": 0,
"max-classes-per-file": 0,
"no-underscore-dangle": 0,
"prettier/prettier": 2,
"react/destructuring-assignment": 0,
"react/forbid-prop-types": 0,
"react/jsx-filename-extension": 0,
"react/jsx-no-undef": 2,
"react/jsx-uses-react": 1,
"react/static-property-placement": [2, "static public field"],
"semi": 0,
"valid-jsdoc": 2,
"no-use-before-define": "off",
"@typescript-eslint/no-use-before-define": ["error"],
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn"
}
}
25 changes: 25 additions & 0 deletions externals/meta3d-react-monaco-editor/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
*.iml
.idea/
.ipr
.iws
*.js
*~
~*
*.diff
*.patch
*.bak
.DS_Store
Thumbs.db
.project
.*proj
.svn/
*.swp
*.swo
*.pyc
*.pyo
node_modules
dist
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.vscode
11 changes: 11 additions & 0 deletions externals/meta3d-react-monaco-editor/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.eslintignore
.eslintrc
.github/
.gitignore
.npmignore
.travis.yml
.vscode/
/example/
/examples/
tsconfig.json
yarn-error.log
21 changes: 21 additions & 0 deletions externals/meta3d-react-monaco-editor/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2016-present Leon Shi

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
1 change: 1 addition & 0 deletions externals/meta3d-react-monaco-editor/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fork from https://github.com/react-monaco-editor/react-monaco-editor
Empty file.
1 change: 1 addition & 0 deletions externals/meta3d-react-monaco-editor/lib/diff.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 38 additions & 0 deletions externals/meta3d-react-monaco-editor/lib/editor.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import * as React from "react";
import { noop } from "./utils";
declare function MonacoEditor({ monaco, width, height, value, defaultValue, language, theme, options, overrideServices, editorWillMount, editorDidMount, editorWillUnmount, onChange, className, uri, }: {
monaco: any;
width: any;
height: any;
value: any;
defaultValue: any;
language: any;
theme: any;
options: any;
overrideServices: any;
editorWillMount: any;
editorDidMount: any;
editorWillUnmount: any;
onChange: any;
className: any;
uri: any;
}): React.JSX.Element;
declare namespace MonacoEditor {
var defaultProps: {
width: string;
height: string;
value: any;
defaultValue: string;
language: string;
theme: any;
options: {};
overrideServices: {};
editorWillMount: typeof noop;
editorDidMount: typeof noop;
editorWillUnmount: typeof noop;
onChange: typeof noop;
className: any;
};
var displayName: string;
}
export default MonacoEditor;
1 change: 1 addition & 0 deletions externals/meta3d-react-monaco-editor/lib/editor.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions externals/meta3d-react-monaco-editor/lib/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import MonacoEditor from "./editor";
export { MonacoEditor as default };
1 change: 1 addition & 0 deletions externals/meta3d-react-monaco-editor/lib/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file.
1 change: 1 addition & 0 deletions externals/meta3d-react-monaco-editor/lib/types.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions externals/meta3d-react-monaco-editor/lib/utils.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export declare function processSize(size: number | string): string | number;
export declare function noop(): void;
1 change: 1 addition & 0 deletions externals/meta3d-react-monaco-editor/lib/utils.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

55 changes: 55 additions & 0 deletions externals/meta3d-react-monaco-editor/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"name": "meta3d-react-monaco-editor",
"version": "0.0.1",
"description": "Monaco Editor for React",
"main": "lib/index.js",
"module": "lib/index",
"types": "lib/index.d.ts",
"scripts": {
"preversion": "npm run lint",
"build": "tsc",
"clean": "rimraf lib",
"format": "eslint --fix '{src,example}/**/*.{ts,tsx}'"
},
"keywords": [
"monaco",
"editor",
"react",
"vscode"
],
"authors": [
"Daniele Esposti <daniele.espsoti@gmail.com>",
"Dominik Moritz <domoritz@cs.washington.edu>",
"Leon Shi <superRaytin@gmail.com>"
],
"license": "MIT",
"bugs": {
"url": "https://github.com/react-monaco-editor/react-monaco-editor/issues"
},
"homepage": "https://github.com/react-monaco-editor/react-monaco-editor",
"repository": "https://github.com/react-monaco-editor/react-monaco-editor",
"devDependencies": {
"@types/react": "^18.2.18",
"@typescript-eslint/eslint-plugin": "^6.2.1",
"@typescript-eslint/parser": "^6.2.1",
"eslint": "^8.46.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-prettier": "^8.9.0",
"eslint-plugin-import": "^2.28.0",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-react": "^7.33.1",
"eslint-plugin-react-hooks": "^4.6.0",
"prettier": "^3.0.0",
"react": "^18.2.0",
"rimraf": "^5.0.1",
"typescript": "^5.1.6"
},
"peerDependencies": {
"@types/react": ">=16 <= 18",
"react": ">=16 <= 18"
},
"dependencies": {
"prop-types": "^15.8.1"
}
}
Loading

0 comments on commit 9751763

Please sign in to comment.