[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

misc: move esm-utils.js to shared/ #15418

Merged
merged 4 commits into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/config/config-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import ConfigPlugin from './config-plugin.js';
import {Runner} from '../runner.js';
import * as i18n from '../lib/i18n/i18n.js';
import * as validation from './validation.js';
import {getModuleDirectory} from '../../esm-utils.js';
import {getModuleDirectory} from '../../shared/esm-utils.js';

const require = createRequire(import.meta.url);

Expand Down
2 changes: 1 addition & 1 deletion core/config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {
mergeConfigFragment,
mergeConfigFragmentArrayByKey,
} from './config-helpers.js';
import {getModuleDirectory} from '../../esm-utils.js';
import {getModuleDirectory} from '../../shared/esm-utils.js';
import * as format from '../../shared/localization/format.js';

const defaultConfigPath = path.join(
Expand Down
2 changes: 1 addition & 1 deletion core/lib/i18n/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import log from 'lighthouse-logger';
import {getAvailableLocales} from '../../../shared/localization/format.js';
import {LH_ROOT} from '../../../root.js';
import {isIcuMessage, formatMessage, DEFAULT_LOCALE} from '../../../shared/localization/format.js';
import {getModulePath} from '../../../esm-utils.js';
import {getModulePath} from '../../../shared/esm-utils.js';

const UIStrings = {
/** Used to show the duration in milliseconds that something lasted. The `{timeInMs}` placeholder will be replaced with the time duration, shown in milliseconds (e.g. 63 ms) */
Expand Down
2 changes: 1 addition & 1 deletion core/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {Sentry} from './lib/sentry.js';
import {ReportGenerator} from '../report/generator/report-generator.js';
import {LighthouseError} from './lib/lh-error.js';
import {lighthouseVersion} from '../root.js';
import {getModuleDirectory} from '../esm-utils.js';
import {getModuleDirectory} from '../shared/esm-utils.js';
import {EntityClassification} from './computed/entity-classification.js';
import UrlUtils from './lib/url-utils.js';

Expand Down
2 changes: 1 addition & 1 deletion core/scripts/i18n/collect-strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {collectAndBakeCtcStrings} from './bake-ctc-to-lhl.js';
import {pruneObsoleteLhlMessages} from './prune-obsolete-lhl-messages.js';
import {countTranslatedMessages} from './count-translated.js';
import {LH_ROOT} from '../../../root.js';
import {resolveModulePath} from '../../../esm-utils.js';
import {resolveModulePath} from '../../../shared/esm-utils.js';

// Match declarations of UIStrings, terminating in either a `};\n` (very likely to always be right)
// or `}\n\n` (allowing semicolon to be optional, but insisting on a double newline so that an
Expand Down
2 changes: 1 addition & 1 deletion core/test/config/config-helpers-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import BaseGatherer from '../../gather/base-gatherer.js';
import ImageElementsGatherer from '../../gather/gatherers/image-elements.js';
import UserTimingsAudit from '../../audits/user-timings.js';
import {LH_ROOT} from '../../../root.js';
import {getModuleDirectory} from '../../../esm-utils.js';
import {getModuleDirectory} from '../../../shared/esm-utils.js';

const require = createRequire(import.meta.url);
const moduleDir = getModuleDirectory(import.meta);
Expand Down
2 changes: 1 addition & 1 deletion core/test/lib/asset-saver-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import * as assetSaver from '../../lib/asset-saver.js';
import {MetricTraceEvents} from '../../lib/traces/metric-trace-events.js';
import {LighthouseError} from '../../lib/lh-error.js';
import {LH_ROOT} from '../../../root.js';
import {getModuleDirectory} from '../../../esm-utils.js';
import {getModuleDirectory} from '../../../shared/esm-utils.js';
import {readJson} from '../test-utils.js';

const traceEvents = readJson('../fixtures/traces/progressive-app.json', import.meta);
Expand Down
2 changes: 1 addition & 1 deletion core/test/lib/i18n/i18n-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import log from 'lighthouse-logger';
import jestMock from 'jest-mock';

import * as i18n from '../../../lib/i18n/i18n.js';
import {getModuleDirectory} from '../../../../esm-utils.js';
import {getModuleDirectory} from '../../../../shared/esm-utils.js';

const moduleDir = getModuleDirectory(import.meta);

Expand Down
2 changes: 1 addition & 1 deletion core/test/runner-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const {initializeConfig} = await import('../config/config.js');
const {Audit} = await import('../audits/audit.js');
const {default: Gatherer} = await import('../gather/base-gatherer.js');
const i18n = await import('../lib/i18n/i18n.js');
const {getModuleDirectory} = await import('../../esm-utils.js');
const {getModuleDirectory} = await import('../../shared/esm-utils.js');
const {LighthouseError} = await import('../lib/lh-error.js');
const {finalizeArtifacts, getBaseArtifacts} = await import('../gather/base-artifacts.js');
const {gotoURL} = await import('../gather/driver/navigation.js');
Expand Down
2 changes: 1 addition & 1 deletion core/test/test-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {LH_ROOT} from '../../root.js';
import * as mockCommands from './gather/mock-commands.js';
import {NetworkRecorder} from '../lib/network-recorder.js';
import {timers} from './test-env/fake-timers.js';
import {getModuleDirectory} from '../../esm-utils.js';
import {getModuleDirectory} from '../../shared/esm-utils.js';

const require = createRequire(import.meta.url);

Expand Down
1 change: 0 additions & 1 deletion flow-report/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"./types",
"../types/internal/test.d.ts",
"../root.js",
"../esm-utils.js",
"../core/test/test-env/fake-timers.js",
],
}
2 changes: 1 addition & 1 deletion report/generator/flow-report-assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import fs from 'fs';

import {getModuleDirectory} from '../../esm-utils.js';
import {getModuleDirectory} from '../../shared/esm-utils.js';

const moduleDir = getModuleDirectory(import.meta);

Expand Down
2 changes: 1 addition & 1 deletion report/generator/report-assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import fs from 'fs';

import {flowReportAssets} from './flow-report-assets.js';
import {getModuleDirectory} from '../../esm-utils.js';
import {getModuleDirectory} from '../../shared/esm-utils.js';

const moduleDir = getModuleDirectory(import.meta);

Expand Down
2 changes: 1 addition & 1 deletion report/generator/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
},
"references": [
{"path": "../../types/lhr/"},
{"path": "../../shared/"},
],
"include": [
"**/*.js",
"../../esm-utils.js",
],
}
2 changes: 1 addition & 1 deletion root.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import fs from 'fs';

import {getModuleDirectory} from './esm-utils.js';
import {getModuleDirectory} from './shared/esm-utils.js';

const LH_ROOT = getModuleDirectory(import.meta);
const pkg = JSON.parse(fs.readFileSync(`${LH_ROOT}/package.json`, 'utf-8'));
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion shared/localization/format.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import fs from 'fs';

import IntlMessageFormat from 'intl-messageformat';

import {getModuleDirectory} from '../../esm-utils.js';
import {getModuleDirectory} from '../esm-utils.js';
import {isObjectOfUnknownValues, isObjectOrArrayOfUnknownValues} from '../type-verifiers.js';
import {locales} from './locales.js';

Expand Down
2 changes: 1 addition & 1 deletion shared/localization/locales.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

import fs from 'fs';

import {getModuleDirectory} from '../../esm-utils.js';
import {getModuleDirectory} from '../esm-utils.js';

/** @typedef {import('../../types/lhr/settings').Locale} Locale */
/** @typedef {Record<string, {message: string}>} LhlMessages */
Expand Down
2 changes: 1 addition & 1 deletion shared/test/localization/format-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import * as i18n from '../../../core/lib/i18n/i18n.js';
import * as constants from '../../../core/config/constants.js';
import * as format from '../../localization/format.js';
import {locales} from '../../localization/locales.js';
import {getModuleDirectory, getModulePath} from '../../../esm-utils.js';
import {getModuleDirectory, getModulePath} from '../../esm-utils.js';
import {LH_ROOT} from '../../../root.js';

const moduleDir = getModuleDirectory(import.meta);
Expand Down
1 change: 0 additions & 1 deletion shared/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"include": [
"**/*.js",
"types/**/*.d.ts",
"../esm-utils.js",
],
"exclude": [
"test/**/*.js",
Expand Down
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
],
"include": [
"root.js",
"esm-utils.js",
"cli/**/*.js",
"core/**/*.js",
"core/index.cjs",
Expand Down
Loading