@open-pioneer/core 4.1.0-dev.20250818125237 → 4.1.0-dev.20250911064905
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -1
- package/README.md +2 -1
- package/deprecated.d.ts +7 -1
- package/deprecated.js +3 -2
- package/deprecated.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -88,7 +88,8 @@ Then, when the deprecated functionality is being used, simply call that helper f
|
|
|
88
88
|
const printDeprecation = deprecated({
|
|
89
89
|
name: "someFunctionName",
|
|
90
90
|
packageName: "some-package",
|
|
91
|
-
since: "v1.2.3"
|
|
91
|
+
since: "v1.2.3",
|
|
92
|
+
alternative: "use xyz instead"
|
|
92
93
|
});
|
|
93
94
|
|
|
94
95
|
// Later, when the deprecated function is actually being used:
|
package/deprecated.d.ts
CHANGED
|
@@ -14,6 +14,11 @@ export interface DeprecatedOptions {
|
|
|
14
14
|
* The version or date in which the entity was deprecated.
|
|
15
15
|
*/
|
|
16
16
|
since: string;
|
|
17
|
+
/**
|
|
18
|
+
* Available alternatives, if any.
|
|
19
|
+
* Should be a succinct message like `use xyz instead`.
|
|
20
|
+
*/
|
|
21
|
+
alternative?: string;
|
|
17
22
|
}
|
|
18
23
|
/**
|
|
19
24
|
* Creates a deprecation helper for a deprecated entity.
|
|
@@ -33,7 +38,8 @@ export interface DeprecatedOptions {
|
|
|
33
38
|
* const printDeprecation = deprecated({
|
|
34
39
|
* name: "someFunctionName",
|
|
35
40
|
* packageName: "some-package",
|
|
36
|
-
* since: "v1.2.3"
|
|
41
|
+
* since: "v1.2.3",
|
|
42
|
+
* alternative: "use xyz instead"
|
|
37
43
|
* });
|
|
38
44
|
*
|
|
39
45
|
* // Later, when the deprecated function is actually being used:
|
package/deprecated.js
CHANGED
|
@@ -14,9 +14,10 @@ function deprecated(options) {
|
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
16
|
function buildDeprecationWarning(options) {
|
|
17
|
-
const { packageName, name, since } = options;
|
|
17
|
+
const { packageName, name, since, alternative } = options;
|
|
18
18
|
const packageInfo = packageName ? ` in ${packageName}` : "";
|
|
19
|
-
const
|
|
19
|
+
const alternativeInfo = alternative ? `, ${alternative}` : "";
|
|
20
|
+
const message = `\u26A0\uFE0F DEPRECATED: ${name}${packageInfo} (since ${since}${alternativeInfo}) - Please update your code as this may be removed in future versions.`;
|
|
20
21
|
return message;
|
|
21
22
|
}
|
|
22
23
|
|
package/deprecated.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deprecated.js","sources":["deprecated.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nconst PRINT_DEPRECATIONS =\n typeof __PRINT_DEPRECATIONS__ !== \"undefined\" ? __PRINT_DEPRECATIONS__ : true;\n\n/**\n * Options supported by {@link deprecated}.\n */\nexport interface DeprecatedOptions {\n /**\n * The package that contains the deprecated entity.\n */\n packageName?: string;\n\n /**\n * The entity name (class name, function name, option, ...) that was deprecated.\n */\n name: string;\n\n /**\n * The version or date in which the entity was deprecated.\n */\n since: string;\n}\n\n/**\n * Creates a deprecation helper for a deprecated entity.\n *\n * This helper is used to print a deprecation warning to the browser console\n * when the deprecated functionality is being used.\n *\n * Returns a _function_ that should be called when the deprecated entity is being used.\n * The function will print a deprecation warning when usage is detected for the first time.\n * Any further calls will have no effect to prevent spamming the console.\n *\n * > NOTE: Deprecation warnings are only printed in development builds.\n *\n * Example:\n *\n * ```js\n * const printDeprecation = deprecated({\n * name: \"someFunctionName\",\n * packageName: \"some-package\",\n * since: \"v1.2.3\"\n * });\n *\n * // Later, when the deprecated function is actually being used:\n * function someFunctionName() {\n * printDeprecation();\n * // ...\n * } *\n * ```\n */\nexport function deprecated(options: DeprecatedOptions): () => void {\n if (!PRINT_DEPRECATIONS || !import.meta.env.DEV) {\n return () => {}; // do nothing\n }\n\n let called = false;\n return function deprecationHelper() {\n if (called) {\n return;\n }\n\n called = true;\n console.warn(buildDeprecationWarning(options));\n };\n}\n\nfunction buildDeprecationWarning(options: DeprecatedOptions): string {\n const { packageName, name, since } = options;\n const packageInfo = packageName ? ` in ${packageName}` : \"\";\n const message = `⚠️ DEPRECATED: ${name}${packageInfo} (since ${since}) - Please update your code as this may be removed in future versions.`;\n return message;\n}\n"],"names":[],"mappings":"AAEA,MAAM,kBAAA,GACF,OAAO,sBAAA,KAA2B,WAAA,GAAc,sBAAA,GAAyB,IAAA;
|
|
1
|
+
{"version":3,"file":"deprecated.js","sources":["deprecated.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nconst PRINT_DEPRECATIONS =\n typeof __PRINT_DEPRECATIONS__ !== \"undefined\" ? __PRINT_DEPRECATIONS__ : true;\n\n/**\n * Options supported by {@link deprecated}.\n */\nexport interface DeprecatedOptions {\n /**\n * The package that contains the deprecated entity.\n */\n packageName?: string;\n\n /**\n * The entity name (class name, function name, option, ...) that was deprecated.\n */\n name: string;\n\n /**\n * The version or date in which the entity was deprecated.\n */\n since: string;\n\n /**\n * Available alternatives, if any.\n * Should be a succinct message like `use xyz instead`.\n */\n alternative?: string;\n}\n\n/**\n * Creates a deprecation helper for a deprecated entity.\n *\n * This helper is used to print a deprecation warning to the browser console\n * when the deprecated functionality is being used.\n *\n * Returns a _function_ that should be called when the deprecated entity is being used.\n * The function will print a deprecation warning when usage is detected for the first time.\n * Any further calls will have no effect to prevent spamming the console.\n *\n * > NOTE: Deprecation warnings are only printed in development builds.\n *\n * Example:\n *\n * ```js\n * const printDeprecation = deprecated({\n * name: \"someFunctionName\",\n * packageName: \"some-package\",\n * since: \"v1.2.3\",\n * alternative: \"use xyz instead\"\n * });\n *\n * // Later, when the deprecated function is actually being used:\n * function someFunctionName() {\n * printDeprecation();\n * // ...\n * } *\n * ```\n */\nexport function deprecated(options: DeprecatedOptions): () => void {\n if (!PRINT_DEPRECATIONS || !import.meta.env.DEV) {\n return () => {}; // do nothing\n }\n\n let called = false;\n return function deprecationHelper() {\n if (called) {\n return;\n }\n\n called = true;\n console.warn(buildDeprecationWarning(options));\n };\n}\n\nfunction buildDeprecationWarning(options: DeprecatedOptions): string {\n const { packageName, name, since, alternative } = options;\n const packageInfo = packageName ? ` in ${packageName}` : \"\";\n const alternativeInfo = alternative ? `, ${alternative}` : \"\";\n const message = `⚠️ DEPRECATED: ${name}${packageInfo} (since ${since}${alternativeInfo}) - Please update your code as this may be removed in future versions.`;\n return message;\n}\n"],"names":[],"mappings":"AAEA,MAAM,kBAAA,GACF,OAAO,sBAAA,KAA2B,WAAA,GAAc,sBAAA,GAAyB,IAAA;AAyDtE,SAAS,WAAW,OAAA,EAAwC;AAC/D,EAAA,IAAI,CAAC,kBAAA,IAAsB,CAAC,MAAA,CAAA,IAAA,CAAY,IAAI,GAAA,EAAK;AAC7C,IAAA,OAAO,MAAM;AAAA,IAAC,CAAA;AAAA,EAClB;AAEA,EAAA,IAAI,MAAA,GAAS,KAAA;AACb,EAAA,OAAO,SAAS,iBAAA,GAAoB;AAChC,IAAA,IAAI,MAAA,EAAQ;AACR,MAAA;AAAA,IACJ;AAEA,IAAA,MAAA,GAAS,IAAA;AACT,IAAA,OAAA,CAAQ,IAAA,CAAK,uBAAA,CAAwB,OAAO,CAAC,CAAA;AAAA,EACjD,CAAA;AACJ;AAEA,SAAS,wBAAwB,OAAA,EAAoC;AACjE,EAAA,MAAM,EAAE,WAAA,EAAa,IAAA,EAAM,KAAA,EAAO,aAAY,GAAI,OAAA;AAClD,EAAA,MAAM,WAAA,GAAc,WAAA,GAAc,CAAA,IAAA,EAAO,WAAW,CAAA,CAAA,GAAK,EAAA;AACzD,EAAA,MAAM,eAAA,GAAkB,WAAA,GAAc,CAAA,EAAA,EAAK,WAAW,CAAA,CAAA,GAAK,EAAA;AAC3D,EAAA,MAAM,OAAA,GAAU,4BAAkB,IAAI,CAAA,EAAG,WAAW,CAAA,QAAA,EAAW,KAAK,GAAG,eAAe,CAAA,sEAAA,CAAA;AACtF,EAAA,OAAO,OAAA;AACX;;;;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@open-pioneer/core",
|
|
4
|
-
"version": "4.1.0-dev.
|
|
4
|
+
"version": "4.1.0-dev.20250911064905",
|
|
5
5
|
"description": "Contains basic utility functions and classes used by the @open-pioneer project.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"open-pioneer-trails"
|