added bower, gulp

This commit is contained in:
Bachir Soussi Chiadmi
2017-01-22 15:18:08 +01:00
parent 4c9b35f2d1
commit ac58a24f5c
12657 changed files with 1359874 additions and 579 deletions
@@ -0,0 +1,22 @@
{
"name": "Clameurs",
"description": "Clameurs theme",
"main": "gulpfile.js",
"authors": [
"Bachir Soussi Chiadmi"
],
"license": "GPLV3",
"moduleType": [],
"homepage": "",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"normalize-css": "normalize.css#^5.0.0"
},
"devDependencies": {}
}
@@ -0,0 +1,28 @@
{
"name": "normalize-css",
"description": "A modern alternative to CSS resets",
"main": "normalize.css",
"authors": [
"Jonathan Neal <jonathantneal@hotmail.com> (http://jonathantneal.com/)",
"Nicolas Gallagher <nicolas@nicolasgallagher.com> (http://nicolasgallagher.com/)"
],
"license": "MIT",
"ignore": [
"CHANGELOG.md",
"CONTRIBUTING.md",
"package.json",
"README.md",
"test.html"
],
"homepage": "https://github.com/necolas/normalize.css",
"version": "5.0.0",
"_release": "5.0.0",
"_resolution": {
"type": "version",
"tag": "5.0.0",
"commit": "ef3b56780437e59feff7d065d3903059ed3d6a16"
},
"_source": "https://github.com/necolas/normalize.css.git",
"_target": "^5.0.0",
"_originalSource": "normalize.css"
}
@@ -0,0 +1,12 @@
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false
@@ -0,0 +1,2 @@
node_modules
npm-debug.log
@@ -0,0 +1,3 @@
language: node_js
node_js:
- stable
@@ -0,0 +1,21 @@
# The MIT License (MIT)
Copyright © Nicolas Gallagher and Jonathan Neal
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.
@@ -0,0 +1,17 @@
{
"name": "normalize-css",
"description": "A modern alternative to CSS resets",
"main": "normalize.css",
"authors": [
"Jonathan Neal <jonathantneal@hotmail.com> (http://jonathantneal.com/)",
"Nicolas Gallagher <nicolas@nicolasgallagher.com> (http://nicolasgallagher.com/)"
],
"license": "MIT",
"ignore": [
"CHANGELOG.md",
"CONTRIBUTING.md",
"package.json",
"README.md",
"test.html"
]
}
@@ -0,0 +1,461 @@
/*! normalize.css v5.0.0 | MIT License | github.com/necolas/normalize.css */
/**
* 1. Change the default font family in all browsers (opinionated).
* 2. Correct the line height in all browsers.
* 3. Prevent adjustments of font size after orientation changes in
* IE on Windows Phone and in iOS.
*/
/* Document
========================================================================== */
html {
font-family: sans-serif; /* 1 */
line-height: 1.15; /* 2 */
-ms-text-size-adjust: 100%; /* 3 */
-webkit-text-size-adjust: 100%; /* 3 */
}
/* Sections
========================================================================== */
/**
* Remove the margin in all browsers (opinionated).
*/
body {
margin: 0;
}
/**
* Add the correct display in IE 9-.
*/
article,
aside,
footer,
header,
nav,
section {
display: block;
}
/**
* Correct the font size and margin on `h1` elements within `section` and
* `article` contexts in Chrome, Firefox, and Safari.
*/
h1 {
font-size: 2em;
margin: 0.67em 0;
}
/* Grouping content
========================================================================== */
/**
* Add the correct display in IE 9-.
* 1. Add the correct display in IE.
*/
figcaption,
figure,
main { /* 1 */
display: block;
}
/**
* Add the correct margin in IE 8.
*/
figure {
margin: 1em 40px;
}
/**
* 1. Add the correct box sizing in Firefox.
* 2. Show the overflow in Edge and IE.
*/
hr {
box-sizing: content-box; /* 1 */
height: 0; /* 1 */
overflow: visible; /* 2 */
}
/**
* 1. Correct the inheritance and scaling of font size in all browsers.
* 2. Correct the odd `em` font sizing in all browsers.
*/
pre {
font-family: monospace, monospace; /* 1 */
font-size: 1em; /* 2 */
}
/* Text-level semantics
========================================================================== */
/**
* 1. Remove the gray background on active links in IE 10.
* 2. Remove gaps in links underline in iOS 8+ and Safari 8+.
*/
a {
background-color: transparent; /* 1 */
-webkit-text-decoration-skip: objects; /* 2 */
}
/**
* Remove the outline on focused links when they are also active or hovered
* in all browsers (opinionated).
*/
a:active,
a:hover {
outline-width: 0;
}
/**
* 1. Remove the bottom border in Firefox 39-.
* 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
*/
abbr[title] {
border-bottom: none; /* 1 */
text-decoration: underline; /* 2 */
text-decoration: underline dotted; /* 2 */
}
/**
* Prevent the duplicate application of `bolder` by the next rule in Safari 6.
*/
b,
strong {
font-weight: inherit;
}
/**
* Add the correct font weight in Chrome, Edge, and Safari.
*/
b,
strong {
font-weight: bolder;
}
/**
* 1. Correct the inheritance and scaling of font size in all browsers.
* 2. Correct the odd `em` font sizing in all browsers.
*/
code,
kbd,
samp {
font-family: monospace, monospace; /* 1 */
font-size: 1em; /* 2 */
}
/**
* Add the correct font style in Android 4.3-.
*/
dfn {
font-style: italic;
}
/**
* Add the correct background and color in IE 9-.
*/
mark {
background-color: #ff0;
color: #000;
}
/**
* Add the correct font size in all browsers.
*/
small {
font-size: 80%;
}
/**
* Prevent `sub` and `sup` elements from affecting the line height in
* all browsers.
*/
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sub {
bottom: -0.25em;
}
sup {
top: -0.5em;
}
/* Embedded content
========================================================================== */
/**
* Add the correct display in IE 9-.
*/
audio,
video {
display: inline-block;
}
/**
* Add the correct display in iOS 4-7.
*/
audio:not([controls]) {
display: none;
height: 0;
}
/**
* Remove the border on images inside links in IE 10-.
*/
img {
border-style: none;
}
/**
* Hide the overflow in IE.
*/
svg:not(:root) {
overflow: hidden;
}
/* Forms
========================================================================== */
/**
* 1. Change the font styles in all browsers (opinionated).
* 2. Remove the margin in Firefox and Safari.
*/
button,
input,
optgroup,
select,
textarea {
font-family: sans-serif; /* 1 */
font-size: 100%; /* 1 */
line-height: 1.15; /* 1 */
margin: 0; /* 2 */
}
/**
* Show the overflow in IE.
* 1. Show the overflow in Edge.
*/
button,
input { /* 1 */
overflow: visible;
}
/**
* Remove the inheritance of text transform in Edge, Firefox, and IE.
* 1. Remove the inheritance of text transform in Firefox.
*/
button,
select { /* 1 */
text-transform: none;
}
/**
* 1. Prevent a WebKit bug where (2) destroys native `audio` and `video`
* controls in Android 4.
* 2. Correct the inability to style clickable types in iOS and Safari.
*/
button,
html [type="button"], /* 1 */
[type="reset"],
[type="submit"] {
-webkit-appearance: button; /* 2 */
}
/**
* Remove the inner border and padding in Firefox.
*/
button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
border-style: none;
padding: 0;
}
/**
* Restore the focus styles unset by the previous rule.
*/
button:-moz-focusring,
[type="button"]:-moz-focusring,
[type="reset"]:-moz-focusring,
[type="submit"]:-moz-focusring {
outline: 1px dotted ButtonText;
}
/**
* Change the border, margin, and padding in all browsers (opinionated).
*/
fieldset {
border: 1px solid #c0c0c0;
margin: 0 2px;
padding: 0.35em 0.625em 0.75em;
}
/**
* 1. Correct the text wrapping in Edge and IE.
* 2. Correct the color inheritance from `fieldset` elements in IE.
* 3. Remove the padding so developers are not caught out when they zero out
* `fieldset` elements in all browsers.
*/
legend {
box-sizing: border-box; /* 1 */
color: inherit; /* 2 */
display: table; /* 1 */
max-width: 100%; /* 1 */
padding: 0; /* 3 */
white-space: normal; /* 1 */
}
/**
* 1. Add the correct display in IE 9-.
* 2. Add the correct vertical alignment in Chrome, Firefox, and Opera.
*/
progress {
display: inline-block; /* 1 */
vertical-align: baseline; /* 2 */
}
/**
* Remove the default vertical scrollbar in IE.
*/
textarea {
overflow: auto;
}
/**
* 1. Add the correct box sizing in IE 10-.
* 2. Remove the padding in IE 10-.
*/
[type="checkbox"],
[type="radio"] {
box-sizing: border-box; /* 1 */
padding: 0; /* 2 */
}
/**
* Correct the cursor style of increment and decrement buttons in Chrome.
*/
[type="number"]::-webkit-inner-spin-button,
[type="number"]::-webkit-outer-spin-button {
height: auto;
}
/**
* 1. Correct the odd appearance in Chrome and Safari.
* 2. Correct the outline style in Safari.
*/
[type="search"] {
-webkit-appearance: textfield; /* 1 */
outline-offset: -2px; /* 2 */
}
/**
* Remove the inner padding and cancel buttons in Chrome and Safari on macOS.
*/
[type="search"]::-webkit-search-cancel-button,
[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
/**
* 1. Correct the inability to style clickable types in iOS and Safari.
* 2. Change font properties to `inherit` in Safari.
*/
::-webkit-file-upload-button {
-webkit-appearance: button; /* 1 */
font: inherit; /* 2 */
}
/* Interactive
========================================================================== */
/*
* Add the correct display in IE 9-.
* 1. Add the correct display in Edge, IE, and Firefox.
*/
details, /* 1 */
menu {
display: block;
}
/*
* Add the correct display in all browsers.
*/
summary {
display: list-item;
}
/* Scripting
========================================================================== */
/**
* Add the correct display in IE 9-.
*/
canvas {
display: inline-block;
}
/**
* Add the correct display in IE.
*/
template {
display: none;
}
/* Hidden
========================================================================== */
/**
* Add the correct display in IE 10-.
*/
[hidden] {
display: none;
}
@@ -9,18 +9,14 @@ engine = "phptemplate"
;----------// Styles
stylesheets[all][] = "css/normalize.css"
stylesheets[all][] = "css/styles.css"
stylesheets[all][] = "bower_components/normalize-css/normalize.css"
stylesheets[all][] = "css/dist/styles.css"
; non-semantic helper classes
; Please define your styles before this section.
stylesheets[all][] = "css/nonsemantic.css"
;----------// Scripts
scripts[] = "js/script.js"
scripts[] = "js/dist/script.min.js"
;----------// Regions
+295
View File
@@ -0,0 +1,295 @@
/**
* Primary Drupal Styles
* Author: Bachir Soussi Chiadmi
*/
body {
font-size: 16px;
font-family: Arial, "MS Trebuchet", sans-serif; }
a {
color: #007BC2;
text-decoration: none; }
h1 {
font-size: 1.6em; }
h2 {
font-size: 1.5em; }
h3 {
font-size: 1.4em; }
h4 {
font-size: 1.3em; }
h5 {
font-size: 1.2em; }
h6 {
font-size: 1.1em; }
input {
font-family: Arial, "MS Trebuchet", sans-serif;
font-size: 0.8em; }
/** layout */
#center, #sidebar-first, #sidebar-second, .footer-block .region, .header-block {
display: inline-block;
vertical-align: top; }
body.two-sidebars #center {
width: 54%; }
body.sidebar-first #center {
width: 73%; }
body.sidebar-second #center {
width: 80%; }
body.no-sidebars #center {
width: 100%; }
#sidebar-first {
width: 24%; }
#sidebar-second {
width: 18%; }
#header, #main, #footer {
padding: 1em; }
body {
background-color: #DFDFDF; }
#container {
width: 1024px;
margin: 0 auto;
background-color: #FFF; }
#header, #footer {
background-color: #535353;
color: #fff; }
.block, .panel-pane {
border: 1px solid #D1D1D1;
padding: 0.5em;
margin: 0.5em;
border-radius: 5px;
background-color: #EAEAEA; }
.footer-block .block {
background-color: #353535;
border: 1px solid #1a1a1a; }
#footer-bottom {
text-align: center; }
#footer-bottom .block {
background-color: transparent;
border: 0 solid #999;
font-size: 0.7em; }
#content {
padding: 1em; }
.logo h1, h1.page-title {
font-size: 2em; }
#header ul.menu li,
#content-top ul.menu li,
#content-bottom ul.menu li,
#footer ul.menu li {
display: inline-block;
vertical-align: top; }
.views-row {
margin-bottom: 1em; }
.views-field-title {
font-size: 1.1em;
font-weight: bold; }
.views-field-title a {
color: #444444;
text-decoration: none; }
li, .item-list ul li {
list-style: none inside url();
margin-left: 0; }
/** Messages. */
div.messages {
padding: 9px;
margin: 0.5em 0 0;
color: #036;
background: #bdf;
border: 1px solid #ace;
border-radius: 5px; }
div.warning {
color: #840;
background: #fe6;
border-color: #ed5; }
div.error {
color: #fff;
background: #e63;
border-color: #d52; }
div.error p.error {
color: #333; }
div.status {
color: #360;
background: #cf8;
border-color: #be7; }
/** Tab navigation */
ul.primary, .views-admin-links ul {
font: 13px/1.231 sans-serif;
*font-size: small;
border-collapse: collapse;
padding: 0 0 0 1em;
/* LTR */
white-space: nowrap;
list-style: none;
margin: 5px;
height: auto;
line-height: normal;
border-bottom: 1px solid #bbb; }
ul.primary li, .views-admin-links li {
display: inline; }
ul.primary li a, .views-admin-links li a {
background-color: #ddd;
border-color: #bbb;
border-width: 1px;
border-style: solid solid none solid;
height: auto;
margin-right: 0.5em;
/* LTR */
padding: 0 1em;
text-decoration: none;
border-top-left-radius: 5px;
border-top-right-radius: 5px; }
ul.primary li.active a {
background-color: #fff;
border: 1px solid #bbb;
border-bottom: #fff 1px solid; }
ul.primary li a:hover, .views-admin-links li a:hover {
background-color: #eee;
border-color: #ccc;
border-bottom-color: #eee; }
ul.secondary {
border-bottom: 1px solid #bbb;
padding: 0.5em 1em;
margin: 5px; }
ul.secondary li {
display: inline;
padding: 0 1em;
border-right: 1px solid #ccc;
/* LTR */ }
ul.secondary a {
padding: 0;
text-decoration: none; }
ul.secondary a.active {
border-bottom: 4px solid #999; }
/** Form */
#node-form .form-region-main {
border-right: 1px solid #BFBFBF;
padding-right: 10px;
width: 68%; }
#node-form .form-region-main label {
float: left;
min-width: 25%; }
#node-form .form-region-main input.form-text {
width: 40%; }
#node-form .form-region-right {
padding-left: 5px; }
#node-form .form-region-right label {
float: left;
min-width: 35%; }
#node-form .form-region-right input.form-text {
width: 60%; }
#node-form .form-region-main label.option, #node-form .form-region-right label.option {
float: none; }
form:not(#views-ui-config-item-form) .form-item {
position: relative;
/* padding:9px;*/ }
form:not(#views-ui-config-item-form) .form-item .description {
position: absolute;
bottom: 140%;
/* right:-15px;*/
z-index: 5;
left: 50%;
color: #1A1A1A;
line-height: 1.1;
background: url(../images/popup.png) 50% 100% no-repeat;
width: 240px;
margin: 0px 0px -15px;
padding: 9px 10px 20px;
display: none;
border-top: 1px solid #9F9F9F; }
form:not(#views-ui-config-item-form) .form-item:hover {
z-index: 1;
height: auto;
/* Fix for flicker in IE7 */ }
form:not(#views-ui-config-item-form) .form-item:hover > .description {
display: block; }
fieldset {
border: 1px solid #D4D4D4;
padding: 10px;
margin-bottom: 1em;
border-radius: 5px; }
fieldset legend {
font-size: 1.6em; }
input.form-text {
max-width: 95%; }
/** TABLE */
table {
width: 100%;
border-radius: 5px; }
table thead th {
background-color: #CCC;
padding: 0.5em 1em;
text-align: left; }
table tbody tr.even, table tbody tr.odd {
border-bottom: 0 solid #CCCCCC;
padding: 0.1em 0.6em; }
table tbody tr.even {
background-color: #EEE; }
table tbody tr.odd {
background-color: #E5E5E5; }
table tbody td {
padding: 0.5em 1em;
text-align: left; }
td.active {
background-color: transparent; }
+161
View File
@@ -0,0 +1,161 @@
@charset "UTF-8";
/* LISIBILITY */
* {
font-size: 14px; }
div {
border: 1px dashed #D4D4D4; }
p:after, ul:after {
content: "¬";
color: red; }
h1:before, h2:before, h3:before, h4:before, h5:before, h6:before {
color: blue;
font-weight: normal;
font-size: 10px;
vertical-align: super; }
h1:before {
content: "h1 "; }
h2:before {
content: "h2 "; }
h3:before {
content: "h3 "; }
h4:before {
content: "h4 "; }
h5:before {
content: "h5 "; }
h6:before {
content: "h6 "; }
h2 {
font-size: 24px; }
h3 {
font-size: 18px; }
h4 {
font-size: 16px; }
h5 {
font-size: 14px; }
h6 {
font-size: 12px; }
br:after {
content: "·";
color: red;
border: 1px solid #999; }
/* LAYOUT AND GRAPHICS */
img {
height: auto;
margin: 0.5em 0; }
p {
border: 1px dashed #848484; }
div {
border: 1px solid #1A1A1A; }
img, p, div {
position: relative; }
img:before, p:before, div:before {
font-size: 10px;
color: red;
background-color: #1A1A1A;
position: absolute;
top: 0;
z-index: 3000; }
img.full, p.full, div.full {
width: 99%; }
img.full:before, p.full:before, div.full:before {
content: " full "; }
img.demi, p.demi, div.demi {
width: 47%;
margin-right: 2%; }
img.demi:before, p.demi:before, div.demi:before {
content: " demi ";
right: 0; }
img.tiers, p.tiers, div.tiers {
width: 29%;
margin-right: 2%; }
img.tiers:before, p.tiers:before, div.tiers:before {
content: " tiers ";
right: 0; }
img.quart, p.quart, div.quart {
width: 23%;
margin-right: 2%; }
img.quart:before, p.quart:before, div.quart:before {
content: " quart ";
right: 0; }
img.demi-left, p.demi-left, div.demi-left {
width: 47%;
float: left;
margin-right: 2%; }
img.demi-left:before, p.demi-left:before, div.demi-left:before {
content: " demi-left ";
left: 0; }
img.demi-right, p.demi-right, div.demi-right {
width: 47%;
float: right;
margin-left: 2%; }
img.demi-right:before, p.demi-right:before, div.demi-right:before {
content: " demi-right ";
right: 0; }
img.demi-center, p.demi-center, div.demi-center {
width: 47%;
display: block;
margin: 0 auto; }
img.demi-center:before, p.demi-center:before, div.demi-center:before {
content: " demi-denter ";
right: 0; }
img.tiers-left, p.tiers-left, div.tiers-left {
width: 29%;
float: left;
margin-right: 2%; }
img.tiers-left:before, p.tiers-left:before, div.tiers-left:before {
content: " tiers-left ";
left: 0; }
img.tiers-right, p.tiers-right, div.tiers-right {
width: 29%;
float: right;
margin-left: 2%; }
img.tiers-right:before, p.tiers-right:before, div.tiers-right:before {
content: " tiers-right ";
right: 0; }
img.tiers-center, p.tiers-center, div.tiers-center {
width: 29%;
display: block;
margin: 0 auto; }
img.tiers-center:before, p.tiers-center:before, div.tiers-center:before {
content: " tiers-center ";
right: 0; }
img.quart-left, p.quart-left, div.quart-left {
width: 23%;
float: left;
margin-right: 2%; }
img.quart-left:before, p.quart-left:before, div.quart-left:before {
content: " quart-left ";
left: 0; }
img.quart-right, p.quart-right, div.quart-right {
width: 23%;
float: right;
margin-left: 2%; }
img.quart-right:before, p.quart-right:before, div.quart-right:before {
content: " quart-right ";
right: 0; }
img.quart-center, p.quart-center, div.quart-center {
width: 23%;
display: block;
margin: 0 auto; }
img.quart-center:before, p.quart-center:before, div.quart-center:before {
content: " quart-center ";
right: 0; }
@@ -1,23 +0,0 @@
/* $Id: maintenance.css,v 1.1 2007/11/30 12:19:10 goba Exp $ */
/* Update styles */
#update-results {
margin-top: 3em;
padding: 0.25em;
border: 1px solid #ccc;
background: #eee;
font-size: smaller;
}
#update-results h2 {
margin-top: 0.25em;
}
#update-results h4 {
margin-bottom: 0.25em;
}
#update-results li.none {
color: #888;
font-style: italic;
}
#update-results li.failure strong {
color: #b63300;
}
@@ -1,64 +0,0 @@
/* ==|== non-semantic helper classes ========================================
Please define your styles before this section.
========================================================================== */
/* For image replacement */
.ir { display: block; border: 0; text-indent: -999em; overflow: hidden; background-color: transparent; background-repeat: no-repeat; text-align: left; direction: ltr; }
.ir br { display: none; }
/* Hide from both screenreaders and browsers: h5bp.com/u */
.hidden { display: none !important; visibility: hidden; }
/* Hide only visually, but have it available for screenreaders: h5bp.com/v */
.visuallyhidden { border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; }
/* Extends the .visuallyhidden class to allow the element to be focusable when navigated to via the keyboard: h5bp.com/p */
.visuallyhidden.focusable:active, .visuallyhidden.focusable:focus { clip: auto; height: auto; margin: 0; overflow: visible; position: static; width: auto; }
/* Hide visually and from screenreaders, but maintain layout */
.invisible { visibility: hidden; }
/* Contain floats: h5bp.com/q */
.clearfix:before, .clearfix:after { content: ""; display: table; }
.clearfix:after { clear: both; }
.clearfix { zoom: 1; }
/* ==|== media queries ======================================================
PLACEHOLDER Media Queries for Responsive Design.
These override the primary ('mobile first') styles
Modify as content requires.
========================================================================== */
@media only screen and (min-width: 480px) {
/* Style adjustments for viewports 480px and over go here */
}
@media only screen and (min-width: 768px) {
/* Style adjustments for viewports 768px and over go here */
}
/* ==|== print styles =======================================================
Print styles.
Inlined to avoid required HTTP connection: h5bp.com/r
========================================================================== */
@media print {
* { background: transparent !important; color: black !important; text-shadow: none !important; filter:none !important; -ms-filter: none !important; } /* Black prints faster: h5bp.com/s */
a, a:visited { text-decoration: underline; }
a[href]:after { content: " (" attr(href) ")"; }
abbr[title]:after { content: " (" attr(title) ")"; }
.ir a:after, a[href^="javascript:"]:after, a[href^="#"]:after { content: ""; } /* Don't show links for images, or javascript/internal links */
pre, blockquote { border: 1px solid #999; page-break-inside: avoid; }
thead { display: table-header-group; } /* h5bp.com/t */
tr, img { page-break-inside: avoid; }
img { max-width: 100% !important; }
@page { margin: 0.5cm; }
p, h2, h3 { orphans: 3; widows: 3; }
h2, h3 { page-break-after: avoid; }
}
@@ -1,406 +0,0 @@
/*! normalize.css v2.1.3 | MIT License | git.io/normalize */
/* ==========================================================================
HTML5 display definitions
========================================================================== */
/**
* Correct `block` display not defined in IE 8/9.
*/
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
main,
nav,
section,
summary {
display: block;
}
/**
* Correct `inline-block` display not defined in IE 8/9.
*/
audio,
canvas,
video {
display: inline-block;
}
/**
* Prevent modern browsers from displaying `audio` without controls.
* Remove excess height in iOS 5 devices.
*/
audio:not([controls]) {
display: none;
height: 0;
}
/**
* Address `[hidden]` styling not present in IE 8/9.
* Hide the `template` element in IE, Safari, and Firefox < 22.
*/
[hidden],
template {
display: none;
}
/* ==========================================================================
Base
========================================================================== */
/**
* 1. Set default font family to sans-serif.
* 2. Prevent iOS text size adjust after orientation change, without disabling
* user zoom.
*/
html {
font-family: sans-serif; /* 1 */
-ms-text-size-adjust: 100%; /* 2 */
-webkit-text-size-adjust: 100%; /* 2 */
}
/**
* Remove default margin.
*/
body {
margin: 0;
}
/* ==========================================================================
Links
========================================================================== */
/**
* Remove the gray background color from active links in IE 10.
*/
a {
background: transparent;
}
/**
* Address `outline` inconsistency between Chrome and other browsers.
*/
a:focus {
outline: thin dotted;
}
/**
* Improve readability when focused and also mouse hovered in all browsers.
*/
a:active,
a:hover {
outline: 0;
}
/* ==========================================================================
Typography
========================================================================== */
/**
* Address variable `h1` font-size and margin within `section` and `article`
* contexts in Firefox 4+, Safari 5, and Chrome.
*/
h1 {
font-size: 2em;
margin: 0.67em 0;
}
/**
* Address styling not present in IE 8/9, Safari 5, and Chrome.
*/
abbr[title] {
border-bottom: 1px dotted;
}
/**
* Address style set to `bolder` in Firefox 4+, Safari 5, and Chrome.
*/
b,
strong {
font-weight: bold;
}
/**
* Address styling not present in Safari 5 and Chrome.
*/
dfn {
font-style: italic;
}
/**
* Address differences between Firefox and other browsers.
*/
hr {
-moz-box-sizing: content-box;
box-sizing: content-box;
height: 0;
}
/**
* Address styling not present in IE 8/9.
*/
mark {
background: #ff0;
color: #000;
}
/**
* Correct font family set oddly in Safari 5 and Chrome.
*/
code,
kbd,
pre,
samp {
font-family: monospace, serif;
font-size: 1em;
}
/**
* Improve readability of pre-formatted text in all browsers.
*/
pre {
white-space: pre-wrap;
}
/**
* Set consistent quote types.
*/
q {
quotes: "\201C" "\201D" "\2018" "\2019";
}
/**
* Address inconsistent and variable font size in all browsers.
*/
small {
font-size: 80%;
}
/**
* Prevent `sub` and `sup` affecting `line-height` in all browsers.
*/
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sup {
top: -0.5em;
}
sub {
bottom: -0.25em;
}
/* ==========================================================================
Embedded content
========================================================================== */
/**
* Remove border when inside `a` element in IE 8/9.
*/
img {
border: 0;
}
/**
* Correct overflow displayed oddly in IE 9.
*/
svg:not(:root) {
overflow: hidden;
}
/* ==========================================================================
Figures
========================================================================== */
/**
* Address margin not present in IE 8/9 and Safari 5.
*/
figure {
margin: 0;
}
/* ==========================================================================
Forms
========================================================================== */
/**
* Define consistent border, margin, and padding.
*/
fieldset {
border: 1px solid #c0c0c0;
margin: 0 2px;
padding: 0.35em 0.625em 0.75em;
}
/**
* 1. Correct `color` not being inherited in IE 8/9.
* 2. Remove padding so people aren't caught out if they zero out fieldsets.
*/
legend {
border: 0; /* 1 */
padding: 0; /* 2 */
}
/**
* 1. Correct font family not being inherited in all browsers.
* 2. Correct font size not being inherited in all browsers.
* 3. Address margins set differently in Firefox 4+, Safari 5, and Chrome.
*/
button,
input,
select,
textarea {
font-family: inherit; /* 1 */
font-size: 100%; /* 2 */
margin: 0; /* 3 */
}
/**
* Address Firefox 4+ setting `line-height` on `input` using `!important` in
* the UA stylesheet.
*/
button,
input {
line-height: normal;
}
/**
* Address inconsistent `text-transform` inheritance for `button` and `select`.
* All other form control elements do not inherit `text-transform` values.
* Correct `button` style inheritance in Chrome, Safari 5+, and IE 8+.
* Correct `select` style inheritance in Firefox 4+ and Opera.
*/
button,
select {
text-transform: none;
}
/**
* 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`
* and `video` controls.
* 2. Correct inability to style clickable `input` types in iOS.
* 3. Improve usability and consistency of cursor style between image-type
* `input` and others.
*/
button,
html input[type="button"], /* 1 */
input[type="reset"],
input[type="submit"] {
-webkit-appearance: button; /* 2 */
cursor: pointer; /* 3 */
}
/**
* Re-set default cursor for disabled elements.
*/
button[disabled],
html input[disabled] {
cursor: default;
}
/**
* 1. Address box sizing set to `content-box` in IE 8/9/10.
* 2. Remove excess padding in IE 8/9/10.
*/
input[type="checkbox"],
input[type="radio"] {
box-sizing: border-box; /* 1 */
padding: 0; /* 2 */
}
/**
* 1. Address `appearance` set to `searchfield` in Safari 5 and Chrome.
* 2. Address `box-sizing` set to `border-box` in Safari 5 and Chrome
* (include `-moz` to future-proof).
*/
input[type="search"] {
-webkit-appearance: textfield; /* 1 */
-moz-box-sizing: content-box;
-webkit-box-sizing: content-box; /* 2 */
box-sizing: content-box;
}
/**
* Remove inner padding and search cancel button in Safari 5 and Chrome
* on OS X.
*/
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
/**
* Remove inner padding and border in Firefox 4+.
*/
button::-moz-focus-inner,
input::-moz-focus-inner {
border: 0;
padding: 0;
}
/**
* 1. Remove default vertical scrollbar in IE 8/9.
* 2. Improve readability and alignment in all browsers.
*/
textarea {
overflow: auto; /* 1 */
vertical-align: top; /* 2 */
}
/* ==========================================================================
Tables
========================================================================== */
/**
* Remove most spacing between table cells.
*/
table {
border-collapse: collapse;
border-spacing: 0;
}
File diff suppressed because one or more lines are too long
@@ -1,10 +1,8 @@
/**
* Primary Drupal Styles
* Author: g-u-i.net
* Author: Bachir Soussi Chiadmi
*/
@import "gui.less";
body{font-size:16px; font-family: Arial, "MS Trebuchet", sans-serif;}
+67
View File
@@ -0,0 +1,67 @@
/* LISIBILITY */
*{font-size:14px;}
div{border: 1px dashed #D4D4D4;}
p:after, ul:after{content:"¬"; color:red;}
h1:before, h2:before, h3:before, h4:before, h5:before, h6:before{
color:blue; font-weight: normal; font-size:10px; vertical-align: super;
}
h1:before{content:"h1 ";}
h2:before{content:"h2 ";}
h3:before{content:"h3 ";}
h4:before{content:"h4 ";}
h5:before{content:"h5 ";}
h6:before{content:"h6 ";}
h2{font-size:24px;}
h3{font-size:18px;}
h4{font-size:16px;}
h5{font-size:14px;}
h6{font-size:12px;}
.side-note-4{}
.side-note-5{}
br:after{content:"·"; color:red; border: 1px solid #999;}
/* LAYOUT AND GRAPHICS */
@mixin full{ width:99%; }
@mixin demi{ width:47%; }
@mixin tiers{ width:29%; }
@mixin quart{ width:23%; }
@mixin right{ float:right; margin-left:2%; }
@mixin left{ float:left; margin-right:2%; }
@mixin center{ display:block; margin:0 auto; }
img{height:auto; margin:0.5em 0;}
p{ border: 1px dashed #848484; }
div{border: 1px solid #1A1A1A;}
img,p,div{ position:relative;
&:before{font-size:10px; color:red; background-color: #1A1A1A; position:absolute; top:0; z-index:3000;}
&.full{@include full; &:before{content:" full ";}}
&.demi{ @include demi; margin-right:2%; &:before{content:" demi "; right:0;}}
&.tiers{ @include tiers; margin-right:2%; &:before{content:" tiers "; right:0;}}
&.quart{ @include quart; margin-right:2%; &:before{content:" quart "; right:0;}}
&.demi-left{ @include demi; @include left; &:before{content:" demi-left "; left:0;}}
&.demi-right{ @include demi; @include right; &:before{content:" demi-right "; right:0;}}
&.demi-center{ @include demi; @include center; &:before{content:" demi-denter "; right:0;}}
&.tiers-left{ @include tiers; @include left; &:before{content:" tiers-left "; left:0;}}
&.tiers-right{ @include tiers; @include right; &:before{content:" tiers-right "; right:0;}}
&.tiers-center{ @include tiers; @include center; &:before{content:" tiers-center "; right:0;}}
&.quart-left{ @include quart; @include left; &:before{content:" quart-left "; left:0;}}
&.quart-right{ @include quart; @include right; &:before{content:" quart-right "; right:0;}}
&.quart-center{ @include quart; @include center; &:before{content:" quart-center "; right:0;}}
}
@@ -0,0 +1,41 @@
'use strict';
var gulp = require('gulp');
var sass = require('gulp-sass');
var watch = require('gulp-watch');
var autoprefixer = require('gulp-autoprefixer');
var jsmin = require('gulp-jsmin');
var rename = require('gulp-rename');
gulp.task('scripts', function () {
gulp.src('./js/*.js')
.pipe(jsmin())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('./js/dist/'));
});
gulp.task('styles', function () {
gulp.src('./css/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(autoprefixer({
browsers: ['last 2 versions'],
cascade: false
}))
.pipe(gulp.dest('./css/dist'));
// gulp.src('./css/*.css')
// .pipe(autoprefixer({
// browsers: ['last 2 versions'],
// cascade: false
// }))
// .pipe(gulp.dest('./css'));
});
gulp.task('default', function () {
});
// default gulp task
gulp.task('default', ['scripts', 'styles'], function() {
gulp.watch('./css/*.scss', ['styles']);
gulp.watch('./js/*.js', ['scripts']);
});
+3
View File
@@ -0,0 +1,3 @@
Drupal.behaviors.init_theme=function(context){$('#messages-and-help > div.messages:not(.processed)').addClass('processed').each(function(){if($('a',this).size()||$(this).is('.error')||$(this).is('.warning')||$(this).text().length>100){$(this).prepend("<span class='close'>X</span>");$('span.close',this).click(function(){$(this).parent().slideUp('fast');});}
else{$(this).animate({opacity:1},5000,'linear',function(){$(this).slideUp('fast');});}});};
@@ -1,68 +0,0 @@
/* LISIBILITY */
@import "fonts.less";
*{font-size:14px;}
div{border: 1px dashed #D4D4D4;}
p:after, ul:after{content:"¬"; color:red;}
h1:before, h2:before, h3:before, h4:before, h5:before, h6:before{
color:blue; font-weight: normal; font-size:10px; vertical-align: super;
}
h1:before{content:"h1 ";}
h2:before{content:"h2 ";}
h3:before{content:"h3 ";}
h4:before{content:"h4 ";}
h5:before{content:"h5 ";}
h6:before{content:"h6 ";}
h2{font-size:24px; .h2;}
h3{font-size:18px; .h3;}
h4{font-size:16px; .h4;}
h5{font-size:14px; .h5;}
h6{font-size:12px; .h6;}
.side-note-4{.h4;}
.side-note-5{.h5;}
br:after{content:"·"; color:red; border: 1px solid #999;}
/* LAYOUT AND GRAPHICS */
#full{ width:99%; }
#demi{ width:47%; }
#tiers{ width:29%; }
#quart{ width:23%; }
#right{ float:right; margin-left:2%; }
#left{ float:left; margin-right:2%; }
#center{ display:block; margin:0 auto; }
img{height:auto; margin:0.5em 0;}
p{ .p; border: 1px dashed #848484; }
div{border: 1px solid #1A1A1A;}
img,p,div{ position:relative;
&:before{font-size:10px; color:red; background-color: #1A1A1A; position:absolute; top:0; z-index:3000;}
&.full{#full; &:before{content:" full ";}}
&.demi{ #demi; margin-right:2%; &:before{content:" demi "; right:0;}}
&.tiers{ #tiers; margin-right:2%; &:before{content:" tiers "; right:0;}}
&.quart{ #quart; margin-right:2%; &:before{content:" quart "; right:0;}}
&.demi-left{ #demi; #left; &:before{content:" demi-left "; left:0;}}
&.demi-right{ #demi; #right; &:before{content:" demi-right "; right:0;}}
&.demi-center{ #demi; #center; &:before{content:" demi-denter "; right:0;}}
&.tiers-left{ #tiers; #left; &:before{content:" tiers-left "; left:0;}}
&.tiers-right{ #tiers; #right; &:before{content:" tiers-right "; right:0;}}
&.tiers-center{ #tiers; #center; &:before{content:" tiers-center "; right:0;}}
&.quart-left{ #quart; #left; &:before{content:" quart-left "; left:0;}}
&.quart-right{ #quart; #right; &:before{content:" quart-right "; right:0;}}
&.quart-center{ #quart; #center; &:before{content:" quart-center "; right:0;}}
}
+1
View File
@@ -0,0 +1 @@
../browserslist/cli.js
+1
View File
@@ -0,0 +1 @@
../gulp/bin/gulp.js
+1
View File
@@ -0,0 +1 @@
../har-validator/bin/har-validator
+1
View File
@@ -0,0 +1 @@
../in-publish/in-install.js
+1
View File
@@ -0,0 +1 @@
../in-publish/in-publish.js
+1
View File
@@ -0,0 +1 @@
../mkdirp/bin/cmd.js
+1
View File
@@ -0,0 +1 @@
../node-gyp/bin/node-gyp.js
+1
View File
@@ -0,0 +1 @@
../node-sass/bin/node-sass
+1
View File
@@ -0,0 +1 @@
../nopt/bin/nopt.js
+1
View File
@@ -0,0 +1 @@
../in-publish/not-in-install.js
+1
View File
@@ -0,0 +1 @@
../in-publish/not-in-publish.js
+1
View File
@@ -0,0 +1 @@
../rimraf/bin.js
+1
View File
@@ -0,0 +1 @@
../sass-graph/bin/sassgraph
+1
View File
@@ -0,0 +1 @@
../semver/bin/semver
+1
View File
@@ -0,0 +1 @@
../sshpk/bin/sshpk-conv
+1
View File
@@ -0,0 +1 @@
../sshpk/bin/sshpk-sign
+1
View File
@@ -0,0 +1 @@
../sshpk/bin/sshpk-verify
+1
View File
@@ -0,0 +1 @@
../strip-bom/cli.js
+1
View File
@@ -0,0 +1 @@
../strip-indent/cli.js
+1
View File
@@ -0,0 +1 @@
../user-home/cli.js
+1
View File
@@ -0,0 +1 @@
../which/bin/which
+1
View File
@@ -0,0 +1 @@
../window-size/cli.js
+15
View File
@@ -0,0 +1,15 @@
The ISC License
Copyright (c) Isaac Z. Schlueter and Contributors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+23
View File
@@ -0,0 +1,23 @@
# abbrev-js
Just like [ruby's Abbrev](http://apidock.com/ruby/Abbrev).
Usage:
var abbrev = require("abbrev");
abbrev("foo", "fool", "folding", "flop");
// returns:
{ fl: 'flop'
, flo: 'flop'
, flop: 'flop'
, fol: 'folding'
, fold: 'folding'
, foldi: 'folding'
, foldin: 'folding'
, folding: 'folding'
, foo: 'foo'
, fool: 'fool'
}
This is handy for command-line scripts, or other cases where you want to be able to accept shorthands.
+62
View File
@@ -0,0 +1,62 @@
module.exports = exports = abbrev.abbrev = abbrev
abbrev.monkeyPatch = monkeyPatch
function monkeyPatch () {
Object.defineProperty(Array.prototype, 'abbrev', {
value: function () { return abbrev(this) },
enumerable: false, configurable: true, writable: true
})
Object.defineProperty(Object.prototype, 'abbrev', {
value: function () { return abbrev(Object.keys(this)) },
enumerable: false, configurable: true, writable: true
})
}
function abbrev (list) {
if (arguments.length !== 1 || !Array.isArray(list)) {
list = Array.prototype.slice.call(arguments, 0)
}
for (var i = 0, l = list.length, args = [] ; i < l ; i ++) {
args[i] = typeof list[i] === "string" ? list[i] : String(list[i])
}
// sort them lexicographically, so that they're next to their nearest kin
args = args.sort(lexSort)
// walk through each, seeing how much it has in common with the next and previous
var abbrevs = {}
, prev = ""
for (var i = 0, l = args.length ; i < l ; i ++) {
var current = args[i]
, next = args[i + 1] || ""
, nextMatches = true
, prevMatches = true
if (current === next) continue
for (var j = 0, cl = current.length ; j < cl ; j ++) {
var curChar = current.charAt(j)
nextMatches = nextMatches && curChar === next.charAt(j)
prevMatches = prevMatches && curChar === prev.charAt(j)
if (!nextMatches && !prevMatches) {
j ++
break
}
}
prev = current
if (j === cl) {
abbrevs[current] = current
continue
}
for (var a = current.substr(0, j) ; j <= cl ; j ++) {
abbrevs[a] = current
a += current.charAt(j)
}
}
return abbrevs
}
function lexSort (a, b) {
return a === b ? 0 : a > b ? 1 : -1
}
@@ -0,0 +1,89 @@
{
"_args": [
[
{
"raw": "abbrev@1",
"scope": null,
"escapedName": "abbrev",
"name": "abbrev",
"rawSpec": "1",
"spec": ">=1.0.0 <2.0.0",
"type": "range"
},
"/mnt/Data/bach/Sites/clameurs.org/sites/all/themes/figureslibres/clameurs/node_modules/nopt"
]
],
"_from": "abbrev@>=1.0.0 <2.0.0",
"_id": "abbrev@1.0.9",
"_inCache": true,
"_location": "/abbrev",
"_nodeVersion": "4.4.4",
"_npmOperationalInternal": {
"host": "packages-16-east.internal.npmjs.com",
"tmp": "tmp/abbrev-1.0.9.tgz_1466016055839_0.7825860097073019"
},
"_npmUser": {
"name": "isaacs",
"email": "i@izs.me"
},
"_npmVersion": "3.9.1",
"_phantomChildren": {},
"_requested": {
"raw": "abbrev@1",
"scope": null,
"escapedName": "abbrev",
"name": "abbrev",
"rawSpec": "1",
"spec": ">=1.0.0 <2.0.0",
"type": "range"
},
"_requiredBy": [
"/nopt"
],
"_resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.0.9.tgz",
"_shasum": "91b4792588a7738c25f35dd6f63752a2f8776135",
"_shrinkwrap": null,
"_spec": "abbrev@1",
"_where": "/mnt/Data/bach/Sites/clameurs.org/sites/all/themes/figureslibres/clameurs/node_modules/nopt",
"author": {
"name": "Isaac Z. Schlueter",
"email": "i@izs.me"
},
"bugs": {
"url": "https://github.com/isaacs/abbrev-js/issues"
},
"dependencies": {},
"description": "Like ruby's abbrev module, but in js",
"devDependencies": {
"tap": "^5.7.2"
},
"directories": {},
"dist": {
"shasum": "91b4792588a7738c25f35dd6f63752a2f8776135",
"tarball": "https://registry.npmjs.org/abbrev/-/abbrev-1.0.9.tgz"
},
"files": [
"abbrev.js"
],
"gitHead": "c386cd9dbb1d8d7581718c54d4ba944cc9298d6f",
"homepage": "https://github.com/isaacs/abbrev-js#readme",
"license": "ISC",
"main": "abbrev.js",
"maintainers": [
{
"name": "isaacs",
"email": "i@izs.me"
}
],
"name": "abbrev",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/isaacs/abbrev-js.git"
},
"scripts": {
"test": "tap test.js --cov"
},
"version": "1.0.9"
}
+58
View File
@@ -0,0 +1,58 @@
amdefine is released under two licenses: new BSD, and MIT. You may pick the
license that best suits your development needs. The text of both licenses are
provided below.
The "New" BSD License:
----------------------
Copyright (c) 2011-2016, The Dojo Foundation
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the Dojo Foundation nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
MIT License
-----------
Copyright (c) 2011-2016, The Dojo Foundation
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.
+171
View File
@@ -0,0 +1,171 @@
# amdefine
A module that can be used to implement AMD's define() in Node. This allows you
to code to the AMD API and have the module work in node programs without
requiring those other programs to use AMD.
## Usage
**1)** Update your package.json to indicate amdefine as a dependency:
```javascript
"dependencies": {
"amdefine": ">=0.1.0"
}
```
Then run `npm install` to get amdefine into your project.
**2)** At the top of each module that uses define(), place this code:
```javascript
if (typeof define !== 'function') { var define = require('amdefine')(module) }
```
**Only use these snippets** when loading amdefine. If you preserve the basic structure,
with the braces, it will be stripped out when using the [RequireJS optimizer](#optimizer).
You can add spaces, line breaks and even require amdefine with a local path, but
keep the rest of the structure to get the stripping behavior.
As you may know, because `if` statements in JavaScript don't have their own scope, the var
declaration in the above snippet is made whether the `if` expression is truthy or not. If
RequireJS is loaded then the declaration is superfluous because `define` is already already
declared in the same scope in RequireJS. Fortunately JavaScript handles multiple `var`
declarations of the same variable in the same scope gracefully.
If you want to deliver amdefine.js with your code rather than specifying it as a dependency
with npm, then just download the latest release and refer to it using a relative path:
[Latest Version](https://github.com/jrburke/amdefine/raw/latest/amdefine.js)
### amdefine/intercept
Consider this very experimental.
Instead of pasting the piece of text for the amdefine setup of a `define`
variable in each module you create or consume, you can use `amdefine/intercept`
instead. It will automatically insert the above snippet in each .js file loaded
by Node.
**Warning**: you should only use this if you are creating an application that
is consuming AMD style defined()'d modules that are distributed via npm and want
to run that code in Node.
For library code where you are not sure if it will be used by others in Node or
in the browser, then explicitly depending on amdefine and placing the code
snippet above is suggested path, instead of using `amdefine/intercept`. The
intercept module affects all .js files loaded in the Node app, and it is
inconsiderate to modify global state like that unless you are also controlling
the top level app.
#### Why distribute AMD-style modules via npm?
npm has a lot of weaknesses for front-end use (installed layout is not great,
should have better support for the `baseUrl + moduleID + '.js' style of loading,
single file JS installs), but some people want a JS package manager and are
willing to live with those constraints. If that is you, but still want to author
in AMD style modules to get dynamic require([]), better direct source usage and
powerful loader plugin support in the browser, then this tool can help.
#### amdefine/intercept usage
Just require it in your top level app module (for example index.js, server.js):
```javascript
require('amdefine/intercept');
```
The module does not return a value, so no need to assign the result to a local
variable.
Then just require() code as you normally would with Node's require(). Any .js
loaded after the intercept require will have the amdefine check injected in
the .js source as it is loaded. It does not modify the source on disk, just
prepends some content to the text of the module as it is loaded by Node.
#### How amdefine/intercept works
It overrides the `Module._extensions['.js']` in Node to automatically prepend
the amdefine snippet above. So, it will affect any .js file loaded by your
app.
## define() usage
It is best if you use the anonymous forms of define() in your module:
```javascript
define(function (require) {
var dependency = require('dependency');
});
```
or
```javascript
define(['dependency'], function (dependency) {
});
```
## RequireJS optimizer integration. <a name="optimizer"></name>
Version 1.0.3 of the [RequireJS optimizer](http://requirejs.org/docs/optimization.html)
will have support for stripping the `if (typeof define !== 'function')` check
mentioned above, so you can include this snippet for code that runs in the
browser, but avoid taking the cost of the if() statement once the code is
optimized for deployment.
## Node 0.4 Support
If you want to support Node 0.4, then add `require` as the second parameter to amdefine:
```javascript
//Only if you want Node 0.4. If using 0.5 or later, use the above snippet.
if (typeof define !== 'function') { var define = require('amdefine')(module, require) }
```
## Limitations
### Synchronous vs Asynchronous
amdefine creates a define() function that is callable by your code. It will
execute and trace dependencies and call the factory function *synchronously*,
to keep the behavior in line with Node's synchronous dependency tracing.
The exception: calling AMD's callback-style require() from inside a factory
function. The require callback is called on process.nextTick():
```javascript
define(function (require) {
require(['a'], function(a) {
//'a' is loaded synchronously, but
//this callback is called on process.nextTick().
});
});
```
### Loader Plugins
Loader plugins are supported as long as they call their load() callbacks
synchronously. So ones that do network requests will not work. However plugins
like [text](http://requirejs.org/docs/api.html#text) can load text files locally.
The plugin API's `load.fromText()` is **not supported** in amdefine, so this means
transpiler plugins like the [CoffeeScript loader plugin](https://github.com/jrburke/require-cs)
will not work. This may be fixable, but it is a bit complex, and I do not have
enough node-fu to figure it out yet. See the source for amdefine.js if you want
to get an idea of the issues involved.
## Tests
To run the tests, cd to **tests** and run:
```
node all.js
node all-intercept.js
```
## License
New BSD and MIT. Check the LICENSE file for all the details.
@@ -0,0 +1,301 @@
/** vim: et:ts=4:sw=4:sts=4
* @license amdefine 1.0.1 Copyright (c) 2011-2016, The Dojo Foundation All Rights Reserved.
* Available via the MIT or new BSD license.
* see: http://github.com/jrburke/amdefine for details
*/
/*jslint node: true */
/*global module, process */
'use strict';
/**
* Creates a define for node.
* @param {Object} module the "module" object that is defined by Node for the
* current module.
* @param {Function} [requireFn]. Node's require function for the current module.
* It only needs to be passed in Node versions before 0.5, when module.require
* did not exist.
* @returns {Function} a define function that is usable for the current node
* module.
*/
function amdefine(module, requireFn) {
'use strict';
var defineCache = {},
loaderCache = {},
alreadyCalled = false,
path = require('path'),
makeRequire, stringRequire;
/**
* Trims the . and .. from an array of path segments.
* It will keep a leading path segment if a .. will become
* the first path segment, to help with module name lookups,
* which act like paths, but can be remapped. But the end result,
* all paths that use this function should look normalized.
* NOTE: this method MODIFIES the input array.
* @param {Array} ary the array of path segments.
*/
function trimDots(ary) {
var i, part;
for (i = 0; ary[i]; i+= 1) {
part = ary[i];
if (part === '.') {
ary.splice(i, 1);
i -= 1;
} else if (part === '..') {
if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
//End of the line. Keep at least one non-dot
//path segment at the front so it can be mapped
//correctly to disk. Otherwise, there is likely
//no path mapping for a path starting with '..'.
//This can still fail, but catches the most reasonable
//uses of ..
break;
} else if (i > 0) {
ary.splice(i - 1, 2);
i -= 2;
}
}
}
}
function normalize(name, baseName) {
var baseParts;
//Adjust any relative paths.
if (name && name.charAt(0) === '.') {
//If have a base name, try to normalize against it,
//otherwise, assume it is a top-level require that will
//be relative to baseUrl in the end.
if (baseName) {
baseParts = baseName.split('/');
baseParts = baseParts.slice(0, baseParts.length - 1);
baseParts = baseParts.concat(name.split('/'));
trimDots(baseParts);
name = baseParts.join('/');
}
}
return name;
}
/**
* Create the normalize() function passed to a loader plugin's
* normalize method.
*/
function makeNormalize(relName) {
return function (name) {
return normalize(name, relName);
};
}
function makeLoad(id) {
function load(value) {
loaderCache[id] = value;
}
load.fromText = function (id, text) {
//This one is difficult because the text can/probably uses
//define, and any relative paths and requires should be relative
//to that id was it would be found on disk. But this would require
//bootstrapping a module/require fairly deeply from node core.
//Not sure how best to go about that yet.
throw new Error('amdefine does not implement load.fromText');
};
return load;
}
makeRequire = function (systemRequire, exports, module, relId) {
function amdRequire(deps, callback) {
if (typeof deps === 'string') {
//Synchronous, single module require('')
return stringRequire(systemRequire, exports, module, deps, relId);
} else {
//Array of dependencies with a callback.
//Convert the dependencies to modules.
deps = deps.map(function (depName) {
return stringRequire(systemRequire, exports, module, depName, relId);
});
//Wait for next tick to call back the require call.
if (callback) {
process.nextTick(function () {
callback.apply(null, deps);
});
}
}
}
amdRequire.toUrl = function (filePath) {
if (filePath.indexOf('.') === 0) {
return normalize(filePath, path.dirname(module.filename));
} else {
return filePath;
}
};
return amdRequire;
};
//Favor explicit value, passed in if the module wants to support Node 0.4.
requireFn = requireFn || function req() {
return module.require.apply(module, arguments);
};
function runFactory(id, deps, factory) {
var r, e, m, result;
if (id) {
e = loaderCache[id] = {};
m = {
id: id,
uri: __filename,
exports: e
};
r = makeRequire(requireFn, e, m, id);
} else {
//Only support one define call per file
if (alreadyCalled) {
throw new Error('amdefine with no module ID cannot be called more than once per file.');
}
alreadyCalled = true;
//Use the real variables from node
//Use module.exports for exports, since
//the exports in here is amdefine exports.
e = module.exports;
m = module;
r = makeRequire(requireFn, e, m, module.id);
}
//If there are dependencies, they are strings, so need
//to convert them to dependency values.
if (deps) {
deps = deps.map(function (depName) {
return r(depName);
});
}
//Call the factory with the right dependencies.
if (typeof factory === 'function') {
result = factory.apply(m.exports, deps);
} else {
result = factory;
}
if (result !== undefined) {
m.exports = result;
if (id) {
loaderCache[id] = m.exports;
}
}
}
stringRequire = function (systemRequire, exports, module, id, relId) {
//Split the ID by a ! so that
var index = id.indexOf('!'),
originalId = id,
prefix, plugin;
if (index === -1) {
id = normalize(id, relId);
//Straight module lookup. If it is one of the special dependencies,
//deal with it, otherwise, delegate to node.
if (id === 'require') {
return makeRequire(systemRequire, exports, module, relId);
} else if (id === 'exports') {
return exports;
} else if (id === 'module') {
return module;
} else if (loaderCache.hasOwnProperty(id)) {
return loaderCache[id];
} else if (defineCache[id]) {
runFactory.apply(null, defineCache[id]);
return loaderCache[id];
} else {
if(systemRequire) {
return systemRequire(originalId);
} else {
throw new Error('No module with ID: ' + id);
}
}
} else {
//There is a plugin in play.
prefix = id.substring(0, index);
id = id.substring(index + 1, id.length);
plugin = stringRequire(systemRequire, exports, module, prefix, relId);
if (plugin.normalize) {
id = plugin.normalize(id, makeNormalize(relId));
} else {
//Normalize the ID normally.
id = normalize(id, relId);
}
if (loaderCache[id]) {
return loaderCache[id];
} else {
plugin.load(id, makeRequire(systemRequire, exports, module, relId), makeLoad(id), {});
return loaderCache[id];
}
}
};
//Create a define function specific to the module asking for amdefine.
function define(id, deps, factory) {
if (Array.isArray(id)) {
factory = deps;
deps = id;
id = undefined;
} else if (typeof id !== 'string') {
factory = id;
id = deps = undefined;
}
if (deps && !Array.isArray(deps)) {
factory = deps;
deps = undefined;
}
if (!deps) {
deps = ['require', 'exports', 'module'];
}
//Set up properties for this module. If an ID, then use
//internal cache. If no ID, then use the external variables
//for this node module.
if (id) {
//Put the module in deep freeze until there is a
//require call for it.
defineCache[id] = [id, deps, factory];
} else {
runFactory(id, deps, factory);
}
}
//define.require, which has access to all the values in the
//cache. Useful for AMD modules that all have IDs in the file,
//but need to finally export a value to node based on one of those
//IDs.
define.require = function (id) {
if (loaderCache[id]) {
return loaderCache[id];
}
if (defineCache[id]) {
runFactory.apply(null, defineCache[id]);
return loaderCache[id];
}
};
define.amd = {};
return define;
}
module.exports = amdefine;
@@ -0,0 +1,36 @@
/*jshint node: true */
var inserted,
Module = require('module'),
fs = require('fs'),
existingExtFn = Module._extensions['.js'],
amdefineRegExp = /amdefine\.js/;
inserted = "if (typeof define !== 'function') {var define = require('amdefine')(module)}";
//From the node/lib/module.js source:
function stripBOM(content) {
// Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
// because the buffer-to-string conversion in `fs.readFileSync()`
// translates it to FEFF, the UTF-16 BOM.
if (content.charCodeAt(0) === 0xFEFF) {
content = content.slice(1);
}
return content;
}
//Also adapted from the node/lib/module.js source:
function intercept(module, filename) {
var content = stripBOM(fs.readFileSync(filename, 'utf8'));
if (!amdefineRegExp.test(module.id)) {
content = inserted + content;
}
module._compile(content, filename);
}
intercept._id = 'amdefine/intercept';
if (!existingExtFn._id || existingExtFn._id !== intercept._id) {
Module._extensions['.js'] = intercept;
}
@@ -0,0 +1,86 @@
{
"_args": [
[
{
"raw": "amdefine@>=0.0.4",
"scope": null,
"escapedName": "amdefine",
"name": "amdefine",
"rawSpec": ">=0.0.4",
"spec": ">=0.0.4",
"type": "range"
},
"/mnt/Data/bach/Sites/clameurs.org/sites/all/themes/figureslibres/clameurs/node_modules/source-map-index-generator/node_modules/source-map"
]
],
"_from": "amdefine@>=0.0.4",
"_id": "amdefine@1.0.1",
"_inCache": true,
"_location": "/amdefine",
"_nodeVersion": "6.7.0",
"_npmOperationalInternal": {
"host": "packages-18-east.internal.npmjs.com",
"tmp": "tmp/amdefine-1.0.1.tgz_1478062849665_0.19916908955201507"
},
"_npmUser": {
"name": "jrburke",
"email": "jrburke@gmail.com"
},
"_npmVersion": "3.10.3",
"_phantomChildren": {},
"_requested": {
"raw": "amdefine@>=0.0.4",
"scope": null,
"escapedName": "amdefine",
"name": "amdefine",
"rawSpec": ">=0.0.4",
"spec": ">=0.0.4",
"type": "range"
},
"_requiredBy": [
"/source-map-index-generator/source-map"
],
"_resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz",
"_shasum": "4a5282ac164729e93619bcfd3ad151f817ce91f5",
"_shrinkwrap": null,
"_spec": "amdefine@>=0.0.4",
"_where": "/mnt/Data/bach/Sites/clameurs.org/sites/all/themes/figureslibres/clameurs/node_modules/source-map-index-generator/node_modules/source-map",
"author": {
"name": "James Burke",
"email": "jrburke@gmail.com",
"url": "http://github.com/jrburke"
},
"bugs": {
"url": "https://github.com/jrburke/amdefine/issues"
},
"dependencies": {},
"description": "Provide AMD's define() API for declaring modules in the AMD format",
"devDependencies": {},
"directories": {},
"dist": {
"shasum": "4a5282ac164729e93619bcfd3ad151f817ce91f5",
"tarball": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz"
},
"engines": {
"node": ">=0.4.2"
},
"gitHead": "e59edc9da24404ec7937098e3992f8fb0e260be7",
"homepage": "http://github.com/jrburke/amdefine",
"license": "BSD-3-Clause OR MIT",
"main": "./amdefine.js",
"maintainers": [
{
"name": "jrburke",
"email": "jrburke@gmail.com"
}
],
"name": "amdefine",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git+https://github.com/jrburke/amdefine.git"
},
"scripts": {},
"version": "1.0.1"
}
@@ -0,0 +1,4 @@
'use strict';
module.exports = function () {
return /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-PRZcf-nqry=><]/g;
};
@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
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.
@@ -0,0 +1,132 @@
{
"_args": [
[
{
"raw": "ansi-regex@^2.0.0",
"scope": null,
"escapedName": "ansi-regex",
"name": "ansi-regex",
"rawSpec": "^2.0.0",
"spec": ">=2.0.0 <3.0.0",
"type": "range"
},
"/mnt/Data/bach/Sites/clameurs.org/sites/all/themes/figureslibres/clameurs/node_modules/has-ansi"
]
],
"_from": "ansi-regex@>=2.0.0 <3.0.0",
"_id": "ansi-regex@2.1.1",
"_inCache": true,
"_location": "/ansi-regex",
"_nodeVersion": "0.10.32",
"_npmOperationalInternal": {
"host": "packages-18-east.internal.npmjs.com",
"tmp": "tmp/ansi-regex-2.1.1.tgz_1484363378013_0.4482989883981645"
},
"_npmUser": {
"name": "qix",
"email": "i.am.qix@gmail.com"
},
"_npmVersion": "2.14.2",
"_phantomChildren": {},
"_requested": {
"raw": "ansi-regex@^2.0.0",
"scope": null,
"escapedName": "ansi-regex",
"name": "ansi-regex",
"rawSpec": "^2.0.0",
"spec": ">=2.0.0 <3.0.0",
"type": "range"
},
"_requiredBy": [
"/has-ansi",
"/strip-ansi"
],
"_resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
"_shasum": "c3b33ab5ee360d86e0e628f0468ae7ef27d654df",
"_shrinkwrap": null,
"_spec": "ansi-regex@^2.0.0",
"_where": "/mnt/Data/bach/Sites/clameurs.org/sites/all/themes/figureslibres/clameurs/node_modules/has-ansi",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"bugs": {
"url": "https://github.com/chalk/ansi-regex/issues"
},
"dependencies": {},
"description": "Regular expression for matching ANSI escape codes",
"devDependencies": {
"ava": "0.17.0",
"xo": "0.16.0"
},
"directories": {},
"dist": {
"shasum": "c3b33ab5ee360d86e0e628f0468ae7ef27d654df",
"tarball": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz"
},
"engines": {
"node": ">=0.10.0"
},
"files": [
"index.js"
],
"gitHead": "7c908e7b4eb6cd82bfe1295e33fdf6d166c7ed85",
"homepage": "https://github.com/chalk/ansi-regex#readme",
"keywords": [
"ansi",
"styles",
"color",
"colour",
"colors",
"terminal",
"console",
"cli",
"string",
"tty",
"escape",
"formatting",
"rgb",
"256",
"shell",
"xterm",
"command-line",
"text",
"regex",
"regexp",
"re",
"match",
"test",
"find",
"pattern"
],
"license": "MIT",
"maintainers": [
{
"name": "qix",
"email": "i.am.qix@gmail.com"
},
{
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
}
],
"name": "ansi-regex",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git+https://github.com/chalk/ansi-regex.git"
},
"scripts": {
"test": "xo && ava --verbose",
"view-supported": "node fixtures/view-codes.js"
},
"version": "2.1.1",
"xo": {
"rules": {
"guard-for-in": 0,
"no-loop-func": 0
}
}
}
@@ -0,0 +1,39 @@
# ansi-regex [![Build Status](https://travis-ci.org/chalk/ansi-regex.svg?branch=master)](https://travis-ci.org/chalk/ansi-regex)
> Regular expression for matching [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code)
## Install
```
$ npm install --save ansi-regex
```
## Usage
```js
const ansiRegex = require('ansi-regex');
ansiRegex().test('\u001b[4mcake\u001b[0m');
//=> true
ansiRegex().test('cake');
//=> false
'\u001b[4mcake\u001b[0m'.match(ansiRegex());
//=> ['\u001b[4m', '\u001b[0m']
```
## FAQ
### Why do you test for codes not in the ECMA 48 standard?
Some of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. If I recall correctly, we test for both standard and non-standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-standard control codes that do not follow the traditional format (i.e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them.
On the historical side, those ECMA standards were established in the early 90's whereas the VT100, for example, was designed in the mid/late 70's. At that point in time, control codes were still pretty ungoverned and engineers used them for a multitude of things, namely to activate hardware ports that may have been proprietary. Somewhere else you see a similar 'anarchy' of codes is in the x86 architecture for processors; there are a ton of "interrupts" that can mean different things on certain brands of processors, most of which have been phased out.
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)
@@ -0,0 +1,65 @@
'use strict';
function assembleStyles () {
var styles = {
modifiers: {
reset: [0, 0],
bold: [1, 22], // 21 isn't widely supported and 22 does the same thing
dim: [2, 22],
italic: [3, 23],
underline: [4, 24],
inverse: [7, 27],
hidden: [8, 28],
strikethrough: [9, 29]
},
colors: {
black: [30, 39],
red: [31, 39],
green: [32, 39],
yellow: [33, 39],
blue: [34, 39],
magenta: [35, 39],
cyan: [36, 39],
white: [37, 39],
gray: [90, 39]
},
bgColors: {
bgBlack: [40, 49],
bgRed: [41, 49],
bgGreen: [42, 49],
bgYellow: [43, 49],
bgBlue: [44, 49],
bgMagenta: [45, 49],
bgCyan: [46, 49],
bgWhite: [47, 49]
}
};
// fix humans
styles.colors.grey = styles.colors.gray;
Object.keys(styles).forEach(function (groupName) {
var group = styles[groupName];
Object.keys(group).forEach(function (styleName) {
var style = group[styleName];
styles[styleName] = group[styleName] = {
open: '\u001b[' + style[0] + 'm',
close: '\u001b[' + style[1] + 'm'
};
});
Object.defineProperty(styles, groupName, {
value: group,
enumerable: false
});
});
return styles;
}
Object.defineProperty(module, 'exports', {
enumerable: true,
get: assembleStyles
});
@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
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.
@@ -0,0 +1,114 @@
{
"_args": [
[
{
"raw": "ansi-styles@^2.2.1",
"scope": null,
"escapedName": "ansi-styles",
"name": "ansi-styles",
"rawSpec": "^2.2.1",
"spec": ">=2.2.1 <3.0.0",
"type": "range"
},
"/mnt/Data/bach/Sites/clameurs.org/sites/all/themes/figureslibres/clameurs/node_modules/chalk"
]
],
"_from": "ansi-styles@>=2.2.1 <3.0.0",
"_id": "ansi-styles@2.2.1",
"_inCache": true,
"_location": "/ansi-styles",
"_nodeVersion": "4.3.0",
"_npmOperationalInternal": {
"host": "packages-12-west.internal.npmjs.com",
"tmp": "tmp/ansi-styles-2.2.1.tgz_1459197317833_0.9694824463222176"
},
"_npmUser": {
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
},
"_npmVersion": "3.8.3",
"_phantomChildren": {},
"_requested": {
"raw": "ansi-styles@^2.2.1",
"scope": null,
"escapedName": "ansi-styles",
"name": "ansi-styles",
"rawSpec": "^2.2.1",
"spec": ">=2.2.1 <3.0.0",
"type": "range"
},
"_requiredBy": [
"/chalk"
],
"_resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz",
"_shasum": "b432dd3358b634cf75e1e4664368240533c1ddbe",
"_shrinkwrap": null,
"_spec": "ansi-styles@^2.2.1",
"_where": "/mnt/Data/bach/Sites/clameurs.org/sites/all/themes/figureslibres/clameurs/node_modules/chalk",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"bugs": {
"url": "https://github.com/chalk/ansi-styles/issues"
},
"dependencies": {},
"description": "ANSI escape codes for styling strings in the terminal",
"devDependencies": {
"mocha": "*"
},
"directories": {},
"dist": {
"shasum": "b432dd3358b634cf75e1e4664368240533c1ddbe",
"tarball": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz"
},
"engines": {
"node": ">=0.10.0"
},
"files": [
"index.js"
],
"gitHead": "95c59b23be760108b6530ca1c89477c21b258032",
"homepage": "https://github.com/chalk/ansi-styles#readme",
"keywords": [
"ansi",
"styles",
"color",
"colour",
"colors",
"terminal",
"console",
"cli",
"string",
"tty",
"escape",
"formatting",
"rgb",
"256",
"shell",
"xterm",
"log",
"logging",
"command-line",
"text"
],
"license": "MIT",
"maintainers": [
{
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
}
],
"name": "ansi-styles",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git+https://github.com/chalk/ansi-styles.git"
},
"scripts": {
"test": "mocha"
},
"version": "2.2.1"
}
@@ -0,0 +1,86 @@
# ansi-styles [![Build Status](https://travis-ci.org/chalk/ansi-styles.svg?branch=master)](https://travis-ci.org/chalk/ansi-styles)
> [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal
You probably want the higher-level [chalk](https://github.com/chalk/chalk) module for styling your strings.
![](screenshot.png)
## Install
```
$ npm install --save ansi-styles
```
## Usage
```js
var ansi = require('ansi-styles');
console.log(ansi.green.open + 'Hello world!' + ansi.green.close);
```
## API
Each style has an `open` and `close` property.
## Styles
### Modifiers
- `reset`
- `bold`
- `dim`
- `italic` *(not widely supported)*
- `underline`
- `inverse`
- `hidden`
- `strikethrough` *(not widely supported)*
### Colors
- `black`
- `red`
- `green`
- `yellow`
- `blue`
- `magenta`
- `cyan`
- `white`
- `gray`
### Background colors
- `bgBlack`
- `bgRed`
- `bgGreen`
- `bgYellow`
- `bgBlue`
- `bgMagenta`
- `bgCyan`
- `bgWhite`
## Advanced usage
By default you get a map of styles, but the styles are also available as groups. They are non-enumerable so they don't show up unless you access them explicitly. This makes it easier to expose only a subset in a higher-level module.
- `ansi.modifiers`
- `ansi.colors`
- `ansi.bgColors`
###### Example
```js
console.log(ansi.colors.green.open);
```
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)
+15
View File
@@ -0,0 +1,15 @@
The ISC License
Copyright (c) 2014 Elan Shanker
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
@@ -0,0 +1,91 @@
anymatch [![Build Status](https://travis-ci.org/es128/anymatch.svg?branch=master)](https://travis-ci.org/es128/anymatch) [![Coverage Status](https://img.shields.io/coveralls/es128/anymatch.svg?branch=master)](https://coveralls.io/r/es128/anymatch?branch=master)
======
Javascript module to match a string against a regular expression, glob, string,
or function that takes the string as an argument and returns a truthy or falsy
value. The matcher can also be an array of any or all of these. Useful for
allowing a very flexible user-defined config to define things like file paths.
[![NPM](https://nodei.co/npm/anymatch.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/anymatch/)
[![NPM](https://nodei.co/npm-dl/anymatch.png?height=3&months=9)](https://nodei.co/npm-dl/anymatch/)
Usage
-----
```sh
npm install anymatch --save
```
#### anymatch (matchers, testString, [returnIndex], [startIndex], [endIndex])
* __matchers__: (_Array|String|RegExp|Function_)
String to be directly matched, string with glob patterns, regular expression
test, function that takes the testString as an argument and returns a truthy
value if it should be matched, or an array of any number and mix of these types.
* __testString__: (_String|Array_) The string to test against the matchers. If
passed as an array, the first element of the array will be used as the
`testString` for non-function matchers, while the entire array will be applied
as the arguments for function matchers.
* __returnIndex__: (_Boolean [optional]_) If true, return the array index of
the first matcher that that testString matched, or -1 if no match, instead of a
boolean result.
* __startIndex, endIndex__: (_Integer [optional]_) Can be used to define a
subset out of the array of provided matchers to test against. Can be useful
with bound matcher functions (see below). When used with `returnIndex = true`
preserves original indexing. Behaves the same as `Array.prototype.slice` (i.e.
includes array members up to, but not including endIndex).
```js
var anymatch = require('anymatch');
var matchers = [
'path/to/file.js',
'path/anyjs/**/*.js',
/foo.js$/,
function (string) {
return string.indexOf('bar') !== -1 && string.length > 10
}
];
anymatch(matchers, 'path/to/file.js'); // true
anymatch(matchers, 'path/anyjs/baz.js'); // true
anymatch(matchers, 'path/to/foo.js'); // true
anymatch(matchers, 'path/to/bar.js'); // true
anymatch(matchers, 'bar.js'); // false
// returnIndex = true
anymatch(matchers, 'foo.js', true); // 2
anymatch(matchers, 'path/anyjs/foo.js', true); // 1
// skip matchers
anymatch(matchers, 'path/to/file.js', false, 1); // false
anymatch(matchers, 'path/anyjs/foo.js', true, 2, 3); // 2
anymatch(matchers, 'path/to/bar.js', true, 0, 3); // -1
```
#### anymatch (matchers)
You can also pass in only your matcher(s) to get a curried function that has
already been bound to the provided matching criteria. This can be used as an
`Array.prototype.filter` callback.
```js
var matcher = anymatch(matchers);
matcher('path/to/file.js'); // true
matcher('path/anyjs/baz.js', true); // 1
matcher('path/anyjs/baz.js', true, 2); // -1
['foo.js', 'bar.js'].filter(matcher); // ['foo.js']
```
Change Log
----------
[See release notes page on GitHub](https://github.com/es128/anymatch/releases)
NOTE: As of v1.2.0, anymatch uses [micromatch](https://github.com/jonschlinkert/micromatch)
for glob pattern matching. The glob matching behavior should be functionally
equivalent to the commonly used [minimatch](https://github.com/isaacs/minimatch)
library (aside from some fixed bugs and greater performance), so a major
version bump wasn't merited. Issues with glob pattern matching should be
reported directly to the [micromatch issue tracker](https://github.com/jonschlinkert/micromatch/issues).
License
-------
[ISC](https://raw.github.com/es128/anymatch/master/LICENSE)
+64
View File
@@ -0,0 +1,64 @@
'use strict';
var arrify = require('arrify');
var micromatch = require('micromatch');
var path = require('path');
var anymatch = function(criteria, value, returnIndex, startIndex, endIndex) {
criteria = arrify(criteria);
value = arrify(value);
if (arguments.length === 1) {
return anymatch.bind(null, criteria.map(function(criterion) {
return typeof criterion === 'string' && criterion[0] !== '!' ?
micromatch.matcher(criterion) : criterion;
}));
}
startIndex = startIndex || 0;
var string = value[0];
var altString;
var matched = false;
var matchIndex = -1;
function testCriteria (criterion, index) {
var result;
switch (toString.call(criterion)) {
case '[object String]':
result = string === criterion || altString && altString === criterion;
result = result || micromatch.isMatch(string, criterion);
break;
case '[object RegExp]':
result = criterion.test(string) || altString && criterion.test(altString);
break;
case '[object Function]':
result = criterion.apply(null, value);
break;
default:
result = false;
}
if (result) {
matchIndex = index + startIndex;
}
return result;
}
var crit = criteria;
var negGlobs = crit.reduce(function(arr, criterion, index) {
if (typeof criterion === 'string' && criterion[0] === '!') {
if (crit === criteria) {
// make a copy before modifying
crit = crit.slice();
}
crit[index] = null;
arr.push(criterion.substr(1));
}
return arr;
}, []);
if (!negGlobs.length || !micromatch.any(string, negGlobs)) {
if (path.sep === '\\' && typeof string === 'string') {
altString = string.split('\\').join('/');
altString = altString === string ? null : altString;
}
matched = crit.slice(startIndex, endIndex).some(testCriteria);
}
return returnIndex === true ? matchIndex : matched;
};
module.exports = anymatch;
@@ -0,0 +1,104 @@
{
"_args": [
[
{
"raw": "anymatch@^1.3.0",
"scope": null,
"escapedName": "anymatch",
"name": "anymatch",
"rawSpec": "^1.3.0",
"spec": ">=1.3.0 <2.0.0",
"type": "range"
},
"/mnt/Data/bach/Sites/clameurs.org/sites/all/themes/figureslibres/clameurs/node_modules/gulp-watch"
]
],
"_from": "anymatch@>=1.3.0 <2.0.0",
"_id": "anymatch@1.3.0",
"_inCache": true,
"_location": "/anymatch",
"_nodeVersion": "1.6.2",
"_npmUser": {
"name": "es128",
"email": "elan.shanker+npm@gmail.com"
},
"_npmVersion": "2.7.3",
"_phantomChildren": {},
"_requested": {
"raw": "anymatch@^1.3.0",
"scope": null,
"escapedName": "anymatch",
"name": "anymatch",
"rawSpec": "^1.3.0",
"spec": ">=1.3.0 <2.0.0",
"type": "range"
},
"_requiredBy": [
"/chokidar",
"/gulp-watch"
],
"_resolved": "https://registry.npmjs.org/anymatch/-/anymatch-1.3.0.tgz",
"_shasum": "a3e52fa39168c825ff57b0248126ce5a8ff95507",
"_shrinkwrap": null,
"_spec": "anymatch@^1.3.0",
"_where": "/mnt/Data/bach/Sites/clameurs.org/sites/all/themes/figureslibres/clameurs/node_modules/gulp-watch",
"author": {
"name": "Elan Shanker",
"url": "http://github.com/es128"
},
"bugs": {
"url": "https://github.com/es128/anymatch/issues"
},
"dependencies": {
"arrify": "^1.0.0",
"micromatch": "^2.1.5"
},
"description": "Matches strings against configurable strings, globs, regular expressions, and/or functions",
"devDependencies": {
"coveralls": "^2.11.2",
"istanbul": "^0.3.13",
"mocha": "^2.2.4"
},
"directories": {},
"dist": {
"shasum": "a3e52fa39168c825ff57b0248126ce5a8ff95507",
"tarball": "https://registry.npmjs.org/anymatch/-/anymatch-1.3.0.tgz"
},
"files": [
"index.js"
],
"gitHead": "253d2ad42f644ed18557f561312a7f8426daca84",
"homepage": "https://github.com/es128/anymatch",
"keywords": [
"match",
"any",
"string",
"file",
"fs",
"list",
"glob",
"regex",
"regexp",
"regular",
"expression",
"function"
],
"license": "ISC",
"maintainers": [
{
"name": "es128",
"email": "elan.shanker+npm@gmail.com"
}
],
"name": "anymatch",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git+https://github.com/es128/anymatch.git"
},
"scripts": {
"test": "istanbul cover _mocha && cat ./coverage/lcov.info | coveralls"
},
"version": "1.3.0"
}
+14
View File
@@ -0,0 +1,14 @@
Copyright (c) 2015, Rebecca Turner <me@re-becca.org>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+59
View File
@@ -0,0 +1,59 @@
aproba
======
A ridiculously light-weight function argument validator
```
var validate = require("aproba")
function myfunc(a, b, c) {
// `a` must be a string, `b` a number, `c` a function
validate('SNF', arguments) // [a,b,c] is also valid
}
myfunc('test', 23, function () {}) // ok
myfunc(123, 23, function () {}) // type error
myfunc('test', 23) // missing arg error
myfunc('test', 23, function () {}, true) // too many args error
```
Valid types are:
type | description
---- | -----------
* | matches any type
A | Array.isArray OR an arguments object
S | typeof == string
N | typeof == number
F | typeof == function
O | typeof == object and not type A and not type E
B | typeof == boolean
E | instanceof Error OR null
Validation failures throw one of three exception types, distinguished by a
`code` property of `EMISSINGARG`, `EINVALIDTYPE` or `ETOOMANYARGS`.
If you pass in an invalid type then it will throw with a code of
`EUNKNOWNTYPE`.
If an error argument is found and is not null then the remaining arguments
will not be validated.
### Why this exists
I wanted a very simple argument validator. It needed to do two things:
1. Be more concise and easier to use than assertions
2. Not encourage an infinite bikeshed of DSLs
This is why types are specified by a single character and there's no such
thing as an optional argument.
This is not intended to validate user data. This is specifically about
asserting the interface of your functions.
If you need greater validation, I encourage you to write them by hand or
look elsewhere.
+62
View File
@@ -0,0 +1,62 @@
'use strict'
function isArguments (thingy) {
return typeof thingy === 'object' && thingy.hasOwnProperty('callee')
}
var types = {
'*': ['any', function () { return true }],
A: ['array', function (thingy) { return Array.isArray(thingy) || isArguments(thingy) }],
S: ['string', function (thingy) { return typeof thingy === 'string' }],
N: ['number', function (thingy) { return typeof thingy === 'number' }],
F: ['function', function (thingy) { return typeof thingy === 'function' }],
O: ['object', function (thingy) { return typeof thingy === 'object' && !types.A[1](thingy) && !types.E[1](thingy) }],
B: ['boolean', function (thingy) { return typeof thingy === 'boolean' }],
E: ['error', function (thingy) { return thingy instanceof Error }]
}
var validate = module.exports = function (schema, args) {
if (!schema) throw missingRequiredArg(0, 'schema')
if (!args) throw missingRequiredArg(1, 'args')
if (!types.S[1](schema)) throw invalidType(0, 'string', schema)
if (!types.A[1](args)) throw invalidType(1, 'array', args)
for (var ii = 0; ii < schema.length; ++ii) {
var type = schema[ii]
if (!types[type]) throw unknownType(ii, type)
var typeLabel = types[type][0]
var typeCheck = types[type][1]
if (type === 'E' && args[ii] == null) continue
if (args[ii] == null) throw missingRequiredArg(ii)
if (!typeCheck(args[ii])) throw invalidType(ii, typeLabel, args[ii])
if (type === 'E') return
}
if (schema.length < args.length) throw tooManyArgs(schema.length, args.length)
}
function missingRequiredArg (num) {
return newException('EMISSINGARG', 'Missing required argument #' + (num + 1))
}
function unknownType (num, type) {
return newException('EUNKNOWNTYPE', 'Unknown type ' + type + ' in argument #' + (num + 1))
}
function invalidType (num, expectedType, value) {
var valueType
Object.keys(types).forEach(function (typeCode) {
if (types[typeCode][1](value)) valueType = types[typeCode][0]
})
return newException('EINVALIDTYPE', 'Argument #' + (num + 1) + ': Expected ' +
expectedType + ' but got ' + valueType)
}
function tooManyArgs (expected, got) {
return newException('ETOOMANYARGS', 'Too many arguments, expected ' + expected + ' and got ' + got)
}
function newException (code, msg) {
var e = new Error(msg)
e.code = code
Error.captureStackTrace(e, validate)
return e
}
@@ -0,0 +1,96 @@
{
"_args": [
[
{
"raw": "aproba@^1.0.3",
"scope": null,
"escapedName": "aproba",
"name": "aproba",
"rawSpec": "^1.0.3",
"spec": ">=1.0.3 <2.0.0",
"type": "range"
},
"/mnt/Data/bach/Sites/clameurs.org/sites/all/themes/figureslibres/clameurs/node_modules/gauge"
]
],
"_from": "aproba@>=1.0.3 <2.0.0",
"_id": "aproba@1.0.4",
"_inCache": true,
"_location": "/aproba",
"_nodeVersion": "4.4.0",
"_npmOperationalInternal": {
"host": "packages-12-west.internal.npmjs.com",
"tmp": "tmp/aproba-1.0.4.tgz_1466718885402_0.5348939662799239"
},
"_npmUser": {
"name": "iarna",
"email": "me@re-becca.org"
},
"_npmVersion": "3.10.2",
"_phantomChildren": {},
"_requested": {
"raw": "aproba@^1.0.3",
"scope": null,
"escapedName": "aproba",
"name": "aproba",
"rawSpec": "^1.0.3",
"spec": ">=1.0.3 <2.0.0",
"type": "range"
},
"_requiredBy": [
"/gauge"
],
"_resolved": "https://registry.npmjs.org/aproba/-/aproba-1.0.4.tgz",
"_shasum": "2713680775e7614c8ba186c065d4e2e52d1072c0",
"_shrinkwrap": null,
"_spec": "aproba@^1.0.3",
"_where": "/mnt/Data/bach/Sites/clameurs.org/sites/all/themes/figureslibres/clameurs/node_modules/gauge",
"author": {
"name": "Rebecca Turner",
"email": "me@re-becca.org"
},
"bugs": {
"url": "https://github.com/iarna/aproba/issues"
},
"dependencies": {},
"description": "A rediculously light-weight argument validator",
"devDependencies": {
"standard": "^7.1.2",
"tap": "^5.7.3"
},
"directories": {
"test": "test"
},
"dist": {
"shasum": "2713680775e7614c8ba186c065d4e2e52d1072c0",
"tarball": "https://registry.npmjs.org/aproba/-/aproba-1.0.4.tgz"
},
"files": [
"index.js"
],
"gitHead": "c6c8f82d519b9ec3816f20f23a9101083c022200",
"homepage": "https://github.com/iarna/aproba",
"keywords": [
"argument",
"validate"
],
"license": "ISC",
"main": "index.js",
"maintainers": [
{
"name": "iarna",
"email": "me@re-becca.org"
}
],
"name": "aproba",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git+https://github.com/iarna/aproba.git"
},
"scripts": {
"test": "standard && tap test/*.js"
},
"version": "1.0.4"
}
@@ -0,0 +1,4 @@
language: node_js
node_js:
- 0.6
- 0.8
+18
View File
@@ -0,0 +1,18 @@
This software is released under the 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.
@@ -0,0 +1,24 @@
var archy = require('../');
var s = archy({
label : 'beep',
nodes : [
'ity',
{
label : 'boop',
nodes : [
{
label : 'o_O',
nodes : [
{
label : 'oh',
nodes : [ 'hello', 'puny' ]
},
'human'
]
},
'party\ntime!'
]
}
]
});
console.log(s);
@@ -0,0 +1,25 @@
var archy = require('../');
var s = archy({
label : 'beep\none\ntwo',
nodes : [
'ity',
{
label : 'boop',
nodes : [
{
label : 'o_O\nwheee',
nodes : [
{
label : 'oh',
nodes : [ 'hello', 'puny\nmeat' ]
},
'creature'
]
},
'party\ntime!'
]
}
]
});
console.log(s);
+35
View File
@@ -0,0 +1,35 @@
module.exports = function archy (obj, prefix, opts) {
if (prefix === undefined) prefix = '';
if (!opts) opts = {};
var chr = function (s) {
var chars = {
'│' : '|',
'└' : '`',
'├' : '+',
'─' : '-',
'┬' : '-'
};
return opts.unicode === false ? chars[s] : s;
};
if (typeof obj === 'string') obj = { label : obj };
var nodes = obj.nodes || [];
var lines = (obj.label || '').split('\n');
var splitter = '\n' + prefix + (nodes.length ? chr('│') : ' ') + ' ';
return prefix
+ lines.join(splitter) + '\n'
+ nodes.map(function (node, ix) {
var last = ix === nodes.length - 1;
var more = node.nodes && node.nodes.length;
var prefix_ = prefix + (last ? ' ' : chr('│')) + ' ';
return prefix
+ (last ? chr('└') : chr('├')) + chr('─')
+ (more ? chr('┬') : chr('─')) + ' '
+ archy(node, prefix_, opts).slice(prefix.length + 2)
;
}).join('')
;
};
+114
View File
@@ -0,0 +1,114 @@
{
"_args": [
[
{
"raw": "archy@^1.0.0",
"scope": null,
"escapedName": "archy",
"name": "archy",
"rawSpec": "^1.0.0",
"spec": ">=1.0.0 <2.0.0",
"type": "range"
},
"/mnt/Data/bach/Sites/clameurs.org/sites/all/themes/figureslibres/clameurs/node_modules/gulp"
]
],
"_from": "archy@>=1.0.0 <2.0.0",
"_id": "archy@1.0.0",
"_inCache": true,
"_location": "/archy",
"_npmUser": {
"name": "substack",
"email": "mail@substack.net"
},
"_npmVersion": "1.4.25",
"_phantomChildren": {},
"_requested": {
"raw": "archy@^1.0.0",
"scope": null,
"escapedName": "archy",
"name": "archy",
"rawSpec": "^1.0.0",
"spec": ">=1.0.0 <2.0.0",
"type": "range"
},
"_requiredBy": [
"/gulp"
],
"_resolved": "https://registry.npmjs.org/archy/-/archy-1.0.0.tgz",
"_shasum": "f9c8c13757cc1dd7bc379ac77b2c62a5c2868c40",
"_shrinkwrap": null,
"_spec": "archy@^1.0.0",
"_where": "/mnt/Data/bach/Sites/clameurs.org/sites/all/themes/figureslibres/clameurs/node_modules/gulp",
"author": {
"name": "James Halliday",
"email": "mail@substack.net",
"url": "http://substack.net"
},
"bugs": {
"url": "https://github.com/substack/node-archy/issues"
},
"dependencies": {},
"description": "render nested hierarchies `npm ls` style with unicode pipes",
"devDependencies": {
"tap": "~0.3.3",
"tape": "~0.1.1"
},
"directories": {},
"dist": {
"shasum": "f9c8c13757cc1dd7bc379ac77b2c62a5c2868c40",
"tarball": "https://registry.npmjs.org/archy/-/archy-1.0.0.tgz"
},
"gitHead": "30223c16191e877bf027b15b12daf077b9b55b84",
"homepage": "https://github.com/substack/node-archy",
"keywords": [
"hierarchy",
"npm ls",
"unicode",
"pretty",
"print"
],
"license": "MIT",
"main": "index.js",
"maintainers": [
{
"name": "substack",
"email": "mail@substack.net"
}
],
"name": "archy",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/substack/node-archy.git"
},
"scripts": {
"test": "tap test"
},
"testling": {
"files": "test/*.js",
"browsers": {
"iexplore": [
"6.0",
"7.0",
"8.0",
"9.0"
],
"chrome": [
"20.0"
],
"firefox": [
"10.0",
"15.0"
],
"safari": [
"5.1"
],
"opera": [
"12.0"
]
}
},
"version": "1.0.0"
}
@@ -0,0 +1,88 @@
# archy
Render nested hierarchies `npm ls` style with unicode pipes.
[![browser support](http://ci.testling.com/substack/node-archy.png)](http://ci.testling.com/substack/node-archy)
[![build status](https://secure.travis-ci.org/substack/node-archy.png)](http://travis-ci.org/substack/node-archy)
# example
``` js
var archy = require('archy');
var s = archy({
label : 'beep',
nodes : [
'ity',
{
label : 'boop',
nodes : [
{
label : 'o_O',
nodes : [
{
label : 'oh',
nodes : [ 'hello', 'puny' ]
},
'human'
]
},
'party\ntime!'
]
}
]
});
console.log(s);
```
output
```
beep
├── ity
└─┬ boop
├─┬ o_O
│ ├─┬ oh
│ │ ├── hello
│ │ └── puny
│ └── human
└── party
time!
```
# methods
var archy = require('archy')
## archy(obj, prefix='', opts={})
Return a string representation of `obj` with unicode pipe characters like how
`npm ls` looks.
`obj` should be a tree of nested objects with `'label'` and `'nodes'` fields.
`'label'` is a string of text to display at a node level and `'nodes'` is an
array of the descendents of the current node.
If a node is a string, that string will be used as the `'label'` and an empty
array of `'nodes'` will be used.
`prefix` gets prepended to all the lines and is used by the algorithm to
recursively update.
If `'label'` has newlines they will be indented at the present indentation level
with the current prefix.
To disable unicode results in favor of all-ansi output set `opts.unicode` to
`false`.
# install
With [npm](http://npmjs.org) do:
```
npm install archy
```
# license
MIT
@@ -0,0 +1,40 @@
var test = require('tape');
var archy = require('../');
test('beep', function (t) {
var s = archy({
label : 'beep',
nodes : [
'ity',
{
label : 'boop',
nodes : [
{
label : 'o_O',
nodes : [
{
label : 'oh',
nodes : [ 'hello', 'puny' ]
},
'human'
]
},
'party!'
]
}
]
});
t.equal(s, [
'beep',
'├── ity',
'└─┬ boop',
' ├─┬ o_O',
' │ ├─┬ oh',
' │ │ ├── hello',
' │ │ └── puny',
' │ └── human',
' └── party!',
''
].join('\n'));
t.end();
});
@@ -0,0 +1,45 @@
var test = require('tape');
var archy = require('../');
test('multi-line', function (t) {
var s = archy({
label : 'beep\none\ntwo',
nodes : [
'ity',
{
label : 'boop',
nodes : [
{
label : 'o_O\nwheee',
nodes : [
{
label : 'oh',
nodes : [ 'hello', 'puny\nmeat' ]
},
'creature'
]
},
'party\ntime!'
]
}
]
});
t.equal(s, [
'beep',
'│ one',
'│ two',
'├── ity',
'└─┬ boop',
' ├─┬ o_O',
' │ │ wheee',
' │ ├─┬ oh',
' │ │ ├── hello',
' │ │ └── puny',
' │ │ meat',
' │ └── creature',
' └── party',
' time!',
''
].join('\n'));
t.end();
});
@@ -0,0 +1,40 @@
var test = require('tape');
var archy = require('../');
test('beep', function (t) {
var s = archy({
label : 'beep',
nodes : [
'ity',
{
label : 'boop',
nodes : [
{
label : 'o_O',
nodes : [
{
label : 'oh',
nodes : [ 'hello', 'puny' ]
},
'human'
]
},
'party!'
]
}
]
}, '', { unicode : false });
t.equal(s, [
'beep',
'+-- ity',
'`-- boop',
' +-- o_O',
' | +-- oh',
' | | +-- hello',
' | | `-- puny',
' | `-- human',
' `-- party!',
''
].join('\n'));
t.end();
});
@@ -0,0 +1,5 @@
*~
.#*
node_modules
coverage
.nyc_output
@@ -0,0 +1,19 @@
Hi, figured we could actually use a changelog now:
## 1.1.1 2016-01-29
* Fix a typo in stream completion tracker
## 1.1.0 2016-01-29
* Rewrote completion percent computation to be low impact no more walking a
tree of completion groups every time we need this info. Previously, with
medium sized tree of completion groups, even a relatively modest number of
calls to the top level `completed()` method would result in absurd numbers
of calls overall as it walked down the tree. We now, instead, keep track as
we bubble up changes, so the computation is limited to when data changes and
to the depth of that one branch, instead of _every_ node. (Plus, we were already
incurring _this_ cost, since we already bubbled out changes.)
* Moved different tracker types out to their own files.
* Made tests test for TOO MANY events too.
* Standarized the source code formatting
@@ -0,0 +1,5 @@
Copyright (c) 2015, Rebecca Turner
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
@@ -0,0 +1,194 @@
are-we-there-yet
----------------
Track complex hiearchies of asynchronous task completion statuses. This is
intended to give you a way of recording and reporting the progress of the big
recursive fan-out and gather type workflows that are so common in async.
What you do with this completion data is up to you, but the most common use case is to
feed it to one of the many progress bar modules.
Most progress bar modules include a rudamentary version of this, but my
needs were more complex.
Usage
=====
```javascript
var TrackerGroup = require("are-we-there-yet").TrackerGroup
var top = new TrackerGroup("program")
var single = top.newItem("one thing", 100)
single.completeWork(20)
console.log(top.completed()) // 0.2
fs.stat("file", function(er, stat) {
if (er) throw er
var stream = top.newStream("file", stat.size)
console.log(top.completed()) // now 0.1 as single is 50% of the job and is 20% complete
// and 50% * 20% == 10%
fs.createReadStream("file").pipe(stream).on("data", function (chunk) {
// do stuff with chunk
})
top.on("change", function (name) {
// called each time a chunk is read from "file"
// top.completed() will start at 0.1 and fill up to 0.6 as the file is read
})
})
```
Shared Methods
==============
All tracker objects described below have the following methods, they, along
with the event comprise the interface for consumers of tracker objects.
* var completed = tracker.completed()
Returns the ratio of completed work to work to be done. Range of 0 to 1.
* tracker.finish()
Marks the tracker as completed. With a TrackerGroup this marks all of its
components as completed.
Marks all of the components of this tracker as finished, which in turn means
that `tracker.completed()` for this will now be 1.
This will result in one or more `change` events being emitted.
Events
======
All tracker objects emit `change` events with the following arguments:
```
function (name, completed, tracker)
```
`name` is the name of the tracker that originally emitted the event,
or if it didn't have one, the first containing tracker group that had one.
`completed` is the percent complete (as returned by `tracker.completed()` method).
`tracker` is the tracker object that you are listening for events on.
TrackerGroup
============
* var tracker = new TrackerGroup(**name**)
* **name** *(optional)* - The name of this tracker group, used in change
notifications if the component updating didn't have a name. Defaults to undefined.
Creates a new empty tracker aggregation group. These are trackers whose
completion status is determined by the completion status of other trackers.
* tracker.addUnit(**otherTracker**, **weight**)
* **otherTracker** - Any of the other are-we-there-yet tracker objects
* **weight** *(optional)* - The weight to give the tracker, defaults to 1.
Adds the **otherTracker** to this aggregation group. The weight determines
how long you expect this tracker to take to complete in proportion to other
units. So for instance, if you add one tracker with a weight of 1 and
another with a weight of 2, you're saying the second will take twice as long
to complete as the first. As such, the first will account for 33% of the
completion of this tracker and the second will account for the other 67%.
Returns **otherTracker**.
* var subGroup = tracker.newGroup(**name**, **weight**)
The above is exactly equivalent to:
```javascript
var subGroup = tracker.addUnit(new TrackerGroup(name), weight)
```
* var subItem = tracker.newItem(**name**, **todo**, **weight**)
The above is exactly equivalent to:
```javascript
var subItem = tracker.addUnit(new Tracker(name, todo), weight)
```
* var subStream = tracker.newStream(**name**, **todo**, **weight**)
The above is exactly equivalent to:
```javascript
var subStream = tracker.addUnit(new TrackerStream(name, todo), weight)
```
* console.log( tracker.debug() )
Returns a tree showing the completion of this tracker group and all of its
children, including recursively entering all of the children.
Tracker
=======
* var tracker = new Tracker(**name**, **todo**)
* **name** *(optional)* The name of this counter to report in change
events. Defaults to undefined.
* **todo** *(optional)* The amount of work todo (a number). Defaults to 0.
Ordinarily these are constructed as a part of a tracker group (via
`newItem`).
* var completed = tracker.completed()
Returns the ratio of completed work to work to be done. Range of 0 to 1. If
total work to be done is 0 then it will return 0.
* tracker.addWork(**todo**)
* **todo** A number to add to the amount of work to be done.
Increases the amount of work to be done, thus decreasing the completion
percentage. Triggers a `change` event.
* tracker.completeWork(**completed**)
* **completed** A number to add to the work complete
Increase the amount of work complete, thus increasing the completion percentage.
Will never increase the work completed past the amount of work todo. That is,
percentages > 100% are not allowed. Triggers a `change` event.
* tracker.finish()
Marks this tracker as finished, tracker.completed() will now be 1. Triggers
a `change` event.
TrackerStream
=============
* var tracker = new TrackerStream(**name**, **size**, **options**)
* **name** *(optional)* The name of this counter to report in change
events. Defaults to undefined.
* **size** *(optional)* The number of bytes being sent through this stream.
* **options** *(optional)* A hash of stream options
The tracker stream object is a pass through stream that updates an internal
tracker object each time a block passes through. It's intended to track
downloads, file extraction and other related activities. You use it by piping
your data source into it and then using it as your data source.
If your data has a length attribute then that's used as the amount of work
completed when the chunk is passed through. If it does not (eg, object
streams) then each chunk counts as completing 1 unit of work, so your size
should be the total number of objects being streamed.
* tracker.addWork(**todo**)
* **todo** Increase the expected overall size by **todo** bytes.
Increases the amount of work to be done, thus decreasing the completion
percentage. Triggers a `change` event.
@@ -0,0 +1,4 @@
'use strict'
exports.TrackerGroup = require('./tracker-group.js')
exports.Tracker = require('./tracker.js')
exports.TrackerStream = require('./tracker-stream.js')
@@ -0,0 +1,90 @@
{
"_args": [
[
{
"raw": "are-we-there-yet@~1.1.2",
"scope": null,
"escapedName": "are-we-there-yet",
"name": "are-we-there-yet",
"rawSpec": "~1.1.2",
"spec": ">=1.1.2 <1.2.0",
"type": "range"
},
"/mnt/Data/bach/Sites/clameurs.org/sites/all/themes/figureslibres/clameurs/node_modules/npmlog"
]
],
"_from": "are-we-there-yet@>=1.1.2 <1.2.0",
"_id": "are-we-there-yet@1.1.2",
"_inCache": true,
"_location": "/are-we-there-yet",
"_nodeVersion": "4.2.2",
"_npmOperationalInternal": {
"host": "packages-13-west.internal.npmjs.com",
"tmp": "tmp/are-we-there-yet-1.1.2.tgz_1458084397358_0.15847722673788667"
},
"_npmUser": {
"name": "iarna",
"email": "me@re-becca.org"
},
"_npmVersion": "3.8.1",
"_phantomChildren": {},
"_requested": {
"raw": "are-we-there-yet@~1.1.2",
"scope": null,
"escapedName": "are-we-there-yet",
"name": "are-we-there-yet",
"rawSpec": "~1.1.2",
"spec": ">=1.1.2 <1.2.0",
"type": "range"
},
"_requiredBy": [
"/npmlog"
],
"_resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.2.tgz",
"_shasum": "80e470e95a084794fe1899262c5667c6e88de1b3",
"_shrinkwrap": null,
"_spec": "are-we-there-yet@~1.1.2",
"_where": "/mnt/Data/bach/Sites/clameurs.org/sites/all/themes/figureslibres/clameurs/node_modules/npmlog",
"author": {
"name": "Rebecca Turner",
"url": "http://re-becca.org"
},
"bugs": {
"url": "https://github.com/iarna/are-we-there-yet/issues"
},
"dependencies": {
"delegates": "^1.0.0",
"readable-stream": "^2.0.0 || ^1.1.13"
},
"description": "Keep track of the overall completion of many dispirate processes",
"devDependencies": {
"standard": "^6.0.8",
"tap": "^5.7.0"
},
"directories": {},
"dist": {
"shasum": "80e470e95a084794fe1899262c5667c6e88de1b3",
"tarball": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.2.tgz"
},
"gitHead": "dd5706e2204cb681e78031d0ffe156ed4cc75823",
"homepage": "https://github.com/iarna/are-we-there-yet",
"license": "ISC",
"main": "index.js",
"maintainers": [
{
"name": "iarna",
"email": "me@re-becca.org"
}
],
"name": "are-we-there-yet",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git+https://github.com/iarna/are-we-there-yet.git"
},
"scripts": {
"test": "standard && tap test/*.js"
},
"version": "1.1.2"
}
@@ -0,0 +1,29 @@
'use strict'
var util = require('util')
module.exports = function (obj, event, next) {
var timeout = setTimeout(gotTimeout, 10)
obj.once(event, gotResult)
function gotTimeout () {
obj.removeListener(event, gotResult)
next(new Error('Timeout listening for ' + event))
}
var result = []
function gotResult () {
result = Array.prototype.slice.call(arguments)
clearTimeout(timeout)
timeout = setTimeout(gotNoMoreResults, 10)
obj.once(event, gotTooManyResults)
}
function gotNoMoreResults () {
obj.removeListener(event, gotTooManyResults)
var args = [null].concat(result)
next.apply(null, args)
}
function gotTooManyResults () {
var secondResult = Array.prototype.slice.call(arguments)
clearTimeout(timeout)
next(new Error('Got too many results, first ' + util.inspect(result) + ' and then ' + util.inspect(secondResult)))
}
}
@@ -0,0 +1,57 @@
'use strict'
var test = require('tap').test
var Tracker = require('../index.js').Tracker
var testEvent = require('./lib/test-event.js')
var name = 'test'
test('initialization', function (t) {
var simple = new Tracker(name)
t.is(simple.completed(), 0, 'Nothing todo is 0 completion')
t.done()
})
var track
var todo = 100
test('completion', function (t) {
track = new Tracker(name, todo)
t.is(track.completed(), 0, 'Nothing done is 0 completion')
testEvent(track, 'change', afterCompleteWork)
track.completeWork(todo)
t.is(track.completed(), 1, 'completeWork: 100% completed')
function afterCompleteWork (er, onChangeName) {
t.is(er, null, 'completeWork: on change event fired')
t.is(onChangeName, name, 'completeWork: on change emits the correct name')
t.done()
}
})
test('add more work', function (t) {
testEvent(track, 'change', afterAddWork)
track.addWork(todo)
t.is(track.completed(), 0.5, 'addWork: 50% completed')
function afterAddWork (er, onChangeName) {
t.is(er, null, 'addWork: on change event fired')
t.is(onChangeName, name, 'addWork: on change emits the correct name')
t.done()
}
})
test('complete more work', function (t) {
track.completeWork(200)
t.is(track.completed(), 1, 'completeWork: Over completion is still only 100% complete')
t.done()
})
test('finish is always 100%', function (t) {
var finishtest = new Tracker(name, todo)
finishtest.completeWork(50)
finishtest.finish()
t.is(finishtest.completed(), 1, 'finish: Explicitly finishing moves to 100%')
t.done()
})
@@ -0,0 +1,96 @@
'use strict'
var test = require('tap').test
var TrackerGroup = require('../index.js').TrackerGroup
var testEvent = require('./lib/test-event.js')
test('TrackerGroup', function (t) {
var name = 'test'
var track = new TrackerGroup(name)
t.is(track.completed(), 0, 'Nothing todo is 0 completion')
testEvent(track, 'change', afterFinishEmpty)
track.finish()
var a, b
function afterFinishEmpty (er, onChangeName, completion) {
t.is(er, null, 'finishEmpty: on change event fired')
t.is(onChangeName, name, 'finishEmpty: on change emits the correct name')
t.is(completion, 1, 'finishEmpty: passed through completion was correct')
t.is(track.completed(), 1, 'finishEmpty: Finishing an empty group actually finishes it')
track = new TrackerGroup(name)
a = track.newItem('a', 10, 1)
b = track.newItem('b', 10, 1)
t.is(track.completed(), 0, 'Initially empty')
testEvent(track, 'change', afterCompleteWork)
a.completeWork(5)
}
function afterCompleteWork (er, onChangeName, completion) {
t.is(er, null, 'on change event fired')
t.is(onChangeName, 'a', 'on change emits the correct name')
t.is(completion, 0.25, 'Complete half of one is a quarter overall')
t.is(track.completed(), 0.25, 'Complete half of one is a quarter overall')
testEvent(track, 'change', afterFinishAll)
track.finish()
}
function afterFinishAll (er, onChangeName, completion) {
t.is(er, null, 'finishAll: on change event fired')
t.is(onChangeName, name, 'finishAll: on change emits the correct name')
t.is(completion, 1, 'Finishing everything ')
t.is(track.completed(), 1, 'Finishing everything ')
track = new TrackerGroup(name)
a = track.newItem('a', 10, 2)
b = track.newItem('b', 10, 1)
t.is(track.completed(), 0, 'weighted: Initially empty')
testEvent(track, 'change', afterWeightedCompleteWork)
a.completeWork(5)
}
function afterWeightedCompleteWork (er, onChangeName, completion) {
t.is(er, null, 'weighted: on change event fired')
t.is(onChangeName, 'a', 'weighted: on change emits the correct name')
t.is(Math.floor(completion * 100), 33, 'weighted: Complete half of double weighted')
t.is(Math.floor(track.completed() * 100), 33, 'weighted: Complete half of double weighted')
testEvent(track, 'change', afterWeightedFinishAll)
track.finish()
}
function afterWeightedFinishAll (er, onChangeName, completion) {
t.is(er, null, 'weightedFinishAll: on change event fired')
t.is(onChangeName, name, 'weightedFinishAll: on change emits the correct name')
t.is(completion, 1, 'weightedFinishaAll: Finishing everything ')
t.is(track.completed(), 1, 'weightedFinishaAll: Finishing everything ')
track = new TrackerGroup(name)
a = track.newGroup('a', 10)
b = track.newGroup('b', 10)
var a1 = a.newItem('a.1', 10)
a1.completeWork(5)
t.is(track.completed(), 0.25, 'nested: Initially quarter done')
testEvent(track, 'change', afterNestedComplete)
b.finish()
}
function afterNestedComplete (er, onChangeName, completion) {
t.is(er, null, 'nestedComplete: on change event fired')
t.is(onChangeName, 'b', 'nestedComplete: on change emits the correct name')
t.is(completion, 0.75, 'nestedComplete: Finishing everything ')
t.is(track.completed(), 0.75, 'nestedComplete: Finishing everything ')
t.end()
}
})
test('cycles', function (t) {
var track = new TrackerGroup('top')
testCycle(track, track)
var layer1 = track.newGroup('layer1')
testCycle(layer1, track)
t.end()
function testCycle (addTo, toAdd) {
try {
addTo.addUnit(toAdd)
t.fail(toAdd.name)
} catch (ex) {
console.log(ex)
t.pass(toAdd.name)
}
}
})
@@ -0,0 +1,51 @@
'use strict'
var test = require('tap').test
var util = require('util')
var stream = require('readable-stream')
var TrackerStream = require('../index.js').TrackerStream
var testEvent = require('./lib/test-event.js')
var Sink = function () {
stream.Writable.apply(this, arguments)
}
util.inherits(Sink, stream.Writable)
Sink.prototype._write = function (data, encoding, cb) {
cb()
}
test('TrackerStream', function (t) {
t.plan(9)
var name = 'test'
var track = new TrackerStream(name)
t.is(track.completed(), 0, 'Nothing todo is 0 completion')
var todo = 10
track = new TrackerStream(name, todo)
t.is(track.completed(), 0, 'Nothing done is 0 completion')
track.pipe(new Sink())
testEvent(track, 'change', afterCompleteWork)
track.write('0123456789')
function afterCompleteWork (er, onChangeName) {
t.is(er, null, 'write: on change event fired')
t.is(onChangeName, name, 'write: on change emits the correct name')
t.is(track.completed(), 1, 'write: 100% completed')
testEvent(track, 'change', afterAddWork)
track.addWork(10)
}
function afterAddWork (er, onChangeName) {
t.is(er, null, 'addWork: on change event fired')
t.is(track.completed(), 0.5, 'addWork: 50% completed')
testEvent(track, 'change', afterAllWork)
track.write('ABCDEFGHIJKLMNOPQRST')
}
function afterAllWork (er) {
t.is(er, null, 'allWork: on change event fired')
t.is(track.completed(), 1, 'allWork: 100% completed')
}
})
@@ -0,0 +1,11 @@
'use strict'
var EventEmitter = require('events').EventEmitter
var util = require('util')
var trackerId = 0
var TrackerBase = module.exports = function (name) {
EventEmitter.call(this)
this.id = ++trackerId
this.name = name
}
util.inherits(TrackerBase, EventEmitter)
@@ -0,0 +1,107 @@
'use strict'
var util = require('util')
var TrackerBase = require('./tracker-base.js')
var Tracker = require('./tracker.js')
var TrackerStream = require('./tracker-stream.js')
var TrackerGroup = module.exports = function (name) {
TrackerBase.call(this, name)
this.parentGroup = null
this.trackers = []
this.completion = {}
this.weight = {}
this.totalWeight = 0
this.finished = false
this.bubbleChange = bubbleChange(this)
}
util.inherits(TrackerGroup, TrackerBase)
function bubbleChange (trackerGroup) {
return function (name, completed, tracker) {
trackerGroup.completion[tracker.id] = completed
if (trackerGroup.finished) return
trackerGroup.emit('change', name || trackerGroup.name, trackerGroup.completed(), trackerGroup)
}
}
TrackerGroup.prototype.nameInTree = function () {
var names = []
var from = this
while (from) {
names.unshift(from.name)
from = from.parentGroup
}
return names.join('/')
}
TrackerGroup.prototype.addUnit = function (unit, weight) {
if (unit.addUnit) {
var toTest = this
while (toTest) {
if (unit === toTest) {
throw new Error(
'Attempted to add tracker group ' +
unit.name + ' to tree that already includes it ' +
this.nameInTree(this))
}
toTest = toTest.parentGroup
}
unit.parentGroup = this
}
this.weight[unit.id] = weight || 1
this.totalWeight += this.weight[unit.id]
this.trackers.push(unit)
this.completion[unit.id] = unit.completed()
unit.on('change', this.bubbleChange)
if (!this.finished) this.emit('change', unit.name, this.completion[unit.id], unit)
return unit
}
TrackerGroup.prototype.completed = function () {
if (this.trackers.length === 0) return 0
var valPerWeight = 1 / this.totalWeight
var completed = 0
for (var ii = 0; ii < this.trackers.length; ii++) {
var trackerId = this.trackers[ii].id
completed += valPerWeight * this.weight[trackerId] * this.completion[trackerId]
}
return completed
}
TrackerGroup.prototype.newGroup = function (name, weight) {
return this.addUnit(new TrackerGroup(name), weight)
}
TrackerGroup.prototype.newItem = function (name, todo, weight) {
return this.addUnit(new Tracker(name, todo), weight)
}
TrackerGroup.prototype.newStream = function (name, todo, weight) {
return this.addUnit(new TrackerStream(name, todo), weight)
}
TrackerGroup.prototype.finish = function () {
this.finished = true
if (!this.trackers.length) this.addUnit(new Tracker(), 1, true)
for (var ii = 0; ii < this.trackers.length; ii++) {
var tracker = this.trackers[ii]
tracker.finish()
tracker.removeListener('change', this.bubbleChange)
}
this.emit('change', this.name, 1, this)
}
var buffer = ' '
TrackerGroup.prototype.debug = function (depth) {
depth = depth || 0
var indent = depth ? buffer.substr(0, depth) : ''
var output = indent + (this.name || 'top') + ': ' + this.completed() + '\n'
this.trackers.forEach(function (tracker) {
if (tracker instanceof TrackerGroup) {
output += tracker.debug(depth + 1)
} else {
output += indent + ' ' + tracker.name + ': ' + tracker.completed() + '\n'
}
})
return output
}
@@ -0,0 +1,35 @@
'use strict'
var util = require('util')
var stream = require('readable-stream')
var delegate = require('delegates')
var Tracker = require('./tracker.js')
var TrackerStream = module.exports = function (name, size, options) {
stream.Transform.call(this, options)
this.tracker = new Tracker(name, size)
this.name = name
this.id = this.tracker.id
this.tracker.on('change', delegateChange(this))
}
util.inherits(TrackerStream, stream.Transform)
function delegateChange (trackerStream) {
return function (name, completion, tracker) {
trackerStream.emit('change', name, completion, trackerStream)
}
}
TrackerStream.prototype._transform = function (data, encoding, cb) {
this.tracker.completeWork(data.length ? data.length : 1)
this.push(data)
cb()
}
TrackerStream.prototype._flush = function (cb) {
this.tracker.finish()
cb()
}
delegate(TrackerStream.prototype, 'tracker')
.method('completed')
.method('addWork')
@@ -0,0 +1,30 @@
'use strict'
var util = require('util')
var TrackerBase = require('./tracker-base.js')
var Tracker = module.exports = function (name, todo) {
TrackerBase.call(this, name)
this.workDone = 0
this.workTodo = todo || 0
}
util.inherits(Tracker, TrackerBase)
Tracker.prototype.completed = function () {
return this.workTodo === 0 ? 0 : this.workDone / this.workTodo
}
Tracker.prototype.addWork = function (work) {
this.workTodo += work
this.emit('change', this.name, this.completed(), this)
}
Tracker.prototype.completeWork = function (work) {
this.workDone += work
if (this.workDone > this.workTodo) this.workDone = this.workTodo
this.emit('change', this.name, this.completed(), this)
}
Tracker.prototype.finish = function () {
this.workTodo = this.workDone = 1
this.emit('change', this.name, 1, this)
}
+21
View File
@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2014-2015, Jon Schlinkert.
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.
@@ -0,0 +1,74 @@
# arr-diff [![NPM version](https://img.shields.io/npm/v/arr-diff.svg)](https://www.npmjs.com/package/arr-diff) [![Build Status](https://img.shields.io/travis/jonschlinkert/base.svg)](https://travis-ci.org/jonschlinkert/base)
> Returns an array with only the unique values from the first array, by excluding all values from additional arrays using strict equality for comparisons.
## Install
Install with [npm](https://www.npmjs.com/)
```sh
$ npm i arr-diff --save
```
Install with [bower](http://bower.io/)
```sh
$ bower install arr-diff --save
```
## API
### [diff](index.js#L33)
Return the difference between the first array and additional arrays.
**Params**
* `a` **{Array}**
* `b` **{Array}**
* `returns` **{Array}**
**Example**
```js
var diff = require('arr-diff');
var a = ['a', 'b', 'c', 'd'];
var b = ['b', 'c'];
console.log(diff(a, b))
//=> ['a', 'd']
```
## Related projects
* [arr-flatten](https://www.npmjs.com/package/arr-flatten): Recursively flatten an array or arrays. This is the fastest implementation of array flatten. | [homepage](https://github.com/jonschlinkert/arr-flatten)
* [array-filter](https://www.npmjs.com/package/array-filter): Array#filter for older browsers. | [homepage](https://github.com/juliangruber/array-filter)
* [array-intersection](https://www.npmjs.com/package/array-intersection): Return an array with the unique values present in _all_ given arrays using strict equality… [more](https://www.npmjs.com/package/array-intersection) | [homepage](https://github.com/jonschlinkert/array-intersection)
## Running tests
Install dev dependencies:
```sh
$ npm i -d && npm test
```
## Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/arr-diff/issues/new).
## Author
**Jon Schlinkert**
+ [github/jonschlinkert](https://github.com/jonschlinkert)
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
## License
Copyright © 2015 [Jon Schlinkert](https://github.com/jonschlinkert)
Released under the MIT license.
***
_This file was generated by [verb](https://github.com/verbose/verb) on Sat Dec 05 2015 23:24:53 GMT-0500 (EST)._
+58
View File
@@ -0,0 +1,58 @@
/*!
* arr-diff <https://github.com/jonschlinkert/arr-diff>
*
* Copyright (c) 2014 Jon Schlinkert, contributors.
* Licensed under the MIT License
*/
'use strict';
var flatten = require('arr-flatten');
var slice = [].slice;
/**
* Return the difference between the first array and
* additional arrays.
*
* ```js
* var diff = require('{%= name %}');
*
* var a = ['a', 'b', 'c', 'd'];
* var b = ['b', 'c'];
*
* console.log(diff(a, b))
* //=> ['a', 'd']
* ```
*
* @param {Array} `a`
* @param {Array} `b`
* @return {Array}
* @api public
*/
function diff(arr, arrays) {
var argsLen = arguments.length;
var len = arr.length, i = -1;
var res = [], arrays;
if (argsLen === 1) {
return arr;
}
if (argsLen > 2) {
arrays = flatten(slice.call(arguments, 1));
}
while (++i < len) {
if (!~arrays.indexOf(arr[i])) {
res.push(arr[i]);
}
}
return res;
}
/**
* Expose `diff`
*/
module.exports = diff;
@@ -0,0 +1,119 @@
{
"_args": [
[
{
"raw": "arr-diff@^2.0.0",
"scope": null,
"escapedName": "arr-diff",
"name": "arr-diff",
"rawSpec": "^2.0.0",
"spec": ">=2.0.0 <3.0.0",
"type": "range"
},
"/mnt/Data/bach/Sites/clameurs.org/sites/all/themes/figureslibres/clameurs/node_modules/micromatch"
]
],
"_from": "arr-diff@>=2.0.0 <3.0.0",
"_id": "arr-diff@2.0.0",
"_inCache": true,
"_location": "/arr-diff",
"_nodeVersion": "5.0.0",
"_npmUser": {
"name": "jonschlinkert",
"email": "github@sellside.com"
},
"_npmVersion": "3.3.6",
"_phantomChildren": {},
"_requested": {
"raw": "arr-diff@^2.0.0",
"scope": null,
"escapedName": "arr-diff",
"name": "arr-diff",
"rawSpec": "^2.0.0",
"spec": ">=2.0.0 <3.0.0",
"type": "range"
},
"_requiredBy": [
"/micromatch"
],
"_resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz",
"_shasum": "8f3b827f955a8bd669697e4a4256ac3ceae356cf",
"_shrinkwrap": null,
"_spec": "arr-diff@^2.0.0",
"_where": "/mnt/Data/bach/Sites/clameurs.org/sites/all/themes/figureslibres/clameurs/node_modules/micromatch",
"author": {
"name": "Jon Schlinkert",
"url": "https://github.com/jonschlinkert"
},
"bugs": {
"url": "https://github.com/jonschlinkert/arr-diff/issues"
},
"dependencies": {
"arr-flatten": "^1.0.1"
},
"description": "Returns an array with only the unique values from the first array, by excluding all values from additional arrays using strict equality for comparisons.",
"devDependencies": {
"array-differ": "^1.0.0",
"array-slice": "^0.2.3",
"benchmarked": "^0.1.4",
"chalk": "^1.1.1",
"mocha": "*",
"should": "*"
},
"directories": {},
"dist": {
"shasum": "8f3b827f955a8bd669697e4a4256ac3ceae356cf",
"tarball": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz"
},
"engines": {
"node": ">=0.10.0"
},
"files": [
"index.js"
],
"gitHead": "b89f54eb88ca51afd0e0ea6be9a4a63e5ccecf27",
"homepage": "https://github.com/jonschlinkert/arr-diff",
"keywords": [
"arr",
"array",
"diff",
"differ",
"difference"
],
"license": "MIT",
"main": "index.js",
"maintainers": [
{
"name": "doowb",
"email": "brian.woodward@gmail.com"
},
{
"name": "jonschlinkert",
"email": "github@sellside.com"
},
{
"name": "paulmillr",
"email": "paul@paulmillr.com"
}
],
"name": "arr-diff",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git+https://github.com/jonschlinkert/arr-diff.git"
},
"scripts": {
"test": "mocha"
},
"verb": {
"related": {
"list": [
"arr-flatten",
"array-filter",
"array-intersection"
]
}
},
"version": "2.0.0"
}
+21
View File
@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2014-2015, Jon Schlinkert.
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.
+73
View File
@@ -0,0 +1,73 @@
# arr-flatten [![NPM version](https://badge.fury.io/js/arr-flatten.svg)](http://badge.fury.io/js/arr-flatten) [![Build Status](https://travis-ci.org/jonschlinkert/arr-flatten.svg)](https://travis-ci.org/jonschlinkert/arr-flatten)
> Recursively flatten an array or arrays. This is the fastest implementation of array flatten.
Why another flatten utility? I wanted the fastest implementation I could find, with implementation choices that should work for 95% of use cases, but no cruft to cover the other 5%.
## Run benchmarks
```bash
npm run benchmarks
```
Benchmark results comparing this library to [array-flatten]:
```bash
#1: large.js
arr-flatten.js x 487,030 ops/sec ±0.67% (92 runs sampled)
array-flatten.js x 347,020 ops/sec ±0.57% (98 runs sampled)
#2: medium.js
arr-flatten.js x 1,914,516 ops/sec ±0.76% (94 runs sampled)
array-flatten.js x 1,391,661 ops/sec ±0.63% (96 runs sampled)
#3: small.js
arr-flatten.js x 5,158,980 ops/sec ±0.85% (94 runs sampled)
array-flatten.js x 3,683,173 ops/sec ±0.79% (97 runs sampled)
```
## Run tests
Install dev dependencies:
```bash
npm i -d && npm test
```
## Install with [npm](npmjs.org)
```bash
npm i arr-flatten --save
```
### Install with [bower](https://github.com/bower/bower)
```bash
bower install arr-flatten --save
```
## Usage
```js
var flatten = require('arr-flatten');
flatten(['a', ['b', ['c']], 'd', ['e']]);
//=> ['a', 'b', 'c', 'd', 'e']
```
## Author
**Jon Schlinkert**
+ [github/jonschlinkert](https://github.com/jonschlinkert)
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
## License
Copyright (c) 2014-2015 Jon Schlinkert
Released under the MIT license
***
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on March 11, 2015._
[array-flatten]: https://github.com/blakeembrey/array-flatten
+27
View File
@@ -0,0 +1,27 @@
/*!
* arr-flatten <https://github.com/jonschlinkert/arr-flatten>
*
* Copyright (c) 2014-2015, Jon Schlinkert.
* Licensed under the MIT License.
*/
'use strict';
module.exports = function flatten(arr) {
return flat(arr, []);
};
function flat(arr, res) {
var len = arr.length;
var i = -1;
while (len--) {
var cur = arr[++i];
if (Array.isArray(cur)) {
flat(cur, res);
} else {
res.push(cur);
}
}
return res;
}
+108
View File
@@ -0,0 +1,108 @@
{
"_args": [
[
{
"raw": "arr-flatten@^1.0.1",
"scope": null,
"escapedName": "arr-flatten",
"name": "arr-flatten",
"rawSpec": "^1.0.1",
"spec": ">=1.0.1 <2.0.0",
"type": "range"
},
"/mnt/Data/bach/Sites/clameurs.org/sites/all/themes/figureslibres/clameurs/node_modules/arr-diff"
]
],
"_from": "arr-flatten@>=1.0.1 <2.0.0",
"_id": "arr-flatten@1.0.1",
"_inCache": true,
"_location": "/arr-flatten",
"_nodeVersion": "0.12.0",
"_npmUser": {
"name": "jonschlinkert",
"email": "github@sellside.com"
},
"_npmVersion": "2.5.1",
"_phantomChildren": {},
"_requested": {
"raw": "arr-flatten@^1.0.1",
"scope": null,
"escapedName": "arr-flatten",
"name": "arr-flatten",
"rawSpec": "^1.0.1",
"spec": ">=1.0.1 <2.0.0",
"type": "range"
},
"_requiredBy": [
"/arr-diff"
],
"_resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.0.1.tgz",
"_shasum": "e5ffe54d45e19f32f216e91eb99c8ce892bb604b",
"_shrinkwrap": null,
"_spec": "arr-flatten@^1.0.1",
"_where": "/mnt/Data/bach/Sites/clameurs.org/sites/all/themes/figureslibres/clameurs/node_modules/arr-diff",
"author": {
"name": "Jon Schlinkert",
"url": "https://github.com/jonschlinkert"
},
"bugs": {
"url": "https://github.com/jonschlinkert/arr-flatten/issues"
},
"dependencies": {},
"description": "Recursively flatten an array or arrays. This is the fastest implementation of array flatten.",
"devDependencies": {
"array-flatten": "^1.0.2",
"array-slice": "^0.2.2",
"benchmarked": "^0.1.3",
"chalk": "^0.5.1",
"glob": "^4.3.5",
"kind-of": "^1.0.0"
},
"directories": {},
"dist": {
"shasum": "e5ffe54d45e19f32f216e91eb99c8ce892bb604b",
"tarball": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.0.1.tgz"
},
"engines": {
"node": ">=0.10.0"
},
"files": [
"index.js"
],
"gitHead": "7b3706eaa0093d8f5ba65af8ed590b6fcb3fe7cf",
"homepage": "https://github.com/jonschlinkert/arr-flatten",
"keywords": [
"arr",
"array",
"elements",
"flat",
"flatten",
"nested",
"recurse",
"recursive",
"recursively"
],
"license": {
"type": "MIT",
"url": "https://github.com/jonschlinkert/arr-flatten/blob/master/LICENSE"
},
"main": "index.js",
"maintainers": [
{
"name": "jonschlinkert",
"email": "github@sellside.com"
}
],
"name": "arr-flatten",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git://github.com/jonschlinkert/arr-flatten.git"
},
"scripts": {
"benchmarks": "node benchmark",
"test": "mocha"
},
"version": "1.0.1"
}
@@ -0,0 +1,7 @@
'use strict';
module.exports = function (arr) {
var rest = [].concat.apply([], [].slice.call(arguments, 1));
return arr.filter(function (el) {
return rest.indexOf(el) === -1;
});
};

Some files were not shown because too many files have changed in this diff Show More