@@ -74,32 +74,32 @@ export function commonjsRegister (path, loader) {
74
74
}
75
75
76
76
export function commonjsRegisterOrShort (path, to) {
77
- const resolvedPath = commonjsResolveImpl(path, null, true);
77
+ var resolvedPath = commonjsResolveImpl(path, null, true);
78
78
if (resolvedPath !== null && DYNAMIC_REQUIRE_CACHE[resolvedPath]) {
79
79
DYNAMIC_REQUIRE_CACHE[path] = DYNAMIC_REQUIRE_CACHE[resolvedPath];
80
80
} else {
81
81
DYNAMIC_REQUIRE_SHORTS[path] = to;
82
82
}
83
83
}
84
84
85
- const DYNAMIC_REQUIRE_LOADERS = Object.create(null);
86
- const DYNAMIC_REQUIRE_CACHE = Object.create(null);
87
- const DYNAMIC_REQUIRE_SHORTS = Object.create(null);
88
- const DEFAULT_PARENT_MODULE = {
85
+ var DYNAMIC_REQUIRE_LOADERS = Object.create(null);
86
+ var DYNAMIC_REQUIRE_CACHE = Object.create(null);
87
+ var DYNAMIC_REQUIRE_SHORTS = Object.create(null);
88
+ var DEFAULT_PARENT_MODULE = {
89
89
id: '<' + 'rollup>', exports: {}, parent: undefined, filename: null, loaded: false, children: [], paths: []
90
90
};
91
- const CHECKED_EXTENSIONS = ['', '.js', '.json'];
91
+ var CHECKED_EXTENSIONS = ['', '.js', '.json'];
92
92
93
93
function normalize (path) {
94
94
path = path.replace(/\\\\/g, '/');
95
- const parts = path.split('/');
96
- const slashed = parts[0] === '';
97
- for (let i = 1; i < parts.length; i++) {
95
+ var parts = path.split('/');
96
+ var slashed = parts[0] === '';
97
+ for (var i = 1; i < parts.length; i++) {
98
98
if (parts[i] === '.' || parts[i] === '') {
99
99
parts.splice(i--, 1);
100
100
}
101
101
}
102
- for (let i = 1; i < parts.length; i++) {
102
+ for (var i = 1; i < parts.length; i++) {
103
103
if (parts[i] !== '..') continue;
104
104
if (i > 0 && parts[i - 1] !== '..' && parts[i - 1] !== '.') {
105
105
parts.splice(--i, 2);
@@ -117,9 +117,9 @@ function normalize (path) {
117
117
function join () {
118
118
if (arguments.length === 0)
119
119
return '.';
120
- let joined;
121
- for (let i = 0; i < arguments.length; ++i) {
122
- let arg = arguments[i];
120
+ var joined;
121
+ for (var i = 0; i < arguments.length; ++i) {
122
+ var arg = arguments[i];
123
123
if (arg.length > 0) {
124
124
if (joined === undefined)
125
125
joined = arg;
@@ -134,9 +134,9 @@ function join () {
134
134
}
135
135
136
136
function isPossibleNodeModulesPath (modulePath) {
137
- let c0 = modulePath[0];
137
+ var c0 = modulePath[0];
138
138
if (c0 === '/' || c0 === '\\\\') return false;
139
- let c1 = modulePath[1], c2 = modulePath[2];
139
+ var c1 = modulePath[1], c2 = modulePath[2];
140
140
if ((c0 === '.' && (!c1 || c1 === '/' || c1 === '\\\\')) ||
141
141
(c0 === '.' && c1 === '.' && (!c2 || c2 === '/' || c2 === '\\\\'))) return false;
142
142
if (c1 === ':' && (c2 === '/' || c2 === '\\\\'))
@@ -148,9 +148,9 @@ function dirname (path) {
148
148
if (path.length === 0)
149
149
return '.';
150
150
151
- let i = path.length - 1;
151
+ var i = path.length - 1;
152
152
while (i > 0) {
153
- const c = path.charCodeAt(i);
153
+ var c = path.charCodeAt(i);
154
154
if ((c === 47 || c === 92) && i !== path.length - 1)
155
155
break;
156
156
i--;
@@ -166,9 +166,9 @@ function dirname (path) {
166
166
}
167
167
168
168
export function commonjsResolveImpl (path, originalModuleDir, testCache) {
169
- const shouldTryNodeModules = isPossibleNodeModulesPath(path);
169
+ var shouldTryNodeModules = isPossibleNodeModulesPath(path);
170
170
path = normalize(path);
171
- let relPath;
171
+ var relPath;
172
172
if (path[0] === '/') {
173
173
originalModuleDir = '/';
174
174
}
@@ -185,8 +185,8 @@ export function commonjsResolveImpl (path, originalModuleDir, testCache) {
185
185
break; // Travelled too far up, avoid infinite loop
186
186
}
187
187
188
- for (let extensionIndex = 0; extensionIndex < CHECKED_EXTENSIONS.length; extensionIndex++) {
189
- const resolvedPath = relPath + CHECKED_EXTENSIONS[extensionIndex];
188
+ for (var extensionIndex = 0; extensionIndex < CHECKED_EXTENSIONS.length; extensionIndex++) {
189
+ var resolvedPath = relPath + CHECKED_EXTENSIONS[extensionIndex];
190
190
if (DYNAMIC_REQUIRE_CACHE[resolvedPath]) {
191
191
return resolvedPath;
192
192
}
@@ -198,34 +198,34 @@ export function commonjsResolveImpl (path, originalModuleDir, testCache) {
198
198
}
199
199
}
200
200
if (!shouldTryNodeModules) break;
201
- const nextDir = normalize(originalModuleDir + '/..');
201
+ var nextDir = normalize(originalModuleDir + '/..');
202
202
if (nextDir === originalModuleDir) break;
203
203
originalModuleDir = nextDir;
204
204
}
205
205
return null;
206
206
}
207
207
208
208
export function commonjsResolve (path, originalModuleDir) {
209
- const resolvedPath = commonjsResolveImpl(path, originalModuleDir);
209
+ var resolvedPath = commonjsResolveImpl(path, originalModuleDir);
210
210
if (resolvedPath !== null) {
211
211
return resolvedPath;
212
212
}
213
213
return require.resolve(path);
214
214
}
215
215
216
216
export function commonjsRequire (path, originalModuleDir) {
217
- let resolvedPath = commonjsResolveImpl(path, originalModuleDir, true);
217
+ var resolvedPath = commonjsResolveImpl(path, originalModuleDir, true);
218
218
if (resolvedPath !== null) {
219
- let cachedModule = DYNAMIC_REQUIRE_CACHE[resolvedPath];
219
+ var cachedModule = DYNAMIC_REQUIRE_CACHE[resolvedPath];
220
220
if (cachedModule) return cachedModule.exports;
221
- let shortTo = DYNAMIC_REQUIRE_SHORTS[resolvedPath];
221
+ var shortTo = DYNAMIC_REQUIRE_SHORTS[resolvedPath];
222
222
if (shortTo) {
223
223
cachedModule = DYNAMIC_REQUIRE_CACHE[shortTo];
224
224
if (cachedModule)
225
225
return cachedModule.exports;
226
226
resolvedPath = commonjsResolveImpl(shortTo, null, true);
227
227
}
228
- const loader = DYNAMIC_REQUIRE_LOADERS[resolvedPath];
228
+ var loader = DYNAMIC_REQUIRE_LOADERS[resolvedPath];
229
229
if (loader) {
230
230
DYNAMIC_REQUIRE_CACHE[resolvedPath] = cachedModule = {
231
231
id: resolvedPath,
0 commit comments