]>
git.r.bdr.sh - rbdr/dotfiles/blob - atom/packages/ex-mode/node_modules/space-pen/node_modules/grim/node_modules/coffeestack/node_modules/source-map/Makefile.dryice.js
d6fc26a7900206b686892a107d96b7306a703797
1 /* -*- Mode: js; js-indent-level: 2; -*- */
3 * Copyright 2011 Mozilla Foundation and contributors
4 * Licensed under the New BSD license. See LICENSE or:
5 * http://opensource.org/licenses/BSD-3-Clause
7 var path
= require('path');
8 var fs
= require('fs');
9 var copy
= require('dryice').copy
;
11 function removeAmdefine(src
) {
12 src
= String(src
).replace(
13 /if\s*\(typeof\s*define\s*!==\s*'function'\)\s*{\s*var\s*define\s*=\s*require\('amdefine'\)\(module,\s*require\);\s*}\s*/g,
16 /\b(define\(.*)('amdefine',?)/gm,
20 removeAmdefine
.onRead
= true;
22 function makeNonRelative(src
) {
24 .replace(/require\('.\//g, 'require(\'source-map/')
25 .replace(/\.\.\/\.\.\/lib\//g, '');
27 makeNonRelative
.onRead
= true;
29 function buildBrowser() {
30 console
.log('\nCreating dist/source-map.js');
32 var project
= copy
.createCommonJsProject({
33 roots: [ path
.join(__dirname
, 'lib') ]
38 'build/mini-require.js',
41 require: [ 'source-map/source-map-generator',
42 'source-map/source-map-consumer',
43 'source-map/source-node']
45 'build/suffix-browser.js'
48 copy
.filter
.moduleDefines
,
51 dest: 'dist/source-map.js'
55 function buildBrowserMin() {
56 console
.log('\nCreating dist/source-map.min.js');
59 source: 'dist/source-map.js',
60 filter: copy
.filter
.uglifyjs
,
61 dest: 'dist/source-map.min.js'
65 function buildFirefox() {
66 console
.log('\nCreating dist/SourceMap.jsm');
68 var project
= copy
.createCommonJsProject({
69 roots: [ path
.join(__dirname
, 'lib') ]
74 'build/prefix-source-map.jsm',
77 require: [ 'source-map/source-map-consumer',
78 'source-map/source-map-generator',
79 'source-map/source-node' ]
81 'build/suffix-source-map.jsm'
84 copy
.filter
.moduleDefines
,
88 dest: 'dist/SourceMap.jsm'
91 // Create dist/test/Utils.jsm
92 console
.log('\nCreating dist/test/Utils.jsm');
94 project
= copy
.createCommonJsProject({
95 roots: [ __dirname
, path
.join(__dirname
, 'lib') ]
100 'build/prefix-utils.jsm',
101 'build/assert-shim.js',
104 require: [ 'test/source-map/util' ]
106 'build/suffix-utils.jsm'
109 copy
.filter
.moduleDefines
,
113 dest: 'dist/test/Utils.jsm'
116 function isTestFile(f
) {
117 return /^test\-.*?\.js/.test(f
);
120 var testFiles
= fs
.readdirSync(path
.join(__dirname
, 'test', 'source-map')).filter(isTestFile
);
122 testFiles
.forEach(function (testFile
) {
123 console
.log('\nCreating', path
.join('dist', 'test', testFile
.replace(/\-/g, '_')));
127 'build/test-prefix.js',
128 path
.join('test', 'source-map', testFile
),
129 'build/test-suffix.js'
134 function (input
, source
) {
135 return input
.replace('define(',
137 + path
.join('test', 'source-map', testFile
.replace(/\.js$/, ''))
138 + '", ["require", "exports", "module"], ');
140 function (input
, source
) {
141 return input
.replace('{THIS_MODULE}', function () {
142 return "test/source-map/" + testFile
.replace(/\.js$/, '');
146 dest: path
.join('dist', 'test', testFile
.replace(/\-/g, '_'))
151 function ensureDir(name
) {
152 var dirExists
= false;
154 dirExists
= fs
.statSync(name
).isDirectory();
158 fs
.mkdirSync(name
, 0777);
163 ensureDir("dist/test");