DEV: Move `discourse-common/resolver` to `discourse/resolver` (#30737)

`discourse-common` was created in the past to share logic between the
'wizard' app and the main 'discourse' app. Since then, the wizard has
been consolidated into the main app, so the separation of
`discourse-common` is no longer useful.

This commit moves `discourse-common/resolver` into `discourse/resolver`,
adds shims for the imports, and updates existing uses in core.
This commit is contained in:
David Taylor 2025-01-13 14:08:25 +00:00 committed by GitHub
parent 0ed4b09527
commit 5a565105c9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 18 additions and 8 deletions

1
.npmrc
View File

@ -1,2 +1,3 @@
engine-strict = true
auto-install-peers = false
ignore-workspace-cycles = true

View File

@ -16,8 +16,8 @@ import { VERSION } from "@ember/version";
import require from "require";
import { normalizeEmberEventHandling } from "discourse/lib/ember-events";
import { withPluginApi } from "discourse/lib/plugin-api";
import { buildResolver } from "discourse/resolver";
import { isTesting } from "discourse-common/config/environment";
import { buildResolver } from "discourse-common/resolver";
const _pluginCallbacks = [];
let _unhandledThemeErrors = [];

View File

@ -124,3 +124,8 @@ loaderShim("discourse-common/utils/macro-alias", () =>
loaderShim("discourse-common/utils/multi-cache", () =>
importSync("discourse/lib/multi-cache")
);
loaderShim("discourse-common/deprecation-workflow", () =>
importSync("discourse/deprecation-workflow")
);
loaderShim("discourse-common/resolver", () => importSync("discourse/resolver"));

View File

@ -1,5 +1,5 @@
import Mobile from "discourse/lib/mobile";
import { setResolverOption } from "discourse-common/resolver";
import { setResolverOption } from "discourse/resolver";
// Initializes the `Mobile` helper object.
export default {

View File

@ -1,7 +1,7 @@
import require from "require";
import deprecated from "discourse/lib/deprecated";
import { RAW_TOPIC_LIST_DEPRECATION_OPTIONS } from "discourse/lib/plugin-api";
import { getResolverOption } from "discourse-common/resolver";
import { getResolverOption } from "discourse/resolver";
export const __DISCOURSE_RAW_TEMPLATES = {};
let _needsHbrTopicList = false;

View File

@ -26,6 +26,7 @@
"discourse-hbr": "workspace:1.0.0",
"discourse-widget-hbs": "workspace:1.0.0",
"ember-curry-component": "^0.1.0",
"ember-resolver": "^13.1.0",
"ember-route-template": "^1.0.3",
"ember-tracked-storage-polyfill": "^1.0.0",
"handlebars": "^4.7.8",

View File

@ -5,9 +5,9 @@ import KeyValueStore from "discourse/lib/key-value-store";
import RestModel from "discourse/models/rest";
import Site from "discourse/models/site";
import TopicTrackingState from "discourse/models/topic-tracking-state";
import { buildResolver } from "discourse/resolver";
import Store from "discourse/services/store";
import { currentSettings } from "discourse/tests/helpers/site-settings";
import { buildResolver } from "discourse-common/resolver";
class CatAdapter extends RestAdapter {
primaryKey = "cat_id";

View File

@ -90,6 +90,7 @@ import { clearAddedTrackedPostProperties } from "discourse/models/post";
import { resetLastEditNotificationClick } from "discourse/models/post-stream";
import Site from "discourse/models/site";
import User from "discourse/models/user";
import { clearResolverOptions } from "discourse/resolver";
import sessionFixtures from "discourse/tests/fixtures/session-fixtures";
import siteFixtures from "discourse/tests/fixtures/site-fixtures";
import {
@ -99,7 +100,6 @@ import {
import { resetDecorators as resetPostCookedDecorators } from "discourse/widgets/post-cooked";
import { resetPostMenuExtraButtons } from "discourse/widgets/post-menu";
import { resetDecorators } from "discourse/widgets/widget";
import { clearResolverOptions } from "discourse-common/resolver";
import I18n from "discourse-i18n";
import { _clearSnapshots } from "select-kit/components/composer-actions";
import { setupDSelectAssertions } from "./d-select-assertions";

View File

@ -1,6 +1,6 @@
import DiscourseTemplateMap from "discourse/lib/discourse-template-map";
import { expireConnectorCache } from "discourse/lib/plugin-connectors";
import { expireModuleTrieCache } from "discourse-common/resolver";
import { expireModuleTrieCache } from "discourse/resolver";
const modifications = [];

View File

@ -43,7 +43,7 @@ import { disableCloaking } from "discourse/widgets/post-stream";
import deprecated from "discourse/lib/deprecated";
import { setDefaultOwner } from "discourse/lib/get-owner";
import { setupS3CDN, setupURL } from "discourse/lib/get-url";
import { buildResolver } from "discourse-common/resolver";
import { buildResolver } from "discourse/resolver";
import { loadSprites } from "../lib/svg-sprite-loader";
import * as FakerModule from "@faker-js/faker";
import { setLoadedFaker } from "discourse/lib/load-faker";

View File

@ -2,8 +2,8 @@ import { setupTest } from "ember-qunit";
import { module, test } from "qunit";
import { withSilencedDeprecations } from "discourse/lib/deprecated";
import DiscourseTemplateMap from "discourse/lib/discourse-template-map";
import { buildResolver, setResolverOption } from "discourse/resolver";
import { registerTemporaryModule } from "discourse/tests/helpers/temporary-module-helper";
import { buildResolver, setResolverOption } from "discourse-common/resolver";
let resolver;

View File

@ -299,6 +299,9 @@ importers:
ember-curry-component:
specifier: ^0.1.0
version: 0.1.0(@babel/core@7.26.0)
ember-resolver:
specifier: ^13.1.0
version: 13.1.0(ember-source@5.12.0(patch_hash=xx7mvsb7nmshqkkqhmf45r3hse)(@glimmer/component@1.1.2(@babel/core@7.26.0))(@glint/template@1.5.1)(rsvp@4.8.5)(webpack@5.97.1(@swc/core@1.10.7)(esbuild@0.24.2)))
ember-route-template:
specifier: ^1.0.3
version: 1.0.3