@alwatr/dedupe 1.1.2 → 1.1.4
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 +10 -0
- package/dist/main.cjs +70 -2
- package/dist/main.cjs.LEGAL.txt +0 -0
- package/dist/main.cjs.map +2 -2
- package/dist/main.mjs +45 -2
- package/dist/main.mjs.LEGAL.txt +0 -0
- package/dist/main.mjs.map +2 -2
- package/package.json +11 -10
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
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.4](https://github.com/Alwatr/nanolib/compare/@alwatr/dedupe@1.1.3...@alwatr/dedupe@1.1.4) (2024-10-11)
|
|
7
|
+
|
|
8
|
+
### Miscellaneous Chores
|
|
9
|
+
|
|
10
|
+
* include LICENSE and LEGAL files to publish ([09f366f](https://github.com/Alwatr/nanolib/commit/09f366f680bfa9fb26acb2cd1ccbc68c5a9e9ad8)) by @AliMD
|
|
11
|
+
|
|
12
|
+
## [1.1.3](https://github.com/Alwatr/nanolib/compare/@alwatr/dedupe@1.1.2...@alwatr/dedupe@1.1.3) (2024-10-11)
|
|
13
|
+
|
|
14
|
+
**Note:** Version bump only for package @alwatr/dedupe
|
|
15
|
+
|
|
6
16
|
## [1.1.2](https://github.com/Alwatr/nanolib/compare/@alwatr/dedupe@1.1.1...@alwatr/dedupe@1.1.2) (2024-10-10)
|
|
7
17
|
|
|
8
18
|
### Dependencies update
|
package/dist/main.cjs
CHANGED
|
@@ -1,3 +1,71 @@
|
|
|
1
|
-
/* @alwatr/dedupe v1.1.
|
|
2
|
-
"use strict";
|
|
1
|
+
/* @alwatr/dedupe v1.1.4 */
|
|
2
|
+
"use strict";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/main.ts
|
|
22
|
+
var main_exports = {};
|
|
23
|
+
__export(main_exports, {
|
|
24
|
+
deduplicate: () => deduplicate,
|
|
25
|
+
definePackage: () => definePackage
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(main_exports);
|
|
28
|
+
var import_global_scope = require("@alwatr/global-scope");
|
|
29
|
+
var import_polyfill_has_own = require("@alwatr/polyfill-has-own");
|
|
30
|
+
if (typeof import_global_scope.globalScope.__alwatr_dedupe__ === "undefined") {
|
|
31
|
+
import_global_scope.globalScope.__alwatr_dedupe__ = "1.1.4";
|
|
32
|
+
} else {
|
|
33
|
+
if (import_global_scope.globalScope.__alwatr_dedupe__ === true) {
|
|
34
|
+
import_global_scope.globalScope.__alwatr_dedupe__ = "1.0.x";
|
|
35
|
+
}
|
|
36
|
+
console.error(new Error("duplication_detected", {
|
|
37
|
+
cause: {
|
|
38
|
+
name: "@alwatr/dedupe",
|
|
39
|
+
oldVersion: import_global_scope.globalScope.__alwatr_dedupe__,
|
|
40
|
+
newVersion: "1.1.4"
|
|
41
|
+
}
|
|
42
|
+
}));
|
|
43
|
+
}
|
|
44
|
+
var list = {};
|
|
45
|
+
function deduplicate(args) {
|
|
46
|
+
if (Object.hasOwn(list, args.name)) {
|
|
47
|
+
const error = new Error("duplication_detected", {
|
|
48
|
+
cause: {
|
|
49
|
+
name: args.name
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
if (args.strict) {
|
|
53
|
+
throw error;
|
|
54
|
+
} else {
|
|
55
|
+
console.error(error);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
list[args.name] = true;
|
|
59
|
+
}
|
|
60
|
+
deduplicate({ name: "@alwatr/dedupe" });
|
|
61
|
+
function definePackage(packageName, _) {
|
|
62
|
+
console.warn("`definePackage` in `@alwatr/dedupe` is deprecated. Use `deduplicate` instead.");
|
|
63
|
+
deduplicate({ name: packageName });
|
|
64
|
+
}
|
|
65
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
66
|
+
0 && (module.exports = {
|
|
67
|
+
deduplicate,
|
|
68
|
+
definePackage
|
|
69
|
+
});
|
|
70
|
+
/*! For license information please see main.cjs.LEGAL.txt */
|
|
3
71
|
//# sourceMappingURL=main.cjs.map
|
|
File without changes
|
package/dist/main.cjs.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/main.ts"],
|
|
4
4
|
"sourcesContent": ["import {globalScope} from '@alwatr/global-scope';\nimport '@alwatr/polyfill-has-own';\n\ndeclare global {\n // eslint-disable-next-line no-var\n var __alwatr_dedupe__: string | true;\n}\n\nif (typeof globalScope.__alwatr_dedupe__ === 'undefined') {\n globalScope.__alwatr_dedupe__ = __package_version__;\n}\nelse {\n if (globalScope.__alwatr_dedupe__ === true) {\n globalScope.__alwatr_dedupe__ = '1.0.x';\n }\n\n console.error(new Error('duplication_detected', {\n cause: {\n name: __package_name__,\n oldVersion: globalScope.__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": ";
|
|
6
|
-
"names": [
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAA0B;AAC1B,8BAAO;AAOP,IAAI,OAAO,gCAAY,sBAAsB,aAAa;AACxD,kCAAY,oBAAoB;AAClC,OACK;AACH,MAAI,gCAAY,sBAAsB,MAAM;AAC1C,oCAAY,oBAAoB;AAAA,EAClC;AAEA,UAAQ,MAAM,IAAI,MAAM,wBAAwB;AAAA,IAC9C,OAAO;AAAA,MACL,MAAM;AAAA,MACN,YAAY,gCAAY;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
|
+
"names": []
|
|
7
7
|
}
|
package/dist/main.mjs
CHANGED
|
@@ -1,3 +1,46 @@
|
|
|
1
|
-
/* @alwatr/dedupe v1.1.
|
|
2
|
-
|
|
1
|
+
/* @alwatr/dedupe v1.1.4 */
|
|
2
|
+
|
|
3
|
+
// src/main.ts
|
|
4
|
+
import { globalScope } from "@alwatr/global-scope";
|
|
5
|
+
import "@alwatr/polyfill-has-own";
|
|
6
|
+
if (typeof globalScope.__alwatr_dedupe__ === "undefined") {
|
|
7
|
+
globalScope.__alwatr_dedupe__ = "1.1.4";
|
|
8
|
+
} else {
|
|
9
|
+
if (globalScope.__alwatr_dedupe__ === true) {
|
|
10
|
+
globalScope.__alwatr_dedupe__ = "1.0.x";
|
|
11
|
+
}
|
|
12
|
+
console.error(new Error("duplication_detected", {
|
|
13
|
+
cause: {
|
|
14
|
+
name: "@alwatr/dedupe",
|
|
15
|
+
oldVersion: globalScope.__alwatr_dedupe__,
|
|
16
|
+
newVersion: "1.1.4"
|
|
17
|
+
}
|
|
18
|
+
}));
|
|
19
|
+
}
|
|
20
|
+
var list = {};
|
|
21
|
+
function deduplicate(args) {
|
|
22
|
+
if (Object.hasOwn(list, args.name)) {
|
|
23
|
+
const error = new Error("duplication_detected", {
|
|
24
|
+
cause: {
|
|
25
|
+
name: args.name
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
if (args.strict) {
|
|
29
|
+
throw error;
|
|
30
|
+
} else {
|
|
31
|
+
console.error(error);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
list[args.name] = true;
|
|
35
|
+
}
|
|
36
|
+
deduplicate({ name: "@alwatr/dedupe" });
|
|
37
|
+
function definePackage(packageName, _) {
|
|
38
|
+
console.warn("`definePackage` in `@alwatr/dedupe` is deprecated. Use `deduplicate` instead.");
|
|
39
|
+
deduplicate({ name: packageName });
|
|
40
|
+
}
|
|
41
|
+
export {
|
|
42
|
+
deduplicate,
|
|
43
|
+
definePackage
|
|
44
|
+
};
|
|
45
|
+
/*! For license information please see main.mjs.LEGAL.txt */
|
|
3
46
|
//# sourceMappingURL=main.mjs.map
|
|
File without changes
|
package/dist/main.mjs.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/main.ts"],
|
|
4
4
|
"sourcesContent": ["import {globalScope} from '@alwatr/global-scope';\nimport '@alwatr/polyfill-has-own';\n\ndeclare global {\n // eslint-disable-next-line no-var\n var __alwatr_dedupe__: string | true;\n}\n\nif (typeof globalScope.__alwatr_dedupe__ === 'undefined') {\n globalScope.__alwatr_dedupe__ = __package_version__;\n}\nelse {\n if (globalScope.__alwatr_dedupe__ === true) {\n globalScope.__alwatr_dedupe__ = '1.0.x';\n }\n\n console.error(new Error('duplication_detected', {\n cause: {\n name: __package_name__,\n oldVersion: globalScope.__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": "
|
|
6
|
-
"names": [
|
|
5
|
+
"mappings": ";;;AAAA,SAAQ,mBAAkB;AAC1B,OAAO;AAOP,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
|
+
"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.4",
|
|
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": [
|
|
@@ -36,7 +36,8 @@
|
|
|
36
36
|
},
|
|
37
37
|
"license": "AGPL-3.0-only",
|
|
38
38
|
"files": [
|
|
39
|
-
"**/*.{js,mjs,cjs,map,d.ts,html,md}",
|
|
39
|
+
"**/*.{js,mjs,cjs,map,d.ts,html,md,LEGAL.txt}",
|
|
40
|
+
"LICENSE",
|
|
40
41
|
"!demo/**/*"
|
|
41
42
|
],
|
|
42
43
|
"publishConfig": {
|
|
@@ -67,16 +68,16 @@
|
|
|
67
68
|
"clean": "rm -rfv dist *.tsbuildinfo"
|
|
68
69
|
},
|
|
69
70
|
"dependencies": {
|
|
70
|
-
"@alwatr/global-scope": "^1.1.
|
|
71
|
-
"@alwatr/package-tracer": "^1.0.
|
|
72
|
-
"@alwatr/polyfill-has-own": "^1.1.
|
|
71
|
+
"@alwatr/global-scope": "^1.1.26",
|
|
72
|
+
"@alwatr/package-tracer": "^1.0.4",
|
|
73
|
+
"@alwatr/polyfill-has-own": "^1.1.4"
|
|
73
74
|
},
|
|
74
75
|
"devDependencies": {
|
|
75
|
-
"@alwatr/nano-build": "^
|
|
76
|
-
"@alwatr/prettier-config": "^1.0.
|
|
77
|
-
"@alwatr/tsconfig-base": "^1.3.
|
|
78
|
-
"@alwatr/type-helper": "^2.0.
|
|
76
|
+
"@alwatr/nano-build": "^2.0.1",
|
|
77
|
+
"@alwatr/prettier-config": "^1.0.6",
|
|
78
|
+
"@alwatr/tsconfig-base": "^1.3.2",
|
|
79
|
+
"@alwatr/type-helper": "^2.0.2",
|
|
79
80
|
"typescript": "^5.6.3"
|
|
80
81
|
},
|
|
81
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "2a35f99b0347aacdccf3b6f28b30ca902f02a2f1"
|
|
82
83
|
}
|