This commit is contained in:
tatianamac
2019-11-26 14:50:43 -08:00
parent 8a55660ed0
commit 6d5445ecc5
13894 changed files with 2233957 additions and 0 deletions

10
node_modules/stylus-lookup/.travis.yml generated vendored Normal file
View File

@ -0,0 +1,10 @@
language: node_js
node_js:
- "6"
- "7"
- "8"
notifications:
email: false
sudo: false

42
node_modules/stylus-lookup/Readme.md generated vendored Normal file
View File

@ -0,0 +1,42 @@
### stylus-lookup [![npm](http://img.shields.io/npm/v/stylus-lookup.svg)](https://npmjs.org/package/stylus-lookup) [![npm](http://img.shields.io/npm/dm/stylus-lookup.svg)](https://npmjs.org/package/stylus-lookup)
> Get the file associated with a Stylus import
This module replaces the Stylus compiler's lookup algorithm for resolving a partial's path.
* Handles same directory lookups,
partials with or without extensions, partials within subdirectories,
partials with the `.styl` or `.css` in the name,
partials using the `index.styl` resolution.
* **Does not** currently support glob imports or the use of additional paths. PRs welcome.
*Originally built for [Dependents](https://github.com/mrjoelkemp/Dependents#dependents)*
### Usage
`stylusLookup({
dependency: 'foo',
filename: 'path/to/file',
directory: 'path/to/all/files'
})`
* `dependency`: The partial's name
* If your stylus file had `@import foo`, then `foo` would be the dependency name
* `filename`: The file importing the dependency
* `directory`: The location of all stylus files
Example:
```js
var stylusLookup = require('stylus-lookup');
stylusLookup({
dependency: 'variables',
filename: 'app/styles/styles.styl',
directory: 'app/styles'
}); // yields app/styles/variables.styl
```
* This assumes that the file `app/styles/styles.styl` has `@import variables` or `@require variables`
and that all of the other stylus files are located within `app/styles`.

19
node_modules/stylus-lookup/bin/cli.js generated vendored Executable file
View File

@ -0,0 +1,19 @@
#!/usr/bin/env node
'use strict';
const lookup = require('../');
const program = require('commander');
program
.version(require('../package.json').version)
.usage('[options] <path>')
.option('-f, --filename [path]', 'file containing the dependency')
.option('-d, --directory [path]', 'location of all stylus files')
.parse(process.argv);
const filename = program.filename;
const directory = program.directory;
const dep = program.args[0];
console.log(lookup(dep, filename, directory));

71
node_modules/stylus-lookup/index.js generated vendored Normal file
View File

@ -0,0 +1,71 @@
'use strict';
const path = require('path');
const fs = require('fs');
const debug = require('debug')('stylus-lookup');
/**
* Determines the resolved dependency path according to
* the Stylus compiler's dependency lookup behavior
*
* @param {Object} options
* @param {String} options.dependency - the import name
* @param {String} options.filename - the file containing the import
* @param {String} options.directory - the location of all stylus files
* @return {String}
*/
module.exports = function({dependency: dep, filename, directory} = {}) {
if (typeof dep === 'undefined') {
throw new Error('dependency is not supplied');
}
if (typeof filename === 'undefined') {
throw new Error('filename is not supplied');
}
if (typeof directory === 'undefined') {
throw new Error('directory is not supplied');
}
const fileDir = path.dirname(filename);
debug('trying to resolve: ' + dep);
debug('filename: ', filename);
debug('directory: ', directory);
// Use the file's extension if necessary
const ext = path.extname(dep) ? '' : path.extname(filename);
let resolved;
if (!path.isAbsolute(dep)) {
resolved = path.resolve(filename, dep) + ext;
debug('resolved relative dependency: ' + resolved);
if (fs.existsSync(resolved)) {
return resolved;
} else {
debug('resolved file does not exist');
}
}
const samedir = path.resolve(fileDir, dep) + ext;
debug('resolving dep about the parent file\'s directory: ' + samedir);
if (fs.existsSync(samedir)) {
return samedir;
} else {
debug('resolved file does not exist');
}
// Check for dep/index.styl file
const indexFile = path.join(path.resolve(fileDir, dep), 'index.styl');
debug('resolving dep as if it points to an index.styl file: ' + indexFile);
if (fs.existsSync(indexFile)) {
return indexFile;
} else {
debug('resolved file does not exist');
}
debug('could not resolve the dependency');
return '';
};

75
node_modules/stylus-lookup/package.json generated vendored Normal file
View File

@ -0,0 +1,75 @@
{
"_args": [
[
"stylus-lookup@3.0.2",
"/Users/tatiana/selfdefined"
]
],
"_from": "stylus-lookup@3.0.2",
"_id": "stylus-lookup@3.0.2",
"_inBundle": false,
"_integrity": "sha512-oEQGHSjg/AMaWlKe7gqsnYzan8DLcGIHe0dUaFkucZZ14z4zjENRlQMCHT4FNsiWnJf17YN9OvrCfCoi7VvOyg==",
"_location": "/stylus-lookup",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "stylus-lookup@3.0.2",
"name": "stylus-lookup",
"escapedName": "stylus-lookup",
"rawSpec": "3.0.2",
"saveSpec": null,
"fetchSpec": "3.0.2"
},
"_requiredBy": [
"/filing-cabinet"
],
"_resolved": "https://registry.npmjs.org/stylus-lookup/-/stylus-lookup-3.0.2.tgz",
"_spec": "3.0.2",
"_where": "/Users/tatiana/selfdefined",
"author": {
"name": "Joel Kemp",
"email": "joel@mrjoelkemp.com",
"url": "http://www.mrjoelkemp.com/"
},
"bin": {
"stylus-lookup": "bin/cli.js"
},
"bugs": {
"url": "https://github.com/mrjoelkemp/node-stylus-lookup/issues"
},
"dependencies": {
"commander": "^2.8.1",
"debug": "^4.1.0"
},
"description": "Get the file associated with an imported/required Stylus partial",
"devDependencies": {
"jscs": "^3.0.7",
"mocha": "^5.2.0",
"mock-fs": "^4.4.2"
},
"directories": {
"test": "test"
},
"engines": {
"node": ">=6.0.0"
},
"homepage": "https://github.com/mrjoelkemp/node-stylus-lookup",
"keywords": [
"stylus",
"lookup",
"dependency",
"partial"
],
"license": "MIT",
"main": "index.js",
"name": "stylus-lookup",
"repository": {
"type": "git",
"url": "git+https://github.com/mrjoelkemp/node-stylus-lookup.git"
},
"scripts": {
"test": "jscs -p google test index.js bin && mocha"
},
"version": "3.0.2"
}

83
node_modules/stylus-lookup/test/test.js generated vendored Normal file
View File

@ -0,0 +1,83 @@
var assert = require('assert');
var mock = require('mock-fs');
var lookup = require('../');
describe('stylus-lookup', function() {
beforeEach(function() {
mock({
example: {
// jscs: disable maximumLineLength
'main.styl': '@import "blueprint"; @require "another"; @require "styles.styl"',
// jscs: enable maximumLineLength
'another.styl': '@import "nested/foo"',
'styles.styl': '@import "styles2.css"',
'styles2.css': '',
blueprint: {
'index.styl': ''
},
nested: {
'foo.styl': ''
}
}
});
});
afterEach(mock.restore);
it('handles index.styl lookup', function() {
assert.equal(lookup({
dependency: 'blueprint',
filename: 'example/main.styl',
directory: 'example'
}),
process.cwd() + '/example/blueprint/index.styl');
});
it('handles .css lookups', function() {
assert.equal(lookup({
dependency: 'styles2.css',
filename: 'example/styles.styl',
directory: 'example'
}),
process.cwd() + '/example/styles2.css');
});
it('handles same directory lookup', function() {
assert.equal(lookup({
dependency: 'another',
filename: 'example/main.styl',
directory: 'example'
}),
process.cwd() + '/example/another.styl');
});
it('handles subdirectory lookup', function() {
assert.equal(lookup({
dependency: 'nested/foo',
filename: 'example/another.styl',
directory: 'example'
}),
process.cwd() + '/example/nested/foo.styl');
});
it('handles extensionless lookup', function() {
assert.equal(lookup({
dependency: 'another',
filename: 'example/main.styl',
directory: 'example'
}),
process.cwd() + '/example/another.styl');
});
it('handles extensioned lookup', function() {
assert.equal(lookup({
dependency: 'styles.styl',
filename: 'example/main.styl',
directory: 'example'
}),
process.cwd() + '/example/styles.styl');
});
it.skip('supports globbing imports');
it.skip('supports additional path lookups');
});