pax_global_header00006660000000000000000000000064126327100230014506gustar00rootroot0000000000000052 comment=9b7f0590a10569078b1b3b5c33f201f0a59d9822 domain-browser-1.1.7/000077500000000000000000000000001263271002300144445ustar00rootroot00000000000000domain-browser-1.1.7/.editorconfig000066400000000000000000000004171263271002300171230ustar00rootroot00000000000000# 2014 June 8 # https://github.com/bevry/base root = true [*] end_of_line = lf charset = utf-8 trim_trailing_whitespace = false insert_final_newline = false indent_style = tab [*.json] indent_style = space indent_size = 2 [*.yml] indent_style = space indent_size = 2 domain-browser-1.1.7/.eslintrc.js000066400000000000000000000450151263271002300167100ustar00rootroot00000000000000// 2015 December 1 // https://github.com/bevry/base // http://eslint.org /* eslint no-warning-comments: 0 */ 'use strict' const IGNORE = 0, WARN = 1, ERROR = 2, MAX_PARAMS = 4 module.exports = { // parser: 'babel-eslint', // ^ the bundled ESLINT parser is now actually quite good, and supports the ecmaFeatures property ecmaFeatures: { // this property only works with the bundled ESLINT parser, not babel-eslint arrowFunctions: true, binaryLiterals: true, blockBindings: true, classes: true, defaultParams: true, destructuring: true, forOf: true, generators: true, modules: false, // Disabled due to https://twitter.com/balupton/status/671519915795345410 objectLiteralComputedProperties: true, objectLiteralDuplicateProperties: true, objectLiteralShorthandMethods: true, objectLiteralShorthandProperties: true, octalLiterals: true, regexUFlag: true, regexYFlag: true, restParams: true, spread: true, superInFunctions: true, templateStrings: true, unicodeCodePointEscapes: true, globalReturn: true, jsx: true, experimentalObjectRestSpread: true }, env: { browser: true, node: true, es6: true, commonjs: true, amd: true }, rules: { // ---------------------------- // Problems with these rules // If we can figure out how to enable the following, that would be great // Two spaces after one line if or else: // if ( blah ) return // Insead of one space: // if ( blah ) return // No spaces on embedded function: // .forEach(function(key, value){ // instead of: // .forEach(function (key, value) { // Else and catch statements on the same line as closing brace: // } else { // } catch (e) { // instead of: // } // else { // -------------------------------------- // Possible Errors // The following rules point out areas where you might have made mistakes. // ES6 supports dangling commas 'comma-dangle': IGNORE, // Don't allow assignments in conditional statements (if, while, etc.) 'no-cond-assign': [ERROR, 'always'], // Warn but don't error about console statements 'no-console': WARN, // Allow while(true) loops 'no-constant-condition': IGNORE, // Seems like a good idea to error about this 'no-control-regex': ERROR, // Warn but don't error about console statements 'no-debugger': WARN, // Don't allow duplicate arguments in a function, they can cause errors 'no-dupe-args': ERROR, // Disallow duplicate keys in an object, they can cause errors 'no-dupe-keys': ERROR, // Disallow duplicate case statements in a switch 'no-duplicate-case': ERROR, // Disallow empty [] in regular expressions as they cause unexpected behaviour 'no-empty-character-class': ERROR, // Allow empty block statements, they are useful for clarity 'no-empty': IGNORE, // Overwriting the exception argument in a catch statement can cause memory leaks in some browsers 'no-ex-assign': ERROR, // Disallow superflous boolean casts, they offer no value 'no-extra-boolean-cast': ERROR, // Allow superflous parenthesis as they offer clarity in some cases 'no-extra-parens': IGNORE, // Disallow superflous semicolons, they offer no value 'no-extra-semi': IGNORE, // Seems like a good idea to error about this 'no-func-assign': ERROR, // Seems like a good idea to error about this 'no-inner-declarations': ERROR, // Seems like a good idea to error about this 'no-invalid-regexp': ERROR, // Seems like a good idea to error about this 'no-irregular-whitespace': ERROR, // Seems like a good idea to error about this 'no-negated-in-lhs': ERROR, // Seems like a good idea to error about this 'no-obj-calls': ERROR, // Seems like a good idea to error about this // Instead of / / used / {ERROR}/ instead 'no-regex-spaces': ERROR, // Seems like a good idea to error about this 'no-sparse-arrays': ERROR, // Seems like a good idea to error about this 'no-unexpected-multiline': ERROR, // Seems like a good idea to error about this 'no-unreachable': ERROR, // Seems like a good idea to error about this 'use-isnan': ERROR, // We use YUIdoc, not JSDoc 'valid-jsdoc': IGNORE, // Seems like a good idea to error about this 'valid-typeof': ERROR, // -------------------------------------- // Best Practices // These are rules designed to prevent you from making mistakes. They either prescribe a better way of doing something or help you avoid footguns. // Meh 'accessor-pairs': IGNORE, // This rule seems buggy 'block-scoped-var': IGNORE, // Disable complexity checks, they are annoying and not that useful in detecting actual complexity 'complexity': IGNORE, // We use blank returns for break statements 'consistent-return': IGNORE, // Always require curly braces unless the statement is all on a single line 'curly': [ERROR, 'multi-line'], // If we don't have a default cause, it probably means we should throw an error 'default-case': ERROR, // Dots should be on the newlines // chainableThingy // .doSomething() // .doSomethingElse() 'dot-location': [ERROR, 'property'], // Use dot notation where possible 'dot-notation': ERROR, // Unless you are doing == null, then force === to avoid truthy/falsey mistakes 'eqeqeq': [ERROR, 'allow-null'], // Always use hasOwnProperty when doing for in 'guard-for-in': ERROR, // Warn about alert statements in our code // Use one of the suggested alternatives instead // Reasoning is they could be mistaken for left over debugging statements 'no-alert': WARN, // They are very slow 'no-caller': ERROR, // Wow... 'no-case-declarations': ERROR, // Seems like a good idea to error about this 'no-div-regex': ERROR, // Returns in else statements offer code clarity, so disable this rule 'no-else-return': IGNORE, // Seems like a good idea to error about this 'no-empty-label': ERROR, // Seems sensible 'no-empty-pattern': ERROR, // We know that == null is a null and undefined check 'no-eq-null': IGNORE, // Eval is slow and unsafe, use vm's instead 'no-eval': ERROR, // There is never a good reason for this 'no-extend-native': ERROR, // Don't allow useless binds 'no-extra-bind': ERROR, // Don't allow switch case statements to follow through, use continue keyword instead 'no-fallthrough': ERROR, // Use zero when doing decimals, otherwise it is confusing 'no-floating-decimal': ERROR, // Cleverness is unclear 'no-implicit-coercion': ERROR, // A sneaky way to do evals 'no-implied-eval': ERROR, // This throws for a lot of senseless things, like chainy functions 'no-invalid-this': IGNORE, // Use proper iterators instead 'no-iterator': ERROR, // We never use this, it seems silly to allow this 'no-labels': ERROR, // We never use this, it seems silly to allow this 'no-lone-blocks': ERROR, // Loop functions always cause problems, as the scope isn't clear through iterations 'no-loop-func': ERROR, // This is a great idea // Although ignore -1 and 0 as it is common with indexOf 'no-magic-numbers': [WARN, { ignore: [-1, 0] }], // We like multi spaces for clarity // E.g. We like // if ( blah ) return foo // Instead of: // if ( blah ) return foo // @TODO would be great to enforce the above 'no-multi-spaces': IGNORE, // Use ES6 template strings instead 'no-multi-str': ERROR, // Would be silly to allow this 'no-native-reassign': ERROR, // We never use this, it seems silly to allow this 'no-new-func': ERROR, // We never use this, it seems silly to allow this 'no-new-wrappers': ERROR, // We never use this, it seems silly to allow this 'no-new': ERROR, // We never use this, it seems silly to allow this 'no-octal-escape': ERROR, // We never use this, it seems silly to allow this 'no-octal': ERROR, // We got to be pretty silly if we don't realise we are doing this // As such, take any usage as intentional and aware 'no-param-reassign': IGNORE, // We use process.env wisely 'no-process-env': IGNORE, // We never use this, it seems silly to allow this 'no-proto': ERROR, // We never use this, it seems silly to allow this 'no-redeclare': ERROR, // We never use this, it seems silly to allow this 'no-return-assign': ERROR, // We never use this, it seems silly to allow this 'no-script-url': ERROR, // We never use this, it seems silly to allow this 'no-self-compare': ERROR, // We never use this, it seems silly to allow this 'no-sequences': ERROR, // We always want proper error objects as they have stack traces and respond to instanceof Error checks 'no-throw-literal': ERROR, // We never use this, it seems silly to allow this 'no-unused-expressions': ERROR, // Seems sensible 'no-useless-call': ERROR, // Seems sensible 'no-useless-concat': ERROR, // We never use this, it seems silly to allow this 'no-void': ERROR, // Warn about todos 'no-warning-comments': [WARN, { terms: ['todo', 'fixme'], location: 'anywhere' }], // We never use this, it seems silly to allow this 'no-with': ERROR, // Always specify a radix to avoid errors 'radix': ERROR, // We appreciate the clarity late defines offer 'vars-on-top': IGNORE, // Wrap instant called functions in parenthesis for clearer intent 'wrap-iife': ERROR, // Because we force === and never allow assignments in conditions // we have no need for yoda statements, so disable them 'yoda': [ERROR, 'never'], // -------------------------------------- // Strict Mode // These rules relate to using strict mode. // Ensure that use strict is specified to prevent the runtime erorr: // SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode 'strict': [ERROR, 'global'], // -------------------------------------- // Variables // These rules have to do with variable declarations. // We don't care 'init-declaration': IGNORE, // Don't allow the catch method to shadow objects as browsers handle this differently // Update: We don't care for IE8 'no-catch-shadow': IGNORE, // Don't use delete, it disables optimisations 'no-delete-var': ERROR, // We never use this, it seems silly to allow this 'no-label-var': ERROR, // We never use this, it seems silly to allow this 'no-shadow-restricted-names': ERROR, // We use shadowing 'no-shadow': IGNORE, // Makes sense 'no-undef-init': ERROR, // Error when an undefined variable is used 'no-undef': ERROR, // typeof blah === 'undefined' should always be used 'no-undefined': ERROR, // Warn us when we don't use something 'no-unused-vars': WARN, // Error when we try and use something before it is defined 'no-use-before-define': ERROR, // -------------------------------------- // Node.js and CommonJS // These rules are specific to JavaScript running on Node.js or using CommonJS in the browser. // Seems to difficult to enforce 'callback-return': IGNORE, // We use require where it is appropriate to use it 'global-require': IGNORE, // Force handling of callback errors 'handle-callback-err': ERROR, // @TODO decide if this is good or not 'no-mixed-requires': ERROR, // Disallow error prone syntax 'no-new-require': ERROR, // Always use path.join for windows support 'no-path-concat': ERROR, // We know what we are doing 'no-process-exit': IGNORE, // No need to disallow any modules 'no-restricted-modules': IGNORE, // Sometimes sync methods are useful, so warn but don't error 'no-sync': WARN, // -------------------------------------- // Stylistic // These rules are purely matters of style and are quite subjective. // We don't use spaces with brackets 'array-bracket-spacing': [ERROR, 'never'], // Disallow or enforce spaces inside of single line blocks 'block-spacing': [ERROR, 'always'], // Opening brace on same line, closing brace on its own line, except when statement is a single line 'brace-style': [ERROR, 'stroustrup', { allowSingleLine: true }], // Use camel case 'camelcase': ERROR, // Require a comma after always 'comma-spacing': [ERROR, { before: false, after: true }], // Commas go last, we have tooling to detect if we forget a comma 'comma-style': [ERROR, 'last'], // Require or disallow padding inside computed properties 'computed-property-spacing': [ERROR, 'never'], // Enabling this was incredibly annoying when doing layers of nesting 'consistent-this': IGNORE, // Enable to make UNIX people's lives easier 'eol-last': ERROR, // We like anonymous functions 'func-names': IGNORE, // Prefer to define functions via variables 'func-style': [WARN, 'declaration'], // Sometimes short names are appropriate 'id-length': IGNORE, // Camel case handles this for us 'id-match': IGNORE, // Use tabs and indent case blocks 'indent': [ERROR, 'tab', { SwitchCase: WARN }], // Prefer double qoutes for JSX properties: , 'jsx-quotes': [ERROR, 'prefer-double'], // Space after the colon 'key-spacing': [ERROR, { beforeColon: false, afterColon: true }], // Enforce unix line breaks 'linebreak-style': [ERROR, 'unix'], // Enforce new lines before block comments 'lines-around-comment': [ERROR, { beforeBlockComment: true, allowBlockStart: true }], // Disabled to ensure consistency with complexity option 'max-depth': IGNORE, // We use soft wrap 'max-len': IGNORE, // We are smart enough to know if this is bad or not 'max-nested-callbacks': IGNORE, // Sometimes we have no control over this for compat reasons, so just warn 'max-params': [WARN, MAX_PARAMS], // We should be able to use whatever feels right 'max-statements': IGNORE, // Constructors should be CamelCase 'new-cap': ERROR, // Always use parens when instantiating a class 'new-parens': ERROR, // Too difficult to enforce correctly as too many edge-cases 'newline-after-var': IGNORE, // Don't use the array constructor when it is not needed 'no-array-constructor': ERROR, // We never use bitwise, they are too clever 'no-bitwise': ERROR, // We use continue 'no-continue': IGNORE, // We like inline comments 'no-inline-comments': IGNORE, // The code could be optimised if this error occurs 'no-lonely-if': ERROR, // Don't mix spaces and tabs // @TODO maybe [ERROR, 'smart-tabs'] will be better, we will see 'no-mixed-spaces-and-tabs': ERROR, // We use multiple empty lines for styling 'no-multiple-empty-lines': IGNORE, // Sometimes it is more understandable with a negated condition 'no-negated-condition': IGNORE, // Sometimes these are useful 'no-nested-ternary': IGNORE, // Use {} instead of new Object() 'no-new-object': ERROR, // We use plus plus 'no-plusplus': IGNORE, // Handled by other rules 'no-restricted-syntax': IGNORE, // We never use this, it seems silly to allow this 'no-spaced-func': ERROR, // Sometimes ternaries are useful 'no-ternary': IGNORE, // Disallow trailing spaces 'no-trailing-spaces': ERROR, // Sometimes this is useful when avoiding shadowing 'no-underscore-dangle': IGNORE, // Sensible 'no-unneeded-ternary': ERROR, // Desirable, but too many edge cases it turns out where it is actually preferred 'object-curly-spacing': IGNORE, // [ERROR, 'always'], // We like multiple var statements 'one-var': IGNORE, // Force use of shorthands when available 'operator-assignment': [ERROR, 'always'], // Should be before, but not with =, *=, /=, += lines // @TODO figure out how to enforce 'operator-linebreak': IGNORE, // This rule doesn't appear to work correclty 'padded-blocks': IGNORE, // Seems like a good idea to error about this 'quote-props': [ERROR, 'consistent-as-needed'], // Use single quotes where escaping isn't needed 'quotes': [ERROR, 'single', 'avoid-escape'], // We use YUIdoc 'require-jsdoc': IGNORE, // If semi's are used, then add spacing after 'semi-spacing': [ERROR, { before: false, after: true }], // Never use semicolons 'semi': [ERROR, 'never'], // We don't care if our vars are alphabetical 'sort-vars': IGNORE, // Always force a space after a keyword 'space-after-keywords': [ERROR, 'always'], // Always force a space before a { 'space-before-blocks': [ERROR, 'always'], // function () {, get blah () { 'space-before-function-paren': [ERROR, 'always'], // We do this 'space-before-keywords': [ERROR, 'always'], // This is for spacing between [], so [ WARN, ERROR, 3 ] which we don't want 'space-in-brackets': IGNORE, // This is for spacing between (), so doSomething( WARN, ERROR, 3 ) or if ( WARN === 3 ) // which we want for ifs, but don't want for calls 'space-in-parens': IGNORE, // We use this 'space-infix-ops': ERROR, // We use this 'space-return-throw-case': ERROR, // We use this 'space-unary-ops': ERROR, // We use this // 'spaced-line-comment': ERROR, 'spaced-comment': ERROR, // We use this // @TODO revise this 'wrap-regex': ERROR, // -------------------------------------- // ECMAScript 6 // Sensible to create more informed and clear code 'arrow-body-style': [ERROR, 'as-needed'], // We do this, no reason why, just what we do 'arrow-parens': [ERROR, 'always'], // Require consistent spacing for arrow functions 'arrow-spacing': ERROR, // Makes sense as otherwise runtime error will occur 'constructor-super': ERROR, // Seems the most consistent location for it 'generator-star-spacing': [ERROR, 'before'], // Seems sensible 'no-arrow-condition': ERROR, // Seems sensible 'no-class-assign': ERROR, // Makes sense as otherwise runtime error will occur 'no-const-assign': ERROR, // Makes sense as otherwise runtime error will occur 'no-dupe-class-members': ERROR, // Makes sense as otherwise runtime error will occur 'no-this-before-super': ERROR, // @TODO This probably should be an error // however it is useful for: for ( var key in obj ) { // which hopefully is more performant than let (@TODO check if it actually is more performant) 'no-var': WARN, // Enforce ES6 object shorthand 'object-shorthand': ERROR, // Better performance when running native // but horrible performance if not running native as could fallback to bind // https://travis-ci.org/bevry/es6-benchmarks 'prefer-arrow-callback': IGNORE, // Sure, why not 'prefer-const': WARN, // Controversial change, but makes sense to move towards to reduce the risk of bad people overwriting apply and call // https://github.com/eslint/eslint/issues/ERROR939 'prefer-reflect': WARN, // Sure, why not 'prefer-spread': ERROR, // Too annoying to enforce 'prefer-template': IGNORE, // Makes sense 'require-yield': ERROR } } domain-browser-1.1.7/.gitignore000066400000000000000000000005241263271002300164350ustar00rootroot00000000000000# 2015 March 27 # https://github.com/bevry/base # Temp Files **/.docpad.db **/out.* **/*.log **/*.cpuprofile **/*.heapsnapshot # Build Files build/ components/ bower_components/ node_modules/ out/ coffeejs/ es5/ # Editor Caches .c9/ # Private Files .env .idea .cake_task_cache # ===================================== # CUSTOM # None domain-browser-1.1.7/.npmignore000066400000000000000000000010231263271002300164370ustar00rootroot00000000000000# 2015 September 18 # https://github.com/bevry/base # Temp Files **/.docpad.db **/out.* **/*.log **/*.cpuprofile **/*.heapsnapshot # Build Files build/ components/ bower_components/ node_modules/ # Private Files .env # Development Files .editorconfig .eslintrc .jshintrc .jscrc coffeelint.json .travis* nakefile.js Cakefile Makefile BACKERS.md CONTRIBUTING.md HISTORY.md **/src/ **/test/ # Other Package Definitions template.js component.json bower.json # ===================================== # CUSTOM MODIFICATIONS # None domain-browser-1.1.7/.travis.yml000066400000000000000000000015071263271002300165600ustar00rootroot00000000000000# 2015 December 9 # https://github.com/bevry/base # Use the latest travis infrastructure sudo: false # We use node language: node_js node_js: - "0.12" - "4" - "5" cache: directories: - node_modules # Prepare our tests # Ensure the project is setup correctly and compiled install: "npm run-script setup" before_script: "npm run-script compile" # Run our tests script: "npm test" # Custom notifications notifications: slack: secure: hAfd5XJjx2iNGrsGo8Gz8nJQ4XWgEWa/Usot7GilWmsbLX9G4aEoNuY/gR14YnJYHUEsXcCg2dXLyNI4aw8841zLDzixn36uZuy07sNNFomqAXjSnwoX3YjVZ1Wq/S44vkBtcVkjsgBTClMMz8FDPxI14yQrBrqbwrP2G+J2yYo= email: recipients: secure: Blfso7sHrbghm01zDrARM0jjBBZ2sGbxjzxKo8xFVgE6MyGwk2cfL5pkUUROwNRi0B/PukoZlqDTZTY1ROKDrP27QGwncQ5xtEItY/7E5PZDhOeT8MMrvKEEE+F8zQ3zyvP8k8XSKjPXxU9NcVBuOmSm1C/ekp1shoJcCqL8fg4= domain-browser-1.1.7/CONTRIBUTING.md000066400000000000000000000072071263271002300167030ustar00rootroot00000000000000 # Before You Post! ## Support We offer support through our [Official Support Channels](https://discuss.bevry.me/t/official-bevry-support-channels/63). Do not use GitHub Issues for support, your issue will be closed. ## Contribute Our [Contributing Guide](https://learn.bevry.me/community/contribute) contains useful tips and suggestions for how to contribute to this project, it's worth the read. ## Development ### Setup 1. Install [Node.js](/node/install) 1. Fork the project and clone your fork - [guide](https://help.github.com/articles/fork-a-repo/) 1. Install local dependencies ``` bash npm install ``` 1. Perform any other setup operations ``` bash npm run-script setup ``` ### Developing - Compiling changes ``` bash # Only once npm run-script compile # On every change npm run-script watch ``` 5. Run tests ``` bash npm run-script verify ``` ### Publishing Follow these steps in order to implement your changes/improvements into your desired project: #### Preparation 1. Make sure your changes are on their own branch that is branched off from master. 1. You can do this by: `git checkout master; git checkout -b your-new-branch` 1. And push the changes up by: `git push origin your-new-branch` 1. Ensure all tests pass: ``` bash npm run-script verify ``` > If possible, add tests for your change, if you don't know how, mention this in your pull request 1. Ensure the project is ready for publishing: ``` git status git diff npm run-script prepare ``` #### Pull Request To send your changes for the project owner to merge in: 1. Submit your pull request 1. When submitting, if the original project has a `dev` or `integrate` branch, use that as the target branch for your pull request instead of the default `master` 1. By submitting a pull request you agree for your changes to have the same license as the original plugin #### Publish To publish your changes as the project owner: 1. Switch to the master branch: ``` bash git checkout master ``` 1. Merge in the changes of the feature branch (if applicable) 1. Increment the version number in the `package.json` file according to the [semantic versioning](http://semver.org) standard, that is: 1. `x.0.0` MAJOR version when you make incompatible API changes (note: DocPad plugins must use v2 as the major version, as v2 corresponds to the current DocPad v6.x releases) 1. `x.y.0` MINOR version when you add functionality in a backwards-compatible manner 1. `x.y.z` PATCH version when you make backwards-compatible bug fixes 1. Add an entry to the changelog following the format of the previous entries, an example of this is: ``` markdown - v6.29.0 April 1, 2013 - Progress on [issue #474](https://github.com/bevry/docpad/issues/474) - DocPad will now set permissions based on the process's ability - Thanks to [Avi Deitcher](https://github.com/deitch), [Stephan Lough](https://github.com/stephanlough) for [issue #165](https://github.com/bevry/docpad/issues/165) - Updated dependencies ``` 1. Commit the changes with the commit title set to something like `v6.29.0. Bugfix. Improvement.` and commit description set to the changelog entry 1. Ensure the project is ready for publishing: ``` git status git diff npm run-script prepare ``` 1. Prepare the release and publish it to npm and git: ``` bash npm run-script release ``` > A prompt will occur asking you for a git tag annotation, enter the changelog entry that we created earlier, save and exit the prompt. domain-browser-1.1.7/HISTORY.md000066400000000000000000000025451263271002300161350ustar00rootroot00000000000000# History ## v1.1.7 2015 December 12 - Revert minimum node version from 0.12 back to 0.4 - Thanks to [Alexander Sorokin](https://github.com/syrnick) for [this comment](https://github.com/bevry/domain-browser/commit/c66ee3445e87955e70d0d60d4515f2d26a81b9c4#commitcomment-14938325) ## v1.1.6 2015 December 12 - Fixed `assert-helpers` sneaking into `dependencies` - Thanks to [Bogdan Chadkin](https://github.com/TrySound) for [Pull Request #8](https://github.com/bevry/domain-browser/pull/8) ## v1.1.5 2015 December 9 - Updated internal conventions - Added better jspm support - Thanks to [Guy Bedford](https://github.com/guybedford) for [Pull Request #7](https://github.com/bevry/domain-browser/pull/7) ## v1.1.4 2015 February 3 - Added - `domain.enter()` - `domain.exit()` - `domain.bind()` - `domain.intercept()` ## v1.1.3 2014 October 10 - Added - `domain.add()` - `domain.remove()` ## v1.1.2 2014 June 8 - Added `domain.createDomain()` alias - Thanks to [James Halliday](https://github.com/substack) for [Pull Request #1](https://github.com/bevry/domain-browser/pull/1) ## v1.1.1 2013 December 27 - Fixed `domain.create()` not returning anything ## v1.1.0 2013 November 1 - Dropped component.io and bower support, just use ender or browserify ## v1.0.1 2013 September 18 - Now called `domain-browser` everywhere ## v1.0.0 2013 September 18 - Initial release domain-browser-1.1.7/LICENSE.md000066400000000000000000000025041263271002300160510ustar00rootroot00000000000000

License

Unless stated otherwise all works are:
and licensed under:

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
domain-browser-1.1.7/README.md000066400000000000000000000172751263271002300157370ustar00rootroot00000000000000

domain-browser

Travis CI Build Status NPM version NPM downloads Dependency Status Dev Dependency Status
Slack community badge Patreon donate button Gratipay donate button Flattr donate button PayPal donate button Bitcoin donate button Wishlist browse button Node's domain module for the web browser. This is merely an evented try...catch with the same API as node, nothing more.

Install

NPM

Browserify

Ender

History

Discover the release history by heading on over to the HISTORY.md file.

Backers

Maintainers

These amazing people are maintaining this project:

Sponsors

No sponsors yet! Will you be the first? Patreon donate button Gratipay donate button Flattr donate button PayPal donate button Bitcoin donate button Wishlist browse button

Contributors

These amazing people have contributed code to this project: Discover how you can contribute by heading on over to the CONTRIBUTING.md file.

License

Unless stated otherwise all works are: and licensed under: domain-browser-1.1.7/index.js000066400000000000000000000024251263271002300161140ustar00rootroot00000000000000// This file should be ES5 compatible /* eslint prefer-spread:0, no-var:0, prefer-reflect:0, no-magic-numbers:0 */ 'use strict' module.exports = (function () { // Import Events var events = require('events') // Export Domain var domain = {} domain.createDomain = domain.create = function () { var d = new events.EventEmitter() function emitError (e) { d.emit('error', e) } d.add = function (emitter) { emitter.on('error', emitError) } d.remove = function (emitter) { emitter.removeListener('error', emitError) } d.bind = function (fn) { return function () { var args = Array.prototype.slice.call(arguments) try { fn.apply(null, args) } catch (err) { emitError(err) } } } d.intercept = function (fn) { return function (err) { if ( err ) { emitError(err) } else { var args = Array.prototype.slice.call(arguments, 1) try { fn.apply(null, args) } catch (err) { emitError(err) } } } } d.run = function (fn) { try { fn() } catch (err) { emitError(err) } return this } d.dispose = function () { this.removeAllListeners() return this } d.enter = d.exit = function () { return this } return d } return domain }).call(this) domain-browser-1.1.7/nakefile.js000066400000000000000000000316741263271002300165730ustar00rootroot00000000000000// 2015 September 11 // https://github.com/bevry/base 'use strict' // ===================================== // Imports const fsUtil = require('fs') const pathUtil = require('path') // ===================================== // Variables // Define environment things const WINDOWS = process.platform.indexOf('win') === 0 const NODE = process.execPath const NPM = WINDOWS ? process.execPath.replace('node.exe', 'npm.cmd') : 'npm' // const EXT = WINDOWS ? '.cmd' : '' const GIT = 'git' // Define project paths const APP_PATH = process.cwd() const PACKAGE_PATH = pathUtil.join(APP_PATH, 'package.json') const PACKAGE_DATA = require(PACKAGE_PATH) const PACKAGE_CONFIG = PACKAGE_DATA.nakeConfiguration || PACKAGE_DATA.cakeConfiguration || {} // Define module paths const MODULES_PATH = pathUtil.join(APP_PATH, 'node_modules') const DOCPAD_PATH = pathUtil.join(MODULES_PATH, 'docpad') const COFFEE = pathUtil.join(MODULES_PATH, '.bin', 'coffee') const PROJECTZ = pathUtil.join(MODULES_PATH, '.bin', 'projectz') const DOCCO = pathUtil.join(MODULES_PATH, '.bin', 'docco') const DOCPAD = pathUtil.join(MODULES_PATH, '.bin', 'docpad') const BISCOTTO = pathUtil.join(MODULES_PATH, '.bin', 'biscotto') const YUIDOC = pathUtil.join(MODULES_PATH, '.bin', 'yuidoc') const BABEL = pathUtil.join(MODULES_PATH, '.bin', 'babel') const ESLINT = pathUtil.join(MODULES_PATH, '.bin', 'eslint') const COFFEELINT = pathUtil.join(MODULES_PATH, '.bin', 'coffeelint') // Define configuration const config = { TEST_PATH: 'test', DOCCO_SRC_PATH: null, DOCCO_OUT_PATH: 'docs', BISCOTTO_SRC_PATH: null, BISCOTTO_OUT_PATH: 'docs', YUIDOC_SRC_PATH: null, YUIDOC_OUT_PATH: 'docs', YUIDOC_SYNTAX: 'js', COFFEE_SRC_PATH: null, COFFEE_OUT_PATH: 'out', DOCPAD_SRC_PATH: null, DOCPAD_OUT_PATH: 'out', BABEL_SRC_PATH: null, BABEL_OUT_PATH: 'es5', ESLINT_SRC_PATH: null, COFFEELINT_SRC_PATH: null } // Move package.json:nakeConfiguration into our configuration object Object.keys(PACKAGE_CONFIG).forEach(function (key) { const value = PACKAGE_CONFIG[key] config[key] = value }) // ===================================== // Generic const childProcess = require('child_process') const spawn = function (command, args, opts, next) { const commandString = command + ' ' + args.join(' ') if ( opts.output === true ) { console.log(commandString) opts.stdio = 'inherit' } const pid = childProcess.spawn(command, args, opts) pid.on('close', function () { let args = Array.prototype.slice.call(arguments) if ( args[0] === 1 ) { const error = new Error('Process [' + commandString + '] exited with error status code.') next(error) } else { next() } }) return pid } const exec = function (command, opts, next) { if ( opts.output === true ) { console.log(command) return childProcess.exec(command, opts, function (error, stdout, stderr) { console.log(stdout) console.log(stderr) if ( next ) next(error) }) } else { return childProcess.exec(command, opts, next) } } const steps = function (next, steps) { let step = 0 const complete = function (error) { // success status code if ( error === 0 ) { error = null } // error status code else if ( error === 1 ) { error = new Error('Process exited with error status code') } // Error if ( error ) { next(error) } else { ++step if ( step === steps.length ) { next() } else { steps[step](complete) } } } return steps[step](complete) } // ===================================== // Actions const actions = { clean: function (opts, next) { // Steps steps(next, [ function (complete) { console.log('\nclean:') // Prepare rm args let args = ['-Rf'] // Add compilation paths to args Object.keys(config).forEach(function (key) { let value = config[key] if ( key.indexOf('OUT_PATH') !== -1 ) { args.push(value) } }) // Add common ignore paths to args ; [APP_PATH, config.TEST_PATH].forEach(function (path) { args.push( pathUtil.join(path, 'build'), pathUtil.join(path, 'components'), pathUtil.join(path, 'bower_components'), pathUtil.join(path, 'node_modules'), pathUtil.join(path, '*out'), pathUtil.join(path, '*log'), pathUtil.join(path, '*heapsnaphot'), pathUtil.join(path, '*cpuprofile') ) }) // rm spawn('rm', args, {output: true, cwd: APP_PATH}, complete) } ]) }, setup: function (opts, next) { // Steps steps(next, [ function (complete) { console.log('\nnpm install (for app):') spawn(NPM, ['install'], {output: true, cwd: APP_PATH}, complete) }, function (complete) { if ( !config.TEST_PATH || !fsUtil.existsSync(config.TEST_PATH) ) return complete() console.log('\nnpm install (for test):') spawn(NPM, ['install'], {output: true, cwd: config.TEST_PATH}, complete) }, function (complete) { if ( !fsUtil.existsSync(DOCPAD_PATH) ) return complete() console.log('\nnpm install (for docpad tests):') spawn(NPM, ['install'], {output: true, cwd: DOCPAD_PATH}, complete) } ]) }, compile: function (opts, next) { // Steps steps(next, [ function (complete) { if ( !config.COFFEE_SRC_PATH || !fsUtil.existsSync(COFFEE) ) return complete() console.log('\ncoffee compile:') spawn(NODE, [COFFEE, '-co', config.COFFEE_OUT_PATH, config.COFFEE_SRC_PATH], {output: true, cwd: APP_PATH}, complete) }, function (complete) { if ( !config.BABEL_SRC_PATH || !fsUtil.existsSync(BABEL) ) return complete() console.log('\nbabel compile:') spawn(NODE, [BABEL, config.BABEL_SRC_PATH, '--out-dir', config.BABEL_OUT_PATH], {output: true, cwd: APP_PATH}, complete) }, function (complete) { if ( !config.DOCPAD_SRC_PATH || !fsUtil.existsSync(DOCPAD) ) return complete() console.log('\ndocpad generate:') spawn(NODE, [DOCPAD, 'generate'], {output: true, cwd: APP_PATH}, complete) } ]) }, watch: function (opts, next) { // Steps steps(next, [ function (complete) { if ( !config.BABEL_SRC_PATH || !fsUtil.existsSync(BABEL) ) return complete() console.log('\nbabel compile:') spawn(NODE, [BABEL, '-w', config.BABEL_SRC_PATH, '--out-dir', config.BABEL_OUT_PATH], {output: true, cwd: APP_PATH}, complete) }, function (complete) { if ( !config.COFFEE_SRC_PATH || !fsUtil.existsSync(COFFEE) ) return complete() console.log('\ncoffee watch:') spawn(NODE, [COFFEE, '-wco', config.COFFEE_OUT_PATH, config.COFFEE_SRC_PATH], {output: true, cwd: APP_PATH}) // background complete() // continue while coffee runs in background }, function (complete) { if ( !config.DOCPAD_SRC_PATH || !fsUtil.existsSync(DOCPAD) ) return complete() console.log('\ndocpad run:') spawn(NODE, [DOCPAD, 'run'], {output: true, cwd: APP_PATH}) // background complete() // continue while docpad runs in background } ]) }, verify: function (opts, next) { // Steps steps(next, [ function (complete) { console.log('\nnake compile') actions.compile(opts, complete) }, function (complete) { console.log('\ncoffeelint:') if ( !config.COFFEELINT_SRC_PATH || !fsUtil.existsSync(COFFEELINT) ) return complete() spawn(COFFEELINT, [config.COFFEELINT_SRC_PATH], {output: true, cwd: APP_PATH}, complete) }, function (complete) { console.log('\neslint:') if ( !config.ESLINT_SRC_PATH || !fsUtil.existsSync(ESLINT) ) return complete() spawn(ESLINT, [config.ESLINT_SRC_PATH], {output: true, cwd: APP_PATH}, complete) }, function (complete) { console.log('\nnpm test:') spawn(NPM, ['test'], {output: true, cwd: APP_PATH}, complete) } ]) }, meta: function (opts, next) { // Steps steps(next, [ function (complete) { if ( !config.DOCCO_SRC_PATH || !fsUtil.existsSync(DOCCO) ) return complete() console.log('\ndocco compile:') let command = [NODE, DOCCO, '-o', config.DOCCO_OUT_PATH, config.DOCCO_SRC_PATH ].join(' ') exec(command, {output: true, cwd: APP_PATH}, complete) }, function (complete) { if ( !config.BISCOTTO_SRC_PATH || !fsUtil.existsSync(BISCOTTO) ) return complete() console.log('\nbiscotto compile:') let command = [BISCOTTO, '-n', PACKAGE_DATA.title || PACKAGE_DATA.name, '--title', '"' + (PACKAGE_DATA.title || PACKAGE_DATA.name) + ' API Documentation"', '-r', 'README.md', '-o', config.BISCOTTO_OUT_PATH, config.BISCOTTO_SRC_PATH, '-', 'LICENSE.md HISTORY.md' ].join(' ') exec(command, {output: true, cwd: APP_PATH}, complete) }, function (complete) { if ( !fsUtil.existsSync(YUIDOC) ) return complete() console.log('\nyuidoc compile:') let command = [YUIDOC] if ( config.YUIDOC_OUT_PATH ) command.push('-o', config.YUIDOC_OUT_PATH) if ( config.YUIDOC_SYNTAX ) command.push('--syntaxtype', config.YUIDOC_SYNTAX, '-e', '.' + config.YUIDOC_SYNTAX) if ( config.YUIDOC_SRC_PATH ) command.push(config.YUIDOC_SRC_PATH) spawn(NODE, command, {output: true, cwd: APP_PATH}, complete) }, function (complete) { if ( !fsUtil.existsSync(PROJECTZ) ) return complete() console.log('\nprojectz compile') spawn(NODE, [PROJECTZ, 'compile'], {output: true, cwd: APP_PATH}, complete) } ]) }, prerelease: function (opts, next) { // Steps steps(next, [ function (complete) { console.log('\nnake verify') actions.verify(opts, complete) }, function (complete) { console.log('\nnake meta') actions.meta(opts, complete) } ]) }, release: function (opts, next) { // Steps steps(next, [ function (complete) { console.log('\nnake prerelease') actions.prerelease(opts, complete) }, function (complete) { console.log('\nnpm publish:') spawn(NPM, ['publish'], {output: true, cwd: APP_PATH}, complete) // ^ npm will run prepublish and postpublish for us }, function (complete) { console.log('\nnake postrelease') actions.postrelease(opts, complete) } ]) }, postrelease: function (opts, next) { // Steps steps(next, [ function (complete) { console.log('\ngit tag:') spawn(GIT, ['tag', 'v' + PACKAGE_DATA.version, '-a'], {output: true, cwd: APP_PATH}, complete) }, function (complete) { console.log('\ngit push origin master:') spawn(GIT, ['push', 'origin', 'master'], {output: true, cwd: APP_PATH}, complete) }, function (complete) { console.log('\ngit push tags:') spawn(GIT, ['push', 'origin', '--tags'], {output: true, cwd: APP_PATH}, complete) } ]) } } // ===================================== // Commands const commands = { clean: 'clean up instance', setup: 'setup our project for development', compile: 'compile our files', watch: 'compile our files initially, and again for each change', verify: 'verify our project works (includes compile)', meta: 'compile our meta files', prerelease: 'prepare our project for publishing (includes verify and meta)', release: 'publish our project using npm (includes prerelease and postrelease)', postrelease: 'prepare our project after publishing' } const aliases = { install: 'setup', test: 'verify', docs: 'meta', prepare: 'prerelease', prepublish: 'prerelease', publish: 'release', postpublish: 'postpublish' } const combined = {} Object.keys(commands).forEach(function (command) { const description = commands[command] const method = actions[command] combined[command] = { description: description, method: method } }) Object.keys(aliases).forEach(function (alias) { const command = aliases[alias] const description = 'alias for ' + command const method = actions[command] combined[alias] = { description: description, method: method } }) // ===================================== // Command Line Interface let desiredAction = null let longestNameLength = 0 const finish = function (error) { if ( error ) { process.stderr.write( (error.stack || error.message || error) + '\n' ) throw error } else { process.stdout.write('OK\n') } } const output = function (list) { let result = '' Object.keys(list).forEach(function (key) { const description = combined[key].description let name = key + ': ' while ( name.length < longestNameLength + 10 ) name += ' ' result += name + ' ' + description + '\n' }) return result } Object.keys(combined).forEach(function (command) { if ( command.length > longestNameLength ) { longestNameLength = command.length } if ( process.argv.indexOf(command) !== -1 ) { desiredAction = command } }) // Fire the method if ( desiredAction ) { combined[desiredAction].method({}, finish) } // Display the help else { console.log([ 'Nakefile help for ' + PACKAGE_DATA.name, '', 'USAGE', '', 'Standard usage:', 'node --harmony nakefile.js $action', '', 'NPM script usage:', 'npm run-script $action', '', 'Shell alias usage:', 'nake $action', '', 'ACTIONS', '', output(commands), output(aliases).trim() ].join('\n')) } domain-browser-1.1.7/package.json000066400000000000000000000050201263271002300167270ustar00rootroot00000000000000{ "name": "domain-browser", "version": "1.1.7", "description": "Node's domain module for the web browser. This is merely an evented try...catch with the same API as node, nothing more.", "homepage": "https://github.com/bevry/domain-browser", "license": "MIT", "badges": { "list": [ "travisci", "npmversion", "npmdownloads", "daviddm", "daviddmdev", "---", "slackin", "patreon", "gratipay", "flattr", "paypal", "bitcoin", "wishlist" ], "config": { "patreonUsername": "bevry", "gratipayUsername": "bevry", "flattrCode": "344188/balupton-on-Flattr", "paypalButtonID": "QB8GQPZAH84N6", "bitcoinURL": "https://bevry.me/bitcoin", "wishlistURL": "https://bevry.me/wishlist", "slackinURL": "https://slack.bevry.me" } }, "keywords": [ "domain", "trycatch", "try", "catch", "node-compat", "ender.js", "component", "component.io", "umd", "amd", "require.js", "browser" ], "author": "2013+ Bevry Pty Ltd (http://bevry.me)", "maintainers": [ "Benjamin Lupton (http://balupton.com)" ], "contributors": [ "Benjamin Lupton (http://balupton.com)", "Evan Solomon (http://evansolomon.me)", "James Halliday (http://substack.net/)", "Guy Bedford (twitter.com/guybedford)", "Bogdan Chadkin (https://github.com/TrySound)" ], "bugs": { "url": "https://github.com/bevry/domain-browser/issues" }, "repository": { "type": "git", "url": "http://github.com/bevry/domain-browser.git" }, "engines": { "node": ">=0.4", "npm": ">=1.2" }, "browsers": true, "main": "./index.js", "jspm": { "map": { "./index.js": { "node": "@node/domain" } } }, "dependencies": {}, "devDependencies": { "assert-helpers": "^4.1.0", "eslint": "^1.10.3", "joe": "^1.6.0", "joe-reporter-console": "^1.2.1", "projectz": "^1.0.8" }, "scripts": { "clean": "node --harmony nakefile.js clean", "setup": "node --harmony nakefile.js setup", "compile": "node --harmony nakefile.js compile", "watch": "node --harmony nakefile.js watch", "verify": "node --harmony nakefile.js verify", "meta": "node --harmony nakefile.js meta", "prepare": "node --harmony nakefile.js prepare", "release": "node --harmony nakefile.js release", "test": "node --harmony ./test.js" } } domain-browser-1.1.7/test.js000066400000000000000000000050271263271002300157650ustar00rootroot00000000000000/* eslint handle-callback-err:0, no-magic-numbers:0, no-unused-vars:0 */ 'use strict' // Import const events = require('events') const equal = require('assert-helpers').equal const joe = require('joe') const domain = require('./') // ===================================== // Tests joe.describe('domain-browser', function (describe, it) { it('should work on throws', function (done) { const d = domain.create() d.on('error', function (err) { equal(err && err.message, 'a thrown error', 'error message') done() }) d.run(function () { throw new Error('a thrown error') }) }) it('should be able to add emitters', function (done) { const d = domain.create() const emitter = new events.EventEmitter() d.add(emitter) d.on('error', function (err) { equal(err && err.message, 'an emitted error', 'error message') done() }) emitter.emit('error', new Error('an emitted error')) }) it('should be able to remove emitters', function (done) { const emitter = new events.EventEmitter() const d = domain.create() let domainGotError = false d.add(emitter) d.on('error', function (err) { domainGotError = true }) emitter.on('error', function (err) { equal(err && err.message, 'This error should not go to the domain', 'error message') // Make sure nothing race condition-y is happening setTimeout(function () { equal(domainGotError, false, 'no domain error') done() }, 0) }) d.remove(emitter) emitter.emit('error', new Error('This error should not go to the domain')) }) it('bind should work', function (done) { const d = domain.create() d.on('error', function (err) { equal(err && err.message, 'a thrown error', 'error message') done() }) d.bind(function (err, a, b) { equal(err && err.message, 'a passed error', 'error message') equal(a, 2, 'value of a') equal(b, 3, 'value of b') throw new Error('a thrown error') })(new Error('a passed error'), 2, 3) }) it('intercept should work', function (done) { const d = domain.create() let count = 0 d.on('error', function (err) { if ( count === 0 ) { equal(err && err.message, 'a thrown error', 'error message') } else if ( count === 1 ) { equal(err && err.message, 'a passed error', 'error message') done() } count++ }) d.intercept(function (a, b) { equal(a, 2, 'value of a') equal(b, 3, 'value of b') throw new Error('a thrown error') })(null, 2, 3) d.intercept(function (a, b) { throw new Error('should never reach here') })(new Error('a passed error'), 2, 3) }) })