Skip to content

Commit

Permalink
chore: Merge branch 'main' of https://github.com/web-infra-dev/garfish
Browse files Browse the repository at this point in the history
  • Loading branch information
danpeen committed Jan 24, 2024
2 parents 1233f4f + bd8a4b1 commit 029766d
Show file tree
Hide file tree
Showing 29 changed files with 296 additions and 235 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
"workspace-tools": "0.16.2",
"zx": "4.2.0"
},
"version": "1.17.1",
"version": "1.17.2",
"packageManager": "[email protected]",
"engines": {
"node": ">=16.14.0"
Expand Down
5 changes: 3 additions & 2 deletions packages/bridge-react-v18/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@garfish/bridge-react-v18",
"version": "1.17.1",
"version": "1.17.2",
"description": "garfish module.",
"keywords": [
"garfish",
Expand All @@ -22,7 +22,8 @@
"exports": {
".": {
"import": "./dist/esm/index.js",
"require": "./dist/index.js"
"require": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"./*": "./*"
},
Expand Down
5 changes: 3 additions & 2 deletions packages/bridge-react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@garfish/bridge-react",
"version": "1.17.1",
"version": "1.17.2",
"description": "garfish module.",
"keywords": [
"garfish",
Expand All @@ -22,7 +22,8 @@
"exports": {
".": {
"import": "./dist/esm/index.js",
"require": "./dist/index.js"
"require": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"./*": "./*"
},
Expand Down
5 changes: 3 additions & 2 deletions packages/bridge-vue-v2/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@garfish/bridge-vue-v2",
"version": "1.17.1",
"version": "1.17.2",
"description": "garfish vue bridge for v2.",
"keywords": [
"garfish",
Expand All @@ -23,7 +23,8 @@
"exports": {
".": {
"import": "./dist/esm/index.js",
"require": "./dist/index.js"
"require": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"./*": "./*"
},
Expand Down
5 changes: 3 additions & 2 deletions packages/bridge-vue-v3/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@garfish/bridge-vue-v3",
"version": "1.17.1",
"version": "1.17.2",
"description": "garfish vue bridge for v3.",
"keywords": [
"garfish",
Expand All @@ -23,7 +23,8 @@
"exports": {
".": {
"import": "./dist/esm/index.js",
"require": "./dist/index.js"
"require": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"./*": "./*"
},
Expand Down
5 changes: 3 additions & 2 deletions packages/browser-snapshot/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@garfish/browser-snapshot",
"version": "1.17.1",
"version": "1.17.2",
"description": "browser-snapshot module.",
"keywords": [
"garfish",
Expand All @@ -19,7 +19,8 @@
"exports": {
".": {
"import": "./dist/esm/index.js",
"require": "./dist/index.js"
"require": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"./*": "./*"
},
Expand Down
5 changes: 3 additions & 2 deletions packages/browser-vm/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@garfish/browser-vm",
"version": "1.17.1",
"version": "1.17.2",
"description": "vm-sandbox module.",
"keywords": [
"garfish",
Expand All @@ -19,7 +19,8 @@
"exports": {
".": {
"import": "./dist/esm/index.js",
"require": "./dist/index.js"
"require": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"./*": "./*"
},
Expand Down
3 changes: 2 additions & 1 deletion packages/browser-vm/src/dynamicNode/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ export function makeElInjector(sandboxConfig: SandboxOptions) {

if (typeof window.Element === 'function') {
// iframe can read html container this can't point to proxyDocument has Illegal invocation error
if (sandboxConfig.fixBaseUrl) safeWrapper(() => handleOwnerDocument());
if (sandboxConfig.fixBaseUrl || sandboxConfig.fixOwnerDocument)
safeWrapper(() => handleOwnerDocument());
const rewrite = (
methods: Array<string>,
builder: typeof injector | typeof injectorRemoveChild,
Expand Down
4 changes: 3 additions & 1 deletion packages/browser-vm/src/pluginify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,13 @@ function createOptions(Garfish: interfaces.Garfish) {
fixStaticResourceBaseUrl: Boolean(
appInfo.sandbox?.fixStaticResourceBaseUrl,
),
fixOwnerDocument: Boolean(appInfo.sandbox?.fixOwnerDocument),
disableWith: Boolean(appInfo.sandbox?.disableWith),
disableElementtiming: Boolean(appInfo.sandbox?.disableElementtiming),
strictIsolation: Boolean(appInfo.sandbox?.strictIsolation),
// 缓存模式,不收集副作用
disableCollect: appInfo.cache === undefined ? true : Boolean(appInfo.cache),
disableCollect:
appInfo.cache === undefined ? true : Boolean(appInfo.cache),
el: () => appInstance.htmlNode,
styleScopeId: () => appInstance.appContainer.id,
protectVariable: () => appInfo.protectVariable || [],
Expand Down
6 changes: 6 additions & 0 deletions packages/browser-vm/src/proxyInterceptor/document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ export function createGetter(sandbox: Sandbox) {
const el = value.call(document, tagName, options);
return setSandboxRef(el);
};
}
if (p === 'createElementNS') {
return function (...args) {
const el = value.call(document, ...args);
return setSandboxRef(el);
};
} else if (p === 'createTextNode') {
return function (data) {
const el = value.call(document, data);
Expand Down
1 change: 1 addition & 0 deletions packages/browser-vm/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export interface SandboxOptions {
namespace: string;
baseUrl?: string;
fixBaseUrl?: boolean;
fixOwnerDocument?: boolean;
fixStaticResourceBaseUrl?: boolean;
disableWith?: boolean;
strictIsolation?: boolean;
Expand Down
5 changes: 3 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@garfish/core",
"version": "1.17.1",
"version": "1.17.2",
"description": "core module.",
"keywords": [
"garfish",
Expand All @@ -20,7 +20,8 @@
"exports": {
".": {
"import": "./dist/esm/index.js",
"require": "./dist/index.js"
"require": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"./*": "./*"
},
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ export const createDefaultOptions = () => {
disableWith: false,
strictIsolation: false,
disableElementtiming: false,
fixOwnerDocument: false,
},
// global hooks
beforeLoad: () => {},
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export namespace interfaces {
disableWith?: boolean;
strictIsolation?: boolean;
disableElementtiming?: boolean;
fixOwnerDocument?: boolean;
}

export interface Config {
Expand Down
5 changes: 3 additions & 2 deletions packages/css-scope/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@garfish/css-scope",
"version": "1.17.1",
"version": "1.17.2",
"description": "css scope",
"keywords": [
"garfish",
Expand All @@ -19,7 +19,8 @@
"exports": {
".": {
"import": "./dist/esm/index.js",
"require": "./dist/index.js"
"require": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"./*": "./*"
},
Expand Down
5 changes: 3 additions & 2 deletions packages/es-module/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@garfish/es-module",
"version": "1.17.1",
"version": "1.17.2",
"description": "es module polyfill",
"keywords": [
"garfish",
Expand All @@ -19,7 +19,8 @@
"exports": {
".": {
"import": "./dist/esm/index.js",
"require": "./dist/index.js"
"require": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"./*": "./*"
},
Expand Down
5 changes: 3 additions & 2 deletions packages/garfish/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "garfish",
"version": "1.17.1",
"version": "1.17.2",
"description": "garfish module.",
"keywords": [
"garfish",
Expand All @@ -19,7 +19,8 @@
"exports": {
".": {
"import": "./dist/esm/index.js",
"require": "./dist/index.js"
"require": "./dist/index.js",
"types": "./index.d.ts"
},
"./*": "./*"
},
Expand Down
5 changes: 3 additions & 2 deletions packages/hooks/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@garfish/hooks",
"version": "1.17.1",
"version": "1.17.2",
"description": "hooks module.",
"keywords": [
"garfish",
Expand All @@ -12,7 +12,8 @@
"exports": {
".": {
"import": "./dist/esm/index.js",
"require": "./dist/index.js"
"require": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"./*": "./*"
},
Expand Down
5 changes: 3 additions & 2 deletions packages/loader/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@garfish/loader",
"version": "1.17.1",
"version": "1.17.2",
"description": "loader module.",
"keywords": [
"garfish",
Expand All @@ -19,7 +19,8 @@
"exports": {
".": {
"import": "./dist/esm/index.js",
"require": "./dist/index.js"
"require": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"./*": "./*"
},
Expand Down
5 changes: 3 additions & 2 deletions packages/remote-module/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@garfish/remote-module",
"version": "1.17.1",
"version": "1.17.2",
"description": "remote-module module.",
"keywords": [
"garfish",
Expand All @@ -19,7 +19,8 @@
"exports": {
".": {
"import": "./dist/esm/index.js",
"require": "./dist/index.js"
"require": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"./*": "./*"
},
Expand Down
5 changes: 3 additions & 2 deletions packages/router/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@garfish/router",
"version": "1.17.1",
"version": "1.17.2",
"description": "router module.",
"keywords": [
"garfish",
Expand All @@ -19,7 +19,8 @@
"exports": {
".": {
"import": "./dist/esm/index.js",
"require": "./dist/index.js"
"require": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"./*": "./*"
},
Expand Down
5 changes: 3 additions & 2 deletions packages/test-suite/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@garfish/test-suite",
"version": "1.17.1",
"version": "1.17.2",
"description": "garfish test suite.",
"keywords": [
"garfish",
Expand All @@ -19,7 +19,8 @@
"exports": {
".": {
"import": "./dist/esm/index.js",
"require": "./dist/index.js"
"require": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"./*": "./*"
},
Expand Down
5 changes: 3 additions & 2 deletions packages/utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@garfish/utils",
"version": "1.17.1",
"version": "1.17.2",
"description": "utils module.",
"keywords": [
"garfish",
Expand All @@ -19,7 +19,8 @@
"exports": {
".": {
"import": "./dist/esm/index.js",
"require": "./dist/index.js"
"require": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"./*": "./*"
},
Expand Down
Loading

0 comments on commit 029766d

Please sign in to comment.