Skip to content

Commit

Permalink
fix(css-scope): fix cache bug
Browse files Browse the repository at this point in the history
  • Loading branch information
imtaotao committed Mar 11, 2022
1 parent 8d232f5 commit 626c49e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 11 deletions.
2 changes: 0 additions & 2 deletions dev/app-main/public/index.html
Expand Up @@ -32,8 +32,6 @@
</style>
</head>
<body>
<!-- <script src="https://cdn.jsdelivr.net/npm/hash-wasm@4/dist/md5.umd.min.js"></script> -->
<script src="https://cdn.jsdelivr.net/npm/hash-wasm@4"></script>
<div id="root"></div>
</body>
</html>
5 changes: 3 additions & 2 deletions dev/app-main/src/config.ts
Expand Up @@ -10,9 +10,12 @@ type RunInfo = NonNullable<Parameters<typeof GarfishInstance.run>[0]>;
(window as any).__GARFISH_PARENT__ = true;

let defaultConfig: RunInfo = {
apps: localApps,

// 子应用的基础路径,默认值为 /,整个微前端应用的 basename。
// 设置后该值为所有子应用的默认值,若子应用 AppInfo 中也提供了该值会替换全局的 basename 值
basename,

// 子应用的挂载点,提供 string 类型时需要其值是 selector,Garfish 内部会使用 document.querySelector(domGetter) 去选中子应用的挂载点。
// 当提供函数时,子应用在路由驱动挂载和手动挂载时将会执行该函数并且期望返回一个 dom 元素。设置后该值为所有子应用的默认值,若子应用 AppInfo 中也提供了该值会替换全局的 domGetter
domGetter: '#submodule',
Expand All @@ -21,8 +24,6 @@ let defaultConfig: RunInfo = {
// 预加载加载权重会根据子应用的加载次数,预加载会在用户端计算子应用打开的次数,会优先加载打开次数多的子应用
disablePreloadApp: false,

apps: localApps,

// sandbox用于配置子应用沙箱的运行参数,当配置 sandbox 为 false 时表示关闭沙箱
sandbox: {
// strictIsolation 表明是否开启开启严格隔离,开启严格隔离后,子应用的渲染节点将会开启 Shadow DOM close 模式,
Expand Down
1 change: 0 additions & 1 deletion dev/app-main/src/constant.ts
Expand Up @@ -21,7 +21,6 @@ export const localApps: AppInfo = [
name: 'react16',
activeWhen: '/react16',
entry: getProxyHost(portMap['dev/react16'].port),
cache: false,
},
{
name: 'vue3',
Expand Down
9 changes: 3 additions & 6 deletions packages/css-scope/src/animation.ts
Expand Up @@ -263,14 +263,11 @@ export function processAnimation(input: string, prefix: string) {
return codeCache.get(etag);
}

const tokens = tokenizer(input);
// If the syntax is incorrect, just return to the original text
if (tokens === false) {
return input;
}

let tree = treeCache.get(input);
if (!tree) {
const tokens = tokenizer(input);
// If the syntax is incorrect, just return to the original text
if (tokens === false) return input;
tree = parse(tokens);
treeCache.set(input, tree);
}
Expand Down

0 comments on commit 626c49e

Please sign in to comment.