@alwatr/dedupe 1.1.4 → 1.1.5
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 +11 -0
- package/dist/main.cjs +11 -8
- package/dist/main.cjs.map +2 -2
- package/dist/main.d.ts +0 -3
- package/dist/main.d.ts.map +1 -1
- package/dist/main.mjs +11 -8
- package/dist/main.mjs.map +2 -2
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.1.5](https://github.com/Alwatr/nanolib/compare/@alwatr/dedupe@1.1.4...@alwatr/dedupe@1.1.5) (2024-10-11)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* use new `global-this` package & remove global type ([63f5a3b](https://github.com/Alwatr/nanolib/commit/63f5a3b07f6d73d0c213cd893a382d5bfe1c4c34)) by @mohammadhonarvar
|
|
11
|
+
|
|
12
|
+
### Code Refactoring
|
|
13
|
+
|
|
14
|
+
* prevent side-effects ([01e00e1](https://github.com/Alwatr/nanolib/commit/01e00e191385cc92b28677df0c01a085916ae677)) by @mohammadhonarvar
|
|
15
|
+
* use new `global-this` package ([42510b9](https://github.com/Alwatr/nanolib/commit/42510b9ae0e385206a902db093d188949f1cb84e)) by @mohammadhonarvar
|
|
16
|
+
|
|
6
17
|
## [1.1.4](https://github.com/Alwatr/nanolib/compare/@alwatr/dedupe@1.1.3...@alwatr/dedupe@1.1.4) (2024-10-11)
|
|
7
18
|
|
|
8
19
|
### Miscellaneous Chores
|
package/dist/main.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* @alwatr/dedupe v1.1.
|
|
1
|
+
/* @alwatr/dedupe v1.1.5 */
|
|
2
2
|
"use strict";
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -25,19 +25,22 @@ __export(main_exports, {
|
|
|
25
25
|
definePackage: () => definePackage
|
|
26
26
|
});
|
|
27
27
|
module.exports = __toCommonJS(main_exports);
|
|
28
|
-
var
|
|
28
|
+
var import_global_this = require("@alwatr/global-this");
|
|
29
|
+
var import_package_tracer = require("@alwatr/package-tracer");
|
|
29
30
|
var import_polyfill_has_own = require("@alwatr/polyfill-has-own");
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
__dev_mode__: import_package_tracer.packageTracer.add("@alwatr/dedupe", "1.1.5");
|
|
32
|
+
var globalThis_ = (0, import_global_this.getGlobalThis)();
|
|
33
|
+
if (typeof globalThis_.__alwatr_dedupe__ === "undefined") {
|
|
34
|
+
globalThis_.__alwatr_dedupe__ = "1.1.5";
|
|
32
35
|
} else {
|
|
33
|
-
if (
|
|
34
|
-
|
|
36
|
+
if (globalThis_.__alwatr_dedupe__ === true) {
|
|
37
|
+
globalThis_.__alwatr_dedupe__ = "1.0.x";
|
|
35
38
|
}
|
|
36
39
|
console.error(new Error("duplication_detected", {
|
|
37
40
|
cause: {
|
|
38
41
|
name: "@alwatr/dedupe",
|
|
39
|
-
oldVersion:
|
|
40
|
-
newVersion: "1.1.
|
|
42
|
+
oldVersion: globalThis_.__alwatr_dedupe__,
|
|
43
|
+
newVersion: "1.1.5"
|
|
41
44
|
}
|
|
42
45
|
}));
|
|
43
46
|
}
|
package/dist/main.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/main.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,
|
|
4
|
+
"sourcesContent": ["import {getGlobalThis} from '@alwatr/global-this';\nimport {packageTracer} from '@alwatr/package-tracer';\nimport '@alwatr/polyfill-has-own';\n\n__dev_mode__: packageTracer.add(__package_name__, __package_version__);\n\nconst globalThis_ = getGlobalThis<{__alwatr_dedupe__: string | true}>();\n\nif (typeof globalThis_.__alwatr_dedupe__ === 'undefined') {\n globalThis_.__alwatr_dedupe__ = __package_version__;\n}\nelse {\n if (globalThis_.__alwatr_dedupe__ === true) {\n globalThis_.__alwatr_dedupe__ = '1.0.x';\n }\n\n console.error(new Error('duplication_detected', {\n cause: {\n name: __package_name__,\n oldVersion: globalThis_.__alwatr_dedupe__,\n newVersion: __package_version__\n },\n }));\n}\n\nconst list: DictionaryOpt<true> = {};\n\n/**\n * Prevent duplication in any entities like loading node packages.\n * @param name package name including scope. e.g. `@scope/package-name`\n * @param version package version (optional)\n *\n * @example\n * ```typescript\n * deduplicate({name: __package_name__, strict: true});\n * ```\n */\nexport function deduplicate(args: {name: string, strict?: true}): void {\n if (Object.hasOwn(list, args.name)) {\n const error = new Error('duplication_detected', {\n cause: {\n name: args.name,\n },\n });\n\n if (args.strict) {\n throw error;\n }\n else {\n console.error(error);\n }\n }\n\n list[args.name] = true;\n}\n\ndeduplicate({name: __package_name__});\n\n/**\n * Old `definePackage` for backward compatibility.\n * @deprecated Use `deduplicate` instead.\n*/\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport function definePackage(packageName: string, _?:string): void {\n console.warn('`definePackage` in `@alwatr/dedupe` is deprecated. Use `deduplicate` instead.');\n deduplicate({name: packageName});\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAA4B;AAC5B,4BAA4B;AAC5B,8BAAO;AAEP,aAAc,qCAAc,IAAI,kBAAkB,OAAmB;AAErE,IAAM,kBAAc,kCAAkD;AAEtE,IAAI,OAAO,YAAY,sBAAsB,aAAa;AACxD,cAAY,oBAAoB;AAClC,OACK;AACH,MAAI,YAAY,sBAAsB,MAAM;AAC1C,gBAAY,oBAAoB;AAAA,EAClC;AAEA,UAAQ,MAAM,IAAI,MAAM,wBAAwB;AAAA,IAC9C,OAAO;AAAA,MACL,MAAM;AAAA,MACN,YAAY,YAAY;AAAA,MACxB,YAAY;AAAA,IACd;AAAA,EACF,CAAC,CAAC;AACJ;AAEA,IAAM,OAA4B,CAAC;AAY5B,SAAS,YAAY,MAA2C;AACrE,MAAI,OAAO,OAAO,MAAM,KAAK,IAAI,GAAG;AAClC,UAAM,QAAQ,IAAI,MAAM,wBAAwB;AAAA,MAC9C,OAAO;AAAA,QACL,MAAM,KAAK;AAAA,MACb;AAAA,IACF,CAAC;AAED,QAAI,KAAK,QAAQ;AACf,YAAM;AAAA,IACR,OACK;AACH,cAAQ,MAAM,KAAK;AAAA,IACrB;AAAA,EACF;AAEA,OAAK,KAAK,IAAI,IAAI;AACpB;AAEA,YAAY,EAAC,MAAM,iBAAgB,CAAC;AAO7B,SAAS,cAAc,aAAqB,GAAiB;AAClE,UAAQ,KAAK,+EAA+E;AAC5F,cAAY,EAAC,MAAM,YAAW,CAAC;AACjC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/main.d.ts
CHANGED
package/dist/main.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAEA,OAAO,0BAA0B,CAAC;AAyBlC;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,IAAI,CAAA;CAAC,GAAG,IAAI,CAiBrE;AAID;;;EAGE;AAEF,wBAAgB,aAAa,CAAC,WAAW,EAAE,MAAM,EAAE,CAAC,CAAC,EAAC,MAAM,GAAG,IAAI,CAGlE"}
|
package/dist/main.mjs
CHANGED
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
/* @alwatr/dedupe v1.1.
|
|
1
|
+
/* @alwatr/dedupe v1.1.5 */
|
|
2
2
|
|
|
3
3
|
// src/main.ts
|
|
4
|
-
import {
|
|
4
|
+
import { getGlobalThis } from "@alwatr/global-this";
|
|
5
|
+
import { packageTracer } from "@alwatr/package-tracer";
|
|
5
6
|
import "@alwatr/polyfill-has-own";
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
__dev_mode__: packageTracer.add("@alwatr/dedupe", "1.1.5");
|
|
8
|
+
var globalThis_ = getGlobalThis();
|
|
9
|
+
if (typeof globalThis_.__alwatr_dedupe__ === "undefined") {
|
|
10
|
+
globalThis_.__alwatr_dedupe__ = "1.1.5";
|
|
8
11
|
} else {
|
|
9
|
-
if (
|
|
10
|
-
|
|
12
|
+
if (globalThis_.__alwatr_dedupe__ === true) {
|
|
13
|
+
globalThis_.__alwatr_dedupe__ = "1.0.x";
|
|
11
14
|
}
|
|
12
15
|
console.error(new Error("duplication_detected", {
|
|
13
16
|
cause: {
|
|
14
17
|
name: "@alwatr/dedupe",
|
|
15
|
-
oldVersion:
|
|
16
|
-
newVersion: "1.1.
|
|
18
|
+
oldVersion: globalThis_.__alwatr_dedupe__,
|
|
19
|
+
newVersion: "1.1.5"
|
|
17
20
|
}
|
|
18
21
|
}));
|
|
19
22
|
}
|
package/dist/main.mjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/main.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": ";;;AAAA,SAAQ,
|
|
4
|
+
"sourcesContent": ["import {getGlobalThis} from '@alwatr/global-this';\nimport {packageTracer} from '@alwatr/package-tracer';\nimport '@alwatr/polyfill-has-own';\n\n__dev_mode__: packageTracer.add(__package_name__, __package_version__);\n\nconst globalThis_ = getGlobalThis<{__alwatr_dedupe__: string | true}>();\n\nif (typeof globalThis_.__alwatr_dedupe__ === 'undefined') {\n globalThis_.__alwatr_dedupe__ = __package_version__;\n}\nelse {\n if (globalThis_.__alwatr_dedupe__ === true) {\n globalThis_.__alwatr_dedupe__ = '1.0.x';\n }\n\n console.error(new Error('duplication_detected', {\n cause: {\n name: __package_name__,\n oldVersion: globalThis_.__alwatr_dedupe__,\n newVersion: __package_version__\n },\n }));\n}\n\nconst list: DictionaryOpt<true> = {};\n\n/**\n * Prevent duplication in any entities like loading node packages.\n * @param name package name including scope. e.g. `@scope/package-name`\n * @param version package version (optional)\n *\n * @example\n * ```typescript\n * deduplicate({name: __package_name__, strict: true});\n * ```\n */\nexport function deduplicate(args: {name: string, strict?: true}): void {\n if (Object.hasOwn(list, args.name)) {\n const error = new Error('duplication_detected', {\n cause: {\n name: args.name,\n },\n });\n\n if (args.strict) {\n throw error;\n }\n else {\n console.error(error);\n }\n }\n\n list[args.name] = true;\n}\n\ndeduplicate({name: __package_name__});\n\n/**\n * Old `definePackage` for backward compatibility.\n * @deprecated Use `deduplicate` instead.\n*/\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport function definePackage(packageName: string, _?:string): void {\n console.warn('`definePackage` in `@alwatr/dedupe` is deprecated. Use `deduplicate` instead.');\n deduplicate({name: packageName});\n}\n"],
|
|
5
|
+
"mappings": ";;;AAAA,SAAQ,qBAAoB;AAC5B,SAAQ,qBAAoB;AAC5B,OAAO;AAEP,aAAc,eAAc,IAAI,kBAAkB,OAAmB;AAErE,IAAM,cAAc,cAAkD;AAEtE,IAAI,OAAO,YAAY,sBAAsB,aAAa;AACxD,cAAY,oBAAoB;AAClC,OACK;AACH,MAAI,YAAY,sBAAsB,MAAM;AAC1C,gBAAY,oBAAoB;AAAA,EAClC;AAEA,UAAQ,MAAM,IAAI,MAAM,wBAAwB;AAAA,IAC9C,OAAO;AAAA,MACL,MAAM;AAAA,MACN,YAAY,YAAY;AAAA,MACxB,YAAY;AAAA,IACd;AAAA,EACF,CAAC,CAAC;AACJ;AAEA,IAAM,OAA4B,CAAC;AAY5B,SAAS,YAAY,MAA2C;AACrE,MAAI,OAAO,OAAO,MAAM,KAAK,IAAI,GAAG;AAClC,UAAM,QAAQ,IAAI,MAAM,wBAAwB;AAAA,MAC9C,OAAO;AAAA,QACL,MAAM,KAAK;AAAA,MACb;AAAA,IACF,CAAC;AAED,QAAI,KAAK,QAAQ;AACf,YAAM;AAAA,IACR,OACK;AACH,cAAQ,MAAM,KAAK;AAAA,IACrB;AAAA,EACF;AAEA,OAAK,KAAK,IAAI,IAAI;AACpB;AAEA,YAAY,EAAC,MAAM,iBAAgB,CAAC;AAO7B,SAAS,cAAc,aAAqB,GAAiB;AAClE,UAAQ,KAAK,+EAA+E;AAC5F,cAAY,EAAC,MAAM,YAAW,CAAC;AACjC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alwatr/dedupe",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.5",
|
|
4
4
|
"description": "A package manager helper tool for debug list of defined (imported) packages in your ecosystem and prevent to duplicate import (install) multiple versions of the same package in your project (deduplicate packages).",
|
|
5
5
|
"author": "S. Ali Mihandoost <ali.mihandoost@gmail.com>",
|
|
6
6
|
"keywords": [
|
|
@@ -68,9 +68,9 @@
|
|
|
68
68
|
"clean": "rm -rfv dist *.tsbuildinfo"
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@alwatr/global-
|
|
72
|
-
"@alwatr/package-tracer": "^1.0.
|
|
73
|
-
"@alwatr/polyfill-has-own": "^1.1.
|
|
71
|
+
"@alwatr/global-this": "^1.0.0",
|
|
72
|
+
"@alwatr/package-tracer": "^1.0.5",
|
|
73
|
+
"@alwatr/polyfill-has-own": "^1.1.5"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
76
|
"@alwatr/nano-build": "^2.0.1",
|
|
@@ -79,5 +79,5 @@
|
|
|
79
79
|
"@alwatr/type-helper": "^2.0.2",
|
|
80
80
|
"typescript": "^5.6.3"
|
|
81
81
|
},
|
|
82
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "e474bb77657795c7b476fa3e98c219373ee45c2e"
|
|
83
83
|
}
|