Refractoring Stage 6.23 Moved the mail API factory from the standalone window.epMailUiModules global into window.epMailFeatures.modules; mail-ui.js now uses the shared feature namespace. Bumped to 0.4.35 (Android version code 435) and updated REFACTOR_PLAN.md.
This commit is contained in:
+3
-1
@@ -123,6 +123,7 @@ This is a gradual destination, not a requirement to move everything at once. IPC
|
|||||||
- [x] Encapsulate snooze UI helpers locally while preserving explicit mail/productivity API usage (`snooze-ui.js`).
|
- [x] Encapsulate snooze UI helpers locally while preserving explicit mail/productivity API usage (`snooze-ui.js`).
|
||||||
- [x] Encapsulate keyboard shortcut settings and handlers locally; integrations remain through the mail/productivity feature APIs (`shortcuts.js`).
|
- [x] Encapsulate keyboard shortcut settings and handlers locally; integrations remain through the mail/productivity feature APIs (`shortcuts.js`).
|
||||||
- [x] Remove transitional renderer-state globals after all consumers migrated to the namespaced state API (`renderer-state.js`).
|
- [x] Remove transitional renderer-state globals after all consumers migrated to the namespaced state API (`renderer-state.js`).
|
||||||
|
- [x] Register the mail API factory under the shared feature namespace instead of a standalone renderer global (`renderer-mail-api.js`, `mail-ui.js`).
|
||||||
- [x] Migrate additional mail-related consumers to unique local aliases to avoid classic-script lexical redeclarations.
|
- [x] Migrate additional mail-related consumers to unique local aliases to avoid classic-script lexical redeclarations.
|
||||||
- [x] Add a combined-script parse test to prevent duplicate top-level lexical declarations from stopping later UI scripts.
|
- [x] Add a combined-script parse test to prevent duplicate top-level lexical declarations from stopping later UI scripts.
|
||||||
- [ ] Migrate remaining mail-related consumers and remove transitional global dependencies.
|
- [ ] Migrate remaining mail-related consumers and remove transitional global dependencies.
|
||||||
@@ -151,7 +152,7 @@ This is a gradual destination, not a requirement to move everything at once. IPC
|
|||||||
- Electron Builder and the desktop Actions artifact name derive from `package.json`.
|
- Electron Builder and the desktop Actions artifact name derive from `package.json`.
|
||||||
- Android `versionName` derives from the same package version. Its current `versionCode` mapping is `major * 10000 + minor * 100 + patch`; keep minor and patch below 100, and revise the mapping before reaching that boundary to avoid collisions.
|
- Android `versionName` derives from the same package version. Its current `versionCode` mapping is `major * 10000 + minor * 100 + patch`; keep minor and patch below 100, and revise the mapping before reaching that boundary to avoid collisions.
|
||||||
- `scripts/build-all.ps1` uses the package version for APK naming. Before a release, bump once with `npm run bump:build`, verify the lockfile and computed Android version code, and build every target without another bump.
|
- `scripts/build-all.ps1` uses the package version for APK naming. Before a release, bump once with `npm run bump:build`, verify the lockfile and computed Android version code, and build every target without another bump.
|
||||||
- Latest version check: `package.json` and both lockfile version fields are `0.4.34`; Android derives `versionName 0.4.34` and `versionCode 434`. The user confirms the previous artifact works; this bump is for the next build.
|
- Latest version check: `package.json` and both lockfile version fields are `0.4.35`; Android derives `versionName 0.4.35` and `versionCode 435`. The user confirms the previous artifact works; this bump is for the next build.
|
||||||
|
|
||||||
## Progress log
|
## Progress log
|
||||||
|
|
||||||
@@ -188,5 +189,6 @@ This is a gradual destination, not a requirement to move everything at once. IPC
|
|||||||
- Step 6 at version `0.4.32` scopes snooze UI helpers; message labeling and mail-state access remain routed through feature APIs.
|
- Step 6 at version `0.4.32` scopes snooze UI helpers; message labeling and mail-state access remain routed through feature APIs.
|
||||||
- Step 6 at version `0.4.33` scopes keyboard shortcut helpers and event handlers without changing their Preferences integration.
|
- Step 6 at version `0.4.33` scopes keyboard shortcut helpers and event handlers without changing their Preferences integration.
|
||||||
- Step 6 at version `0.4.34` removes legacy global renderer-state accessors; the state module now exposes only `window.epMailState` to the renderer.
|
- Step 6 at version `0.4.34` removes legacy global renderer-state accessors; the state module now exposes only `window.epMailState` to the renderer.
|
||||||
|
- Step 6 at version `0.4.35` consolidates the mail API factory under `window.epMailFeatures.modules`, removing the separate `window.epMailUiModules` global.
|
||||||
- The current IPC/DAV validation changes pass the full suite: 108 tests.
|
- The current IPC/DAV validation changes pass the full suite: 108 tests.
|
||||||
- While work continued, `package.json` and `package-lock.json` reflected a version bump to `0.4.6`; those changes were preserved.
|
- While work continued, `package.json` and `package-lock.json` reflected a version bump to `0.4.6`; those changes were preserved.
|
||||||
|
|||||||
+1
-2
@@ -791,7 +791,7 @@ if (window.daybreakMail) {
|
|||||||
}).catch(() => {});
|
}).catch(() => {});
|
||||||
}
|
}
|
||||||
|
|
||||||
const mailUiApi = window.epMailUiModules.createMailUiApi({
|
const mailUiApi = window.epMailFeatures.modules.createMailUiApi({
|
||||||
state: window.epMailState,
|
state: window.epMailState,
|
||||||
getConnectedAccount: () => mailFeatureState.connectedAccount,
|
getConnectedAccount: () => mailFeatureState.connectedAccount,
|
||||||
setConnectedAccount: account => { mailFeatureState.connectedAccount = account; },
|
setConnectedAccount: account => { mailFeatureState.connectedAccount = account; },
|
||||||
@@ -813,6 +813,5 @@ const mailUiApi = window.epMailUiModules.createMailUiApi({
|
|||||||
setOpenMessage: renderer => appShell.wrapOpenMessage(() => renderer),
|
setOpenMessage: renderer => appShell.wrapOpenMessage(() => renderer),
|
||||||
setShowCompose: renderer => appShell.wrapShowCompose(() => renderer)
|
setShowCompose: renderer => appShell.wrapShowCompose(() => renderer)
|
||||||
});
|
});
|
||||||
window.epMailFeatures = window.epMailFeatures || {};
|
|
||||||
window.epMailFeatures.mail = mailUiApi;
|
window.epMailFeatures.mail = mailUiApi;
|
||||||
})();
|
})();
|
||||||
|
|||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "ep-mail",
|
"name": "ep-mail",
|
||||||
"version": "0.4.34",
|
"version": "0.4.35",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "ep-mail",
|
"name": "ep-mail",
|
||||||
"version": "0.4.34",
|
"version": "0.4.35",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@capacitor/android": "^8.5.2",
|
"@capacitor/android": "^8.5.2",
|
||||||
"@capacitor/core": "^8.5.2",
|
"@capacitor/core": "^8.5.2",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ep-mail",
|
"name": "ep-mail",
|
||||||
"version": "0.4.34",
|
"version": "0.4.35",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "Eternity Project mail client",
|
"description": "Eternity Project mail client",
|
||||||
"homepage": "https://git.eternityproject.fi/thuttu/ep-mail-client",
|
"homepage": "https://git.eternityproject.fi/thuttu/ep-mail-client",
|
||||||
|
|||||||
@@ -48,7 +48,8 @@
|
|||||||
if (typeof module === 'object' && module.exports) {
|
if (typeof module === 'object' && module.exports) {
|
||||||
module.exports = { createMailUiApi };
|
module.exports = { createMailUiApi };
|
||||||
} else {
|
} else {
|
||||||
Object.defineProperty(root, 'epMailUiModules', {
|
root.epMailFeatures = root.epMailFeatures || {};
|
||||||
|
Object.defineProperty(root.epMailFeatures, 'modules', {
|
||||||
value: Object.freeze({ createMailUiApi }),
|
value: Object.freeze({ createMailUiApi }),
|
||||||
enumerable: false
|
enumerable: false
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ const test = require('node:test');
|
|||||||
const assert = require('node:assert/strict');
|
const assert = require('node:assert/strict');
|
||||||
const fs = require('node:fs');
|
const fs = require('node:fs');
|
||||||
const path = require('node:path');
|
const path = require('node:path');
|
||||||
|
const vm = require('node:vm');
|
||||||
const { createMailUiApi } = require('../renderer-mail-api.js');
|
const { createMailUiApi } = require('../renderer-mail-api.js');
|
||||||
|
|
||||||
test('mail feature API exposes explicit state and account/sync UI actions', () => {
|
test('mail feature API exposes explicit state and account/sync UI actions', () => {
|
||||||
@@ -56,6 +57,16 @@ test('mail feature API exposes explicit state and account/sync UI actions', () =
|
|||||||
assert.equal(Object.isFrozen(api), true);
|
assert.equal(Object.isFrozen(api), true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('browser mail API factory is registered under the shared feature namespace', () => {
|
||||||
|
const root = path.resolve(__dirname, '..');
|
||||||
|
const source = fs.readFileSync(path.join(root, 'renderer-mail-api.js'), 'utf8');
|
||||||
|
const window = {};
|
||||||
|
vm.runInNewContext(source, { window });
|
||||||
|
assert.equal(typeof window.epMailFeatures.modules.createMailUiApi, 'function');
|
||||||
|
assert.equal(Object.isFrozen(window.epMailFeatures.modules), true);
|
||||||
|
assert.equal(Object.hasOwn(window, 'epMailUiModules'), false);
|
||||||
|
});
|
||||||
|
|
||||||
test('account and snooze UI consume the explicit mail API instead of selected legacy globals', () => {
|
test('account and snooze UI consume the explicit mail API instead of selected legacy globals', () => {
|
||||||
const root = path.resolve(__dirname, '..');
|
const root = path.resolve(__dirname, '..');
|
||||||
const accountUi = fs.readFileSync(path.join(root, 'account-ui.js'), 'utf8');
|
const accountUi = fs.readFileSync(path.join(root, 'account-ui.js'), 'utf8');
|
||||||
@@ -88,6 +99,7 @@ test('account and snooze UI consume the explicit mail API instead of selected le
|
|||||||
assert.match(mailUi, /appShell\.wrapOpenMessage/);
|
assert.match(mailUi, /appShell\.wrapOpenMessage/);
|
||||||
assert.match(mailUi, /appShell\.wrapShowCompose/);
|
assert.match(mailUi, /appShell\.wrapShowCompose/);
|
||||||
assert.match(mailUi, /^\(\(\) => \{/);
|
assert.match(mailUi, /^\(\(\) => \{/);
|
||||||
|
assert.match(mailUi, /window\.epMailFeatures\.modules\.createMailUiApi/);
|
||||||
assert.match(mailUi, /window\.epMailFeatures\.mail = mailUiApi/);
|
assert.match(mailUi, /window\.epMailFeatures\.mail = mailUiApi/);
|
||||||
assert.doesNotMatch(mailUi, /(?<!\.)\bopenPreferences\s*\(|(?<!\.)\bquery\s*=/);
|
assert.doesNotMatch(mailUi, /(?<!\.)\bopenPreferences\s*\(|(?<!\.)\bquery\s*=/);
|
||||||
assert.match(shortcutsUi, /window\.epMailFeatures\.mail/);
|
assert.match(shortcutsUi, /window\.epMailFeatures\.mail/);
|
||||||
|
|||||||
+1
-2
@@ -791,7 +791,7 @@ if (window.daybreakMail) {
|
|||||||
}).catch(() => {});
|
}).catch(() => {});
|
||||||
}
|
}
|
||||||
|
|
||||||
const mailUiApi = window.epMailUiModules.createMailUiApi({
|
const mailUiApi = window.epMailFeatures.modules.createMailUiApi({
|
||||||
state: window.epMailState,
|
state: window.epMailState,
|
||||||
getConnectedAccount: () => mailFeatureState.connectedAccount,
|
getConnectedAccount: () => mailFeatureState.connectedAccount,
|
||||||
setConnectedAccount: account => { mailFeatureState.connectedAccount = account; },
|
setConnectedAccount: account => { mailFeatureState.connectedAccount = account; },
|
||||||
@@ -813,6 +813,5 @@ const mailUiApi = window.epMailUiModules.createMailUiApi({
|
|||||||
setOpenMessage: renderer => appShell.wrapOpenMessage(() => renderer),
|
setOpenMessage: renderer => appShell.wrapOpenMessage(() => renderer),
|
||||||
setShowCompose: renderer => appShell.wrapShowCompose(() => renderer)
|
setShowCompose: renderer => appShell.wrapShowCompose(() => renderer)
|
||||||
});
|
});
|
||||||
window.epMailFeatures = window.epMailFeatures || {};
|
|
||||||
window.epMailFeatures.mail = mailUiApi;
|
window.epMailFeatures.mail = mailUiApi;
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -48,7 +48,8 @@
|
|||||||
if (typeof module === 'object' && module.exports) {
|
if (typeof module === 'object' && module.exports) {
|
||||||
module.exports = { createMailUiApi };
|
module.exports = { createMailUiApi };
|
||||||
} else {
|
} else {
|
||||||
Object.defineProperty(root, 'epMailUiModules', {
|
root.epMailFeatures = root.epMailFeatures || {};
|
||||||
|
Object.defineProperty(root.epMailFeatures, 'modules', {
|
||||||
value: Object.freeze({ createMailUiApi }),
|
value: Object.freeze({ createMailUiApi }),
|
||||||
enumerable: false
|
enumerable: false
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user