New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

browserify-loader

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

browserify-loader - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

2

bower.json
{
"name": "browserify-loader",
"main": "browserify-loader.js",
"version": "0.1.0",
"version": "0.1.1",
"homepage": "https://github.com/island205/browserify-loader",

@@ -6,0 +6,0 @@ "authors": [

{
"name": "browserify-loader",
"version": "0.1.0",
"version": "0.1.1",
"description": "Another CommonJS Loader",

@@ -21,3 +21,3 @@ "main": "test/bar.js",

"author": "island205@gmail.com",
"license": "ISC",
"license": "MIT",
"bugs": {

@@ -27,3 +27,3 @@ "url": "https://github.com/island205/browserify-loader/issues"

"homepage": "https://github.com/island205/browserify-loader",
"dependencies": {
"devDependencies": {
"path-browserify": "0.0.0",

@@ -30,0 +30,0 @@ "rsvp": "^3.0.12",

@@ -1,2 +0,66 @@

browserify-loader
# browserify-loader
=================
A CommonJS Loader for browserify workflow.
## What is browserify-loader
`browserify-loader` is another CommonJS loader for browserify workflow. With BL, You don’t need any tools like watchify, browserify-middleware to auto build and serve bundle *js in development env.
`browserify-loader` is similar with [requirejs](http://requirejs.org/), but:
- follow [Modules/1.1.1](http://wiki.commonjs.org/wiki/Modules/1.1.1) like [Node](http://nodejs.org/)
- get rid of wrapper code like `define()`
- be compatible all `npm` package and all `bower` components witch support `CommonJS`. like `underscore`, `backbone`, `jQuery` and so on.
## Getting start
### install
Download `browserify-loader` with `npm` or `bower`:
```bash
$ npm install browserify-loader
```
Put `browserify-loader.js` in your page:
```html
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<script type="text/javascript"
src="node_modules/browserify-loader/browserify-loader.js"></script>
</body>
</html>
```
Then, `browserify-loader` will start to run for `main` file in your `package.json` file.
### options
`browserify-loader` has two options to specify the `main` script or `package` location.
```javascript
<script type="text/javascript"
id="bl-script"
main="backbone/app.js"
package="backbone/"
src="node_modules/browserify-loader/browserify-loader.js"></script>
```
- **main**: the main entrance script like `app.js` in `node app.js`
- **package** the location where `browserify-loader` to load `package.json`, then get the main entrance from `main` property.
> **main** 's priority is higher the **package** 's.
## example
Look into [todomvc-in-bl](https://github.com/island205/todomvc-in-bl) , which is a demo project based on [todomvc](https://github.com/tastejs/todomvc) to show how to use `browserify-loader`.

@@ -7,31 +7,42 @@ var xhr = require('xhr')

function loadMainModule(mainScriptUri) {
var mainModule = new Module(mainScriptUri)
mainModule.ee.on('loaded', function() {
mainModule.run()
})
mainModule.load()
}
function bootstrap() {
var blScript = document.getElementById('bl-script')
var package
if (blScript && (package = blScript.getAttribute('package'))) {
package = url.resolve(location.origin, package) + '/package.json'
var packagePath
var mainScriptPath
if (blScript) {
mainScriptPath = blScript.getAttribute('main')
packagePath = blScript.getAttribute('package')
} else {
packagePath = './'
}
else {
package = location.origin + '/package.json'
if (mainScriptPath) {
mainScriptPath = url.resolve(location.origin, mainScriptPath)
loadMainModule(mainScriptPath)
} else {
packagePath = url.resolve(url.resolve(location.origin, packagePath), './package.json')
xhr({
uri: packagePath,
headers: {
"Content-Type": "application/json"
}
}, function(err, resp, body) {
if (err) {
throw (err)
}
var pkg = JSON.parse(body)
mainScriptPath = pkg.main || 'index.js'
mainScriptPath = url.resolve(packagePath, mainScriptPath)
loadMainModule(mainScriptPath)
})
}
xhr({
uri: package,
headers: {
"Content-Type": "application/json"
}
}, function(err, resp, body) {
if (err) {
throw (err)
}
var pkg = JSON.parse(body)
var mainScriptPath = pkg.main || 'index.js'
var mainScriptUri = url.resolve(package, mainScriptPath)
var mainModule = new Module(mainScriptUri)
mainModule.ee.on('loaded', function() {
mainModule.run()
})
mainModule.load()
})
}
bootstrap()

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc