Skip to content

Commit

Permalink
test: 预计将 Mobx 作为 Mirror 的基础框架
Browse files Browse the repository at this point in the history
  • Loading branch information
KonghaYao committed Jul 30, 2021
1 parent c7e67fd commit 9fe23b2
Show file tree
Hide file tree
Showing 10 changed files with 137 additions and 109 deletions.
5 changes: 4 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ module.exports = {
extends: ['eslint:recommended', 'prettier', 'google'],
parser: '@babel/eslint-parser',
parserOptions: {
ecmaVersion: 12,
ecmaVersion: latest,
sourceType: 'module',
requireConfigFile: false,
ecmaFeatures: {
experimentalDecorators: true,
},
},
globals: {
__version__: true,
Expand Down
13 changes: 1 addition & 12 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,5 @@
"singleQuote": true,
"semi": true,
"trailingComma": "all",
"bracketSpacing": true,
"overrides": [
{
"files": [
"FakeServer/**/*.{ts,json,md,yml,js}",
"plugins/**/*.{ts,json,md,yml,js}",
"src/**/*.{ts,json,md,yml,js}",
"tools/**/*.{ts,json,md,yml,js}",
"docs/**/*.{md}"
]
}
]
"bracketSpacing": true
}
4 changes: 2 additions & 2 deletions FakeServer/ajax/fetch/fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ async function fakeFetch(url, options = {}) {
const result = await config.proxy(url, options);
if (result) {
if (!config.silent) console.warn('fetch: mock代理中');
const { body, options = {} } = result;
return new fakeResponse(body, options);
const { body, headers } = result;
return new fakeResponse(body, { headers });
}
}

Expand Down
2 changes: 1 addition & 1 deletion FakeServer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@konghayao/fake-server",
"version": "0.0.2",
"version": "0.1.0",
"description": "",
"main": "dist/index.js",
"scripts": {
Expand Down
5 changes: 5 additions & 0 deletions docs/_sidebar.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- [JSpider 介绍]()
- [JSpider 教程]()
- [JSpider 使用]()
- [JSpider 理解]()
- [JSpider FAQ]()
176 changes: 91 additions & 85 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,103 +1,109 @@
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="UTF-8" />
<title>JSpider 3</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="description" content="Description" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0" />
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/combine/npm/docsify@4/lib/themes/vue.css,npm/prism-themes/themes/prism-material-light.min.css"
/>
<link rel="stylesheet" href="./docs/assets/fonts.css" />
<link rel="stylesheet" href="https://unpkg.com/docsify-gifcontrol/dist/docsify-gifcontrol.css" />
<link rel="stylesheet" href="./docs/assets/googleIcon.css" />
<link rel="stylesheet" href="./docs/assets/index.css" />
</head>

<body>
<div id="app"></div>
</body>
<head>
<meta charset="UTF-8" />
<title>JSpider 3</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="description" content="Description" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0" />
<link rel="stylesheet"
href="https://cdn.jsdelivr.net/combine/npm/docsify@4/lib/themes/vue.css,npm/prism-themes/themes/prism-material-light.min.css" />
<link rel="stylesheet" href="./docs/assets/fonts.css" />
<link rel="stylesheet" href="https://unpkg.com/docsify-gifcontrol/dist/docsify-gifcontrol.css" />
<link rel="stylesheet" href="./docs/assets/googleIcon.css" />
<link rel="stylesheet" href="./docs/assets/index.css" />

<script src="https://cdn.jsdelivr.net/npm/docsify@4.12.1/lib/docsify.min.js"></script>

<script>
window.app = document.getElementById('app');
window.$docsify = {
name: 'JSpider',
repo: 'https://github.com/Konghayao/JSpider',
coverpage: true,
basePath: './docs/',
homepage: './zh-cn/README.md',

auto2top: true,
maxLevel: 3,
prettier: {
config: {
printWidth: 80,
tabWidth: 4,
useTabs: false,
endOfLine: 'auto',
singleQuote: true,
semi: true,
trailingComma: 'all',
bracketSpacing: true,
},
},
'cc-license': {
lang: 'zh', //zh en ja
commercial: 'y', // y or n 允许对您的作品进行商业性使用吗?
derivatives: 'y', // y or n or sa 允许您的作品的演绎作品被共享吗? sa 表示 是的,只要他人以相同方式共享
},
count: {
countable: true,
fontsize: '0.9em',
color: 'rgb(90,90,90)',
language: 'chinese',
</head>

<body>
<div id="app"></div>
</body>

<script src="https://cdn.jsdelivr.net/npm/docsify@4.12.1/lib/docsify.min.js"></script>

<script>
window.app = document.getElementById('app');
window.$docsify = {
name: 'JSpider',
repo: 'https://github.com/Konghayao/JSpider',
coverpage: true,
basePath: './docs/',
homepage: './zh-cn/README.md',

loadSidebar: true,
alias: {
'/.*/_sidebar.md': '/_sidebar.md',
},
subMaxLevel: 3,

sidebarDisplayLevel: 1,
auto2top: true,
maxLevel: 3,
prettier: {
config: {
printWidth: 80,
tabWidth: 4,
useTabs: false,
endOfLine: 'auto',
singleQuote: true,
semi: true,
trailingComma: 'all',
bracketSpacing: true,
},
},
'cc-license': {
lang: 'zh', //zh en ja
commercial: 'y', // y or n 允许对您的作品进行商业性使用吗?
derivatives: 'y', // y or n or sa 允许您的作品的演绎作品被共享吗? sa 表示 是的,只要他人以相同方式共享
},
count: {
countable: true,
fontsize: '0.9em',
color: 'rgb(90,90,90)',
language: 'chinese',
},

markdown: {
smartypants: true,
renderer: {
code: function (code, lang, ...args) {
if (lang === 'drawio') {
if (window.drawioConverter) {
console.log('drawio 转化中');
return window.drawioConverter(code);
} else {
return `<div class='drawio-code'>${code}</div>`;
}
markdown: {
smartypants: true,
renderer: {
code: function (code, lang, ...args) {
if (lang === 'drawio') {
if (window.drawioConverter) {
console.log('drawio 转化中');
return window.drawioConverter(code);
} else {
const prettyCode = window.codeFormatter(code, lang);
return this.origin.code.call(this, prettyCode, lang, ...args);
return `<div class='drawio-code'>${code}</div>`;
}
},
} else {
const prettyCode = window.codeFormatter(code, lang);
return this.origin.code.call(this, prettyCode, lang, ...args);
}
},
},
plugins: [
function (hook, vm) {
// parse twemoji
hook.doneEach(function () {
twemoji.parse(app);
});
},
],
};
</script>
},
plugins: [
],
};
</script>

<script type="module" src="https://cdn.jsdelivr.net/npm/docsify-cc-license/docsify-cc-license.min.js"></script>
<script type="module" src="https://cdn.jsdelivr.net/npm/docsify-cc-license/docsify-cc-license.min.js"></script>

<!-- drawio 的插件 -->
<script src="https://cdn.jsdelivr.net/combine/npm/docsify-drawio/viewer.min.js,npm/docsify-drawio/drawio.min.js"></script>
<!-- drawio 的插件 -->
<script
src="https://cdn.jsdelivr.net/combine/npm/docsify-drawio/viewer.min.js,npm/docsify-drawio/drawio.min.js"></script>

<!-- prettier 的插件 -->
<script src="https://cdn.jsdelivr.net/combine/npm/prettier/standalone.js,npm/prettier@2.3.2/parser-postcss.js,npm/prettier@2.3.2/parser-babel.js,npm/prettier@2.3.2/parser-html.js,npm/docsify-prettier/prettier.min.js"></script>
<!-- prettier 的插件 -->
<script
src="https://cdn.jsdelivr.net/combine/npm/prettier/standalone.js,npm/prettier@2.3.2/parser-postcss.js,npm/prettier@2.3.2/parser-babel.js,npm/prettier@2.3.2/parser-html.js,npm/docsify-prettier/prettier.min.js"></script>

<!-- 其他插件 -->
<script src="https://cdn.jsdelivr.net/combine/npm/docsify/lib/plugins/search.min.js,npm/docsify/lib/plugins/emoji.min.js,npm/docsify/lib/plugins/zoom-image.min.js,npm/docsify-copy-code/dist/docsify-copy-code.min.js,npm/docsify-pangu/lib/pangu.min.js"></script>
<script src="https://unpkg.com/docsify-count/dist/countable.js"></script>
<script src="https://unpkg.com/docsify-gifcontrol/dist/docsify-gifcontrol.js"></script>
<!-- 其他插件 -->
<script
src="https://cdn.jsdelivr.net/combine/npm/docsify/lib/plugins/search.min.js,npm/docsify/lib/plugins/emoji.min.js,npm/docsify/lib/plugins/zoom-image.min.js,npm/docsify-copy-code/dist/docsify-copy-code.min.js,npm/docsify-pangu/lib/pangu.min.js,npm/docsify-count/dist/countable.js"></script>
<script src="https://unpkg.com/docsify-gifcontrol/dist/docsify-gifcontrol.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify-sidebar-collapse/dist/docsify-sidebar-collapse.min.js"></script>
<script type="module" src="./docs/assets/index.js"></script>

<script type="module" src="./docs/assets/index.js"></script>
</html>
24 changes: 24 additions & 0 deletions test/modules.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"imports": {
"mobx": "https://ga.jspm.io/npm:mobx@6.3.2/dist/mobx.esm.js",
"lodash": "https://ga.jspm.io/npm:lodash@4.17.21/lodash.js",
"mitt": "https://ga.jspm.io/npm:mitt@3.0.0/dist/mitt.mjs",
"redux": "https://ga.jspm.io/npm:redux@4.1.0/lib/dev.redux.js",
"rxjs": "https://ga.jspm.io/npm:rxjs@6.6.6/index.js",
"rxjs/operators": "https://ga.jspm.io/npm:rxjs@6.6.6/operators/index.js",
"redux-saga": "https://ga.jspm.io/npm:redux-saga@1.1.3/dist/redux-saga-core-npm-proxy.cjs.js",
"redux-thunk": "https://ga.jspm.io/npm:redux-thunk@2.3.0/lib/index.js"
},
"scopes": {
"https://ga.jspm.io/": {
"@babel/runtime/helpers/extends": "https://ga.jspm.io/npm:@babel/runtime@7.14.8/helpers/extends.js",
"@babel/runtime/helpers/objectSpread2": "https://ga.jspm.io/npm:@babel/runtime@7.14.8/helpers/objectSpread2.js",
"@babel/runtime/helpers/objectWithoutPropertiesLoose": "https://ga.jspm.io/npm:@babel/runtime@7.14.8/helpers/objectWithoutPropertiesLoose.js",
"@redux-saga/core": "https://ga.jspm.io/npm:@redux-saga/core@1.1.3/dist/dev.redux-saga-core.cjs.js",
"@redux-saga/deferred": "https://ga.jspm.io/npm:@redux-saga/deferred@1.1.2/dist/redux-saga-deferred.cjs.js",
"@redux-saga/delay-p": "https://ga.jspm.io/npm:@redux-saga/delay-p@1.1.2/dist/redux-saga-delay-p.cjs.js",
"@redux-saga/is": "https://ga.jspm.io/npm:@redux-saga/is@1.1.2/dist/redux-saga-is.cjs.js",
"@redux-saga/symbols": "https://ga.jspm.io/npm:@redux-saga/symbols@1.1.2/dist/redux-saga-symbols.cjs.js"
}
}
}
3 changes: 3 additions & 0 deletions test/test-redux.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class a {
@getFunc a = 2;
}
1 change: 1 addition & 0 deletions test/test.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
deno run --import-map modules.json -A ./test.js
13 changes: 5 additions & 8 deletions test/test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
const mitt = require('mitt');
const { EMPTY, iif, of, from, pipe, fromEventPattern, timer, interval, Observable } = require('rxjs');
const { Subscription } = require('rxjs');

const { noop } = require('rxjs');
const {
// 使用 deno 测试一些 rxjs 相关的东西
import mitt from 'mitt';
import { EMPTY, iif, of, from, pipe, fromEventPattern, timer, interval, Observable, noop, Subscription } from 'rxjs';
import {
map,
switchMap,
mergeAll,
Expand All @@ -24,8 +22,7 @@ const {
takeUntil,
switchMapTo,
exhaustMap,
concat,
} = require('rxjs/operators');
} from 'rxjs/operators';
const emitter = mitt();
const pause$ = fromEventPattern((handle) => emitter.on('pause', handle));

Expand Down

0 comments on commit 9fe23b2

Please sign in to comment.