mirror of https://github.com/status-im/metro.git
packager: fix lint
Reviewed By: matryoshcow Differential Revision: D4160163 fbshipit-source-id: 8eeb7dd83c0d80c1c62b760039615ce97782bd3e
This commit is contained in:
parent
f13c4e3d78
commit
cedf70f702
|
@ -327,7 +327,7 @@ class Bundler {
|
||||||
response.dependencies = moduleSystemDeps.concat(response.dependencies);
|
response.dependencies = moduleSystemDeps.concat(response.dependencies);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const finalizeBundle = ({bundle, transformedModules, response, modulesByName}: {
|
const finalizeBundle = ({bundle: finalBundle, transformedModules, response, modulesByName}: {
|
||||||
bundle: Bundle,
|
bundle: Bundle,
|
||||||
transformedModules: Array<{module: Module, transformed: {}}>,
|
transformedModules: Array<{module: Module, transformed: {}}>,
|
||||||
response: ResolutionResponse,
|
response: ResolutionResponse,
|
||||||
|
@ -335,7 +335,7 @@ class Bundler {
|
||||||
}) =>
|
}) =>
|
||||||
Promise.all(
|
Promise.all(
|
||||||
transformedModules.map(({module, transformed}) =>
|
transformedModules.map(({module, transformed}) =>
|
||||||
bundle.addModule(this._resolver, response, module, transformed)
|
finalBundle.addModule(this._resolver, response, module, transformed)
|
||||||
)
|
)
|
||||||
).then(() => {
|
).then(() => {
|
||||||
const runBeforeMainModuleIds = Array.isArray(runBeforeMainModule)
|
const runBeforeMainModuleIds = Array.isArray(runBeforeMainModule)
|
||||||
|
@ -347,12 +347,12 @@ class Bundler {
|
||||||
.map(response.getModuleId)
|
.map(response.getModuleId)
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
bundle.finalize({
|
finalBundle.finalize({
|
||||||
runMainModule,
|
runMainModule,
|
||||||
runBeforeMainModule: runBeforeMainModuleIds,
|
runBeforeMainModule: runBeforeMainModuleIds,
|
||||||
allowUpdates: this._opts.allowBundleUpdates,
|
allowUpdates: this._opts.allowBundleUpdates,
|
||||||
});
|
});
|
||||||
return bundle;
|
return finalBundle;
|
||||||
});
|
});
|
||||||
|
|
||||||
return this._buildBundle({
|
return this._buildBundle({
|
||||||
|
|
|
@ -251,8 +251,14 @@ function readMetadataFileSync(
|
||||||
if (
|
if (
|
||||||
typeof cachedResultHash !== 'number' ||
|
typeof cachedResultHash !== 'number' ||
|
||||||
typeof cachedSourceHash !== 'number' ||
|
typeof cachedSourceHash !== 'number' ||
|
||||||
!(Array.isArray(dependencies) && dependencies.every(dep => typeof dep === 'string')) ||
|
!(
|
||||||
!(Array.isArray(dependencyOffsets) && dependencyOffsets.every(offset => typeof offset === 'number')) ||
|
Array.isArray(dependencies) &&
|
||||||
|
dependencies.every(dep => typeof dep === 'string')
|
||||||
|
) ||
|
||||||
|
!(
|
||||||
|
Array.isArray(dependencyOffsets) &&
|
||||||
|
dependencyOffsets.every(offset => typeof offset === 'number')
|
||||||
|
) ||
|
||||||
!(sourceMap == null || typeof sourceMap === 'object')
|
!(sourceMap == null || typeof sourceMap === 'object')
|
||||||
) {
|
) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -6189,7 +6189,7 @@ describe('DependencyGraph', function() {
|
||||||
main.resolve();
|
main.resolve();
|
||||||
return dependenciesPromise;
|
return dependenciesPromise;
|
||||||
}).then(result => {
|
}).then(result => {
|
||||||
const names = result.map(({path}) => path.split('/').pop());
|
const names = result.map(({path: resultPath}) => resultPath.split('/').pop());
|
||||||
expect(names).toEqual([
|
expect(names).toEqual([
|
||||||
'index.js',
|
'index.js',
|
||||||
'a.js',
|
'a.js',
|
||||||
|
@ -6214,7 +6214,7 @@ describe('DependencyGraph', function() {
|
||||||
main.resolve();
|
main.resolve();
|
||||||
return dependenciesPromise;
|
return dependenciesPromise;
|
||||||
}).then(result => {
|
}).then(result => {
|
||||||
const names = result.map(({path}) => path.split('/').pop());
|
const names = result.map(({path: resultPath}) => resultPath.split('/').pop());
|
||||||
expect(names).toEqual([
|
expect(names).toEqual([
|
||||||
'index.js',
|
'index.js',
|
||||||
'a.js',
|
'a.js',
|
||||||
|
|
|
@ -260,14 +260,14 @@ describe('Module', () => {
|
||||||
|
|
||||||
pit('passes the module and file contents to the transform if the file is annotated with @extern', () => {
|
pit('passes the module and file contents to the transform if the file is annotated with @extern', () => {
|
||||||
const module = createModule({transformCode});
|
const module = createModule({transformCode});
|
||||||
const fileContents = `
|
const customFileContents = `
|
||||||
/**
|
/**
|
||||||
* @extern
|
* @extern
|
||||||
*/
|
*/
|
||||||
`;
|
`;
|
||||||
mockIndexFile(fileContents);
|
mockIndexFile(customFileContents);
|
||||||
return module.read().then(() => {
|
return module.read().then(() => {
|
||||||
expect(transformCode).toBeCalledWith(module, fileContents, {extern: true});
|
expect(transformCode).toBeCalledWith(module, customFileContents, {extern: true});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -281,17 +281,17 @@ describe('Module', () => {
|
||||||
|
|
||||||
pit('does not extend the passed options object if the file is annotated with @extern', () => {
|
pit('does not extend the passed options object if the file is annotated with @extern', () => {
|
||||||
const module = createModule({transformCode});
|
const module = createModule({transformCode});
|
||||||
const fileContents = `
|
const customFileContents = `
|
||||||
/**
|
/**
|
||||||
* @extern
|
* @extern
|
||||||
*/
|
*/
|
||||||
`;
|
`;
|
||||||
mockIndexFile(fileContents);
|
mockIndexFile(customFileContents);
|
||||||
const options = {arbitrary: 'foo'};
|
const options = {arbitrary: 'foo'};
|
||||||
return module.read(options).then(() => {
|
return module.read(options).then(() => {
|
||||||
expect(options).not.toEqual(jasmine.objectContaining({extern: true}));
|
expect(options).not.toEqual(jasmine.objectContaining({extern: true}));
|
||||||
expect(transformCode)
|
expect(transformCode)
|
||||||
.toBeCalledWith(module, fileContents, {...options, extern: true});
|
.toBeCalledWith(module, customFileContents, {...options, extern: true});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue