@ecomfe/san-devhook
Advanced tools
Comparing version 0.0.3 to 0.0.4
ChangeLog | ||
======== | ||
0.0.4 | ||
------- | ||
- [ADD] | ||
- Export initHook function for `__san_devtool__`. | ||
- A browser test. | ||
0.0.3 | ||
@@ -5,0 +13,0 @@ ------- |
{ | ||
"name": "@ecomfe/san-devhook", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "Hook for san-devtool.", | ||
@@ -18,3 +18,4 @@ "keywords": [ | ||
"build": "cross-env NODE_ENV=production webpack --progress --hide-modules", | ||
"chrome": "cross-env NODE_ENV=chrome_ext webpack --hide-modules --progress && node ./tests/run_chrome_ext.js" | ||
"chrome": "cross-env NODE_ENV=chrome_ext webpack --hide-modules --progress && node ./tests/run_chrome_ext.js", | ||
"browser": "cross-env NODE_ENV=production webpack --hide-modules --progress && node ./tests/browser.js" | ||
}, | ||
@@ -43,2 +44,4 @@ "devDependencies": { | ||
"html-webpack-plugin": "^2.26.0", | ||
"san": "^3.5.5", | ||
"san-store": "^1.1.0", | ||
"webpack": "^2.7.0", | ||
@@ -45,0 +48,0 @@ "webpack-dev-server": "^2.2.0", |
@@ -48,2 +48,3 @@ # San-DevHook | ||
- _config: User configuration. Please see the section above. | ||
- initHook: initHook function. Please see the section above. | ||
- data: Whole component tree. | ||
@@ -61,3 +62,4 @@ - history: San event history. | ||
## Run extension test | ||
## Tests | ||
### Run extension test | ||
``` | ||
@@ -67,1 +69,6 @@ $ npm run chrome | ||
And open a page using San. | ||
### Run browser test | ||
``` | ||
$ npm run browser | ||
``` |
@@ -28,3 +28,3 @@ { | ||
"host_entry.js", | ||
"invasion.js", | ||
"san_devhook.js", | ||
"devtool_background.html", | ||
@@ -37,3 +37,3 @@ "popup.html" | ||
"init.js", | ||
"invasion.js" | ||
"san_devhook.js" | ||
], | ||
@@ -40,0 +40,0 @@ "run_at": "document_start" |
@@ -9,4 +9,13 @@ /** | ||
import {getDevtoolNS} from './utils'; | ||
/*eslint-disable*/ | ||
export function setInitHook(func) { | ||
const ns = getDevtoolNS(); | ||
if (ns) { | ||
ns.initHook = func; | ||
} | ||
} | ||
export function installSanHook(global) { | ||
@@ -13,0 +22,0 @@ const ns = SAN_DEVTOOL; |
@@ -11,3 +11,3 @@ /** | ||
import {getContext, CONTEXT_TYPE} from './context'; | ||
import {installSanHook} from './hook'; | ||
import {installSanHook, setInitHook} from './hook'; | ||
import {fromContentScript, fromExtensionUrlSync} from './injector'; | ||
@@ -57,2 +57,3 @@ import {addSanEventListeners, addStoreEventListeners} from './listeners'; | ||
install(); | ||
setInitHook(initHook); | ||
@@ -59,0 +60,0 @@ // Auto hook |
@@ -1,3 +0,44 @@ | ||
import {initHook} from '../../san-devhook'; | ||
#!/usr/bin/env node | ||
initHook(); | ||
/** | ||
* San DevHook | ||
* Copyright 2017 Baidu Inc. All rights reserved. | ||
* | ||
* @file Extension test. | ||
*/ | ||
var path = require('path'); | ||
var chromeKiller = require('chrome-killer'); | ||
var chromeLauncher = require('chrome-launcher'); | ||
function killChromeIfNeeded(argv, promise) { | ||
return argv.kill | ||
? chromeKiller({ | ||
includingMainProcess: true, | ||
instancePath: argv.chromePath | ||
}).then(function() { | ||
return promise; | ||
}) | ||
: promise; | ||
} | ||
var argv = { | ||
directory: __dirname, | ||
url: path.resolve(__dirname, '..', 'resources', 'browser', 'index.html') | ||
}; | ||
var launcherOptions = { | ||
port: argv.port, | ||
enableExtensions: true, | ||
handleSIGINT: argv.forceQuit, | ||
chromePath: argv.chromePath, | ||
startingUrl: argv.url | ||
} | ||
killChromeIfNeeded(argv, chromeLauncher.launch(launcherOptions)) | ||
.then(function() { | ||
console.log(' > san-devhook loaded.'); | ||
console.log(' > Please check the newly opened Chrome/Chromium window.'); | ||
} | ||
); |
@@ -46,5 +46,5 @@ #!/usr/bin/env node | ||
.then(function() { | ||
console.log(' > san-devtool-hook-test loaded.'); | ||
console.log(' > san-devhook loaded.'); | ||
console.log(' > Please check the newly opened Chrome/Chromium window.'); | ||
} | ||
); |
@@ -34,3 +34,2 @@ /** | ||
entry: { | ||
'invasion.js': './src/invasion.js', | ||
'host_entry.js': './src/host_entry.js' | ||
@@ -42,3 +41,3 @@ } | ||
entry: { | ||
'invasion.js': './src/invasion.js' | ||
'san_devhook.js': './src/invasion.js' | ||
}, | ||
@@ -45,0 +44,0 @@ output: { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
299300
45
7877
72
26
3