Skip to content

Commit 33bfcbc

Browse files
authored
refactor(core)!: Remove deprecated plugin methods/properties (#7749)
1 parent 8b01b2b commit 33bfcbc

File tree

9 files changed

+1
-398
lines changed

9 files changed

+1
-398
lines changed

core/src/definitions.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import type { PluginRegistry } from './legacy/legacy-definitions';
21
import type { CapacitorException } from './util';
32

43
export interface CapacitorGlobal {
@@ -44,21 +43,6 @@ export interface CapacitorGlobal {
4443

4544
DEBUG?: boolean;
4645
isLoggingEnabled?: boolean;
47-
48-
// Deprecated in v3, will be removed from v4
49-
50-
/**
51-
* @deprecated Plugins should be imported instead. Deprecated in
52-
* v3 and Capacitor.Plugins property definition will not be exported in v4.
53-
*/
54-
Plugins: PluginRegistry;
55-
56-
/**
57-
* Called when a plugin method is not available. Defaults to console
58-
* logging a warning. Provided for backwards compatibility.
59-
* @deprecated Deprecated in v3, will be removed from v4
60-
*/
61-
pluginMethodNoop: (target: any, key: PropertyKey, pluginName: string) => Promise<never>;
6246
}
6347

6448
/**

core/src/global.ts

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import { legacyRegisterWebPlugin } from './legacy/legacy-web-plugin-merge';
21
import { initCapacitorGlobal } from './runtime';
3-
import type { WebPlugin } from './web-plugin';
42

53
export const Capacitor = /*#__PURE__*/ initCapacitorGlobal(
64
typeof globalThis !== 'undefined'
@@ -15,23 +13,3 @@ export const Capacitor = /*#__PURE__*/ initCapacitorGlobal(
1513
);
1614

1715
export const registerPlugin = Capacitor.registerPlugin;
18-
19-
/**
20-
* @deprecated Provided for backwards compatibility for Capacitor v2 plugins.
21-
* Capacitor v3 plugins should import the plugin directly. This "Plugins"
22-
* export is deprecated in v3, and will be removed in v4.
23-
*/
24-
export const Plugins = Capacitor.Plugins;
25-
26-
/**
27-
* Provided for backwards compatibility. Use the registerPlugin() API
28-
* instead, and provide the web plugin as the "web" implmenetation.
29-
* For example
30-
*
31-
* export const Example = registerPlugin('Example', {
32-
* web: () => import('./web').then(m => new m.Example())
33-
* })
34-
*
35-
* @deprecated Deprecated in v3, will be removed from v4.
36-
*/
37-
export const registerWebPlugin = (plugin: WebPlugin): void => legacyRegisterWebPlugin(Capacitor, plugin);

core/src/index.ts

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export { CapacitorPlatforms, addPlatform, setPlatform } from './platforms';
1717
export { Capacitor, registerPlugin } from './global';
1818

1919
// Base WebPlugin
20-
export { WebPlugin, WebPluginConfig, ListenerCallback } from './web-plugin';
20+
export { WebPlugin, ListenerCallback } from './web-plugin';
2121

2222
// Core Plugins APIs
2323
export { CapacitorCookies, CapacitorHttp, WebView, buildRequestInit } from './core-plugins';
@@ -38,15 +38,3 @@ export type {
3838

3939
// Constants
4040
export { CapacitorException, ExceptionCode } from './util';
41-
42-
// Legacy Global APIs
43-
export { Plugins, registerWebPlugin } from './global';
44-
45-
// Legacy Type Definitions
46-
export type {
47-
CallbackID,
48-
CancellableCallback,
49-
ISODateString,
50-
PluginConfig,
51-
PluginRegistry,
52-
} from './legacy/legacy-definitions';

core/src/legacy/legacy-definitions.ts

Lines changed: 0 additions & 41 deletions
This file was deleted.

core/src/legacy/legacy-web-plugin-merge.ts

Lines changed: 0 additions & 28 deletions
This file was deleted.

core/src/runtime.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,6 @@ export const createCapacitor = (win: WindowCapacitor): CapacitorInstance => {
5454

5555
const handleError = (err: Error) => win.console.error(err);
5656

57-
const pluginMethodNoop = (_target: any, prop: PropertyKey, pluginName: string) => {
58-
return Promise.reject(`${pluginName} does not have an implementation of "${prop as any}".`);
59-
};
60-
6157
const registeredPlugins = new Map<string, RegisteredPlugin>();
6258

6359
const defaultRegisterPlugin = (pluginName: string, jsImplementations: PluginImplementations = {}): any => {
@@ -214,7 +210,6 @@ export const createCapacitor = (win: WindowCapacitor): CapacitorInstance => {
214210
cap.handleError = handleError;
215211
cap.isNativePlatform = isNativePlatform;
216212
cap.isPluginAvailable = isPluginAvailable;
217-
cap.pluginMethodNoop = pluginMethodNoop;
218213
cap.registerPlugin = registerPlugin;
219214
cap.Exception = CapacitorException;
220215
cap.DEBUG = !!cap.DEBUG;

core/src/tests/legacy.spec.ts

Lines changed: 0 additions & 180 deletions
This file was deleted.

0 commit comments

Comments
 (0)