Skip to content

Commit 68c031b

Browse files
committed
Make a more sane directory structure.
Move the module entry point from `./lib/source-map.js` -> `./source-map.js`. Move `./lib/source-map/*` -> `./lib/*`. Move `./test/source-map/*` -> `./test/*`
1 parent 3fb0840 commit 68c031b

27 files changed

+39
-42
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

lib/source-map.js

-8
This file was deleted.
File renamed without changes.

lib/source-map/util.js lib/util.js

File renamed without changes.

package.json

+3-6
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,10 @@
4343
"type": "git",
4444
"url": "http://github.com/mozilla/source-map.git"
4545
},
46-
"directories": {
47-
"lib": "./lib"
48-
},
49-
"main": "./lib/source-map.js",
46+
"main": "./source-map.js",
5047
"files": [
51-
"lib/",
52-
"build/"
48+
"source-map.js",
49+
"lib/"
5350
],
5451
"engines": {
5552
"node": ">=0.10.0"

source-map.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/*
2+
* Copyright 2009-2011 Mozilla Foundation and contributors
3+
* Licensed under the New BSD license. See LICENSE.txt or:
4+
* http://opensource.org/licenses/BSD-3-Clause
5+
*/
6+
exports.SourceMapGenerator = require('./lib/source-map-generator').SourceMapGenerator;
7+
exports.SourceMapConsumer = require('./lib/source-map-consumer').SourceMapConsumer;
8+
exports.SourceNode = require('./lib/source-node').SourceNode;

test/run-tests.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ function isTestFile(f) {
4343
: /^test\-.*?\.js/.test(f);
4444
}
4545

46-
function toModule(f) {
47-
return './source-map/' + f.replace(/\.js$/, '');
46+
function toRelativeModule(f) {
47+
return './' + f.replace(/\.js$/, '');
4848
}
4949

50-
var requires = fs.readdirSync(path.join(__dirname, 'source-map'))
50+
var requires = fs.readdirSync(__dirname)
5151
.filter(isTestFile)
52-
.map(toModule);
52+
.map(toRelativeModule);
5353

5454
var code = run(requires.map(require).map(function (mod, i) {
5555
return {

test/source-map/test-api.js test/test-api.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* http://opensource.org/licenses/BSD-3-Clause
66
*/
77
{
8-
var sourceMap = require('../../lib/source-map');
8+
var sourceMap = require('../source-map');
99

1010
exports['test that the api is properly exposed in the top level'] = function (assert) {
1111
assert.equal(typeof sourceMap.SourceMapGenerator, "function");

test/source-map/test-array-set.js test/test-array-set.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* http://opensource.org/licenses/BSD-3-Clause
66
*/
77
{
8-
var ArraySet = require('../../lib/source-map/array-set').ArraySet;
8+
var ArraySet = require('../lib/array-set').ArraySet;
99

1010
function makeTestSet() {
1111
var set = new ArraySet();

test/source-map/test-base64-vlq.js test/test-base64-vlq.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* http://opensource.org/licenses/BSD-3-Clause
66
*/
77
{
8-
var base64VLQ = require('../../lib/source-map/base64-vlq');
8+
var base64VLQ = require('../lib/base64-vlq');
99

1010
exports['test normal encoding and decoding'] = function (assert) {
1111
var result = {};

test/source-map/test-base64.js test/test-base64.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* http://opensource.org/licenses/BSD-3-Clause
66
*/
77
{
8-
var base64 = require('../../lib/source-map/base64');
8+
var base64 = require('../lib/base64');
99

1010
exports['test out of range encoding'] = function (assert) {
1111
assert.throws(function () {

test/source-map/test-binary-search.js test/test-binary-search.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* http://opensource.org/licenses/BSD-3-Clause
66
*/
77
{
8-
var binarySearch = require('../../lib/source-map/binary-search');
8+
var binarySearch = require('../lib/binary-search');
99

1010
function numberCompare(a, b) {
1111
return a - b;

test/source-map/test-dog-fooding.js test/test-dog-fooding.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
*/
77
{
88
var util = require("./util");
9-
var SourceMapConsumer = require('../../lib/source-map/source-map-consumer').SourceMapConsumer;
10-
var SourceMapGenerator = require('../../lib/source-map/source-map-generator').SourceMapGenerator;
9+
var SourceMapConsumer = require('../lib/source-map-consumer').SourceMapConsumer;
10+
var SourceMapGenerator = require('../lib/source-map-generator').SourceMapGenerator;
1111

1212
exports['test eating our own dog food'] = function (assert) {
1313
var smg = new SourceMapGenerator({

test/source-map/test-quick-sort.js test/test-quick-sort.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* http://opensource.org/licenses/BSD-3-Clause
66
*/
77
{
8-
var quickSort = require('../../lib/source-map/quick-sort').quickSort;
8+
var quickSort = require('../lib/quick-sort').quickSort;
99

1010
function numberCompare(a, b) {
1111
return a - b;

test/source-map/test-source-map-consumer.js test/test-source-map-consumer.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
*/
77
{
88
var util = require("./util");
9-
var SourceMapConsumer = require('../../lib/source-map/source-map-consumer').SourceMapConsumer;
10-
var IndexedSourceMapConsumer = require('../../lib/source-map/source-map-consumer').IndexedSourceMapConsumer;
11-
var BasicSourceMapConsumer = require('../../lib/source-map/source-map-consumer').BasicSourceMapConsumer;
12-
var SourceMapGenerator = require('../../lib/source-map/source-map-generator').SourceMapGenerator;
9+
var SourceMapConsumer = require('../lib/source-map-consumer').SourceMapConsumer;
10+
var IndexedSourceMapConsumer = require('../lib/source-map-consumer').IndexedSourceMapConsumer;
11+
var BasicSourceMapConsumer = require('../lib/source-map-consumer').BasicSourceMapConsumer;
12+
var SourceMapGenerator = require('../lib/source-map-generator').SourceMapGenerator;
1313

1414
exports['test that we can instantiate with a string or an object'] = function (assert) {
1515
assert.doesNotThrow(function () {

test/source-map/test-source-map-generator.js test/test-source-map-generator.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
* http://opensource.org/licenses/BSD-3-Clause
66
*/
77
{
8-
var SourceMapGenerator = require('../../lib/source-map/source-map-generator').SourceMapGenerator;
9-
var SourceMapConsumer = require('../../lib/source-map/source-map-consumer').SourceMapConsumer;
10-
var SourceNode = require('../../lib/source-map/source-node').SourceNode;
8+
var SourceMapGenerator = require('../lib/source-map-generator').SourceMapGenerator;
9+
var SourceMapConsumer = require('../lib/source-map-consumer').SourceMapConsumer;
10+
var SourceNode = require('../lib/source-node').SourceNode;
1111
var util = require('./util');
1212

1313
exports['test some simple stuff'] = function (assert) {

test/source-map/test-source-node.js test/test-source-node.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
*/
77
{
88
var util = require("./util");
9-
var SourceMapGenerator = require('../../lib/source-map/source-map-generator').SourceMapGenerator;
10-
var SourceMapConsumer = require('../../lib/source-map/source-map-consumer').SourceMapConsumer;
11-
var SourceNode = require('../../lib/source-map/source-node').SourceNode;
9+
var SourceMapGenerator = require('../lib/source-map-generator').SourceMapGenerator;
10+
var SourceMapConsumer = require('../lib/source-map-consumer').SourceMapConsumer;
11+
var SourceNode = require('../lib/source-node').SourceNode;
1212

1313
function forEachNewline(fn) {
1414
return function (assert) {

test/source-map/test-util.js test/test-util.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* http://opensource.org/licenses/BSD-3-Clause
66
*/
77
{
8-
var libUtil = require('../../lib/source-map/util');
8+
var libUtil = require('../lib/util');
99

1010
exports['test urls'] = function (assert) {
1111
var assertUrl = function (url) {

test/source-map/util.js test/util.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* http://opensource.org/licenses/BSD-3-Clause
66
*/
77
{
8-
var util = require('../../lib/source-map/util');
8+
var util = require('../lib/util');
99

1010
// This is a test mapping which maps functions from two different files
1111
// (one.js and two.js) to a minified generated source.

webpack.config.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ var distDir = path.join(__dirname, "dist");
99
module.exports = [
1010
// Plain build.
1111
{
12-
entry: "./lib/source-map.js",
12+
entry: "./source-map.js",
1313
output: {
1414
path: distDir,
1515
filename: "source-map.js",
@@ -20,7 +20,7 @@ module.exports = [
2020

2121
// Debug build.
2222
{
23-
entry: "./lib/source-map.js",
23+
entry: "./source-map.js",
2424
output: {
2525
path: distDir,
2626
filename: "source-map.debug.js",
@@ -32,7 +32,7 @@ module.exports = [
3232

3333
// Minified build.
3434
{
35-
entry: "./lib/source-map.js",
35+
entry: "./source-map.js",
3636
output: {
3737
path: distDir,
3838
filename: "source-map.min.js",
@@ -56,7 +56,7 @@ function isTestFile(file) {
5656
return testFileRegex.test(file);
5757
}
5858

59-
var testsDir = path.join(__dirname, "test", "source-map");
59+
var testsDir = path.join(__dirname, "test");
6060
var testFiles = fs.readdirSync(testsDir).filter(isTestFile);
6161

6262
// The xpcshell test harness expects a run_test function. Define this function

0 commit comments

Comments
 (0)