@alwatr/dedupe 1.0.0
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 +14 -0
- package/LICENSE +21 -0
- package/README.md +17 -0
- package/dist/main.cjs +3 -0
- package/dist/main.cjs.map +7 -0
- package/dist/main.d.ts +18 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.mjs +3 -0
- package/dist/main.mjs.map +7 -0
- package/package.json +78 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
+
|
|
6
|
+
# 1.0.0 (2024-01-03)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* __package_version__ global type ([de8a3f9](https://github.com/Alwatr/nanolib/commit/de8a3f93bdb5a786c42f56324072b4b9520ce3a1)) by @
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
* **dedupe:** new package ([77fcdf6](https://github.com/Alwatr/nanolib/commit/77fcdf6fc8701910a7d503b7fba89fd284f36833)) by @
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 S. Ali Mihandoost
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Dedupe
|
|
2
|
+
|
|
3
|
+
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).
|
|
4
|
+
|
|
5
|
+
## Example usage
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import {definePackage} from '@alwatr/dedupe';
|
|
9
|
+
|
|
10
|
+
definePackage('@alwatr/logger', '2.0.0');
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
You can use __package_version__ to automatically obtain the version of the package if you are using @alwatr/nano-build to build your package.
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
definePackage('@alwatr/logger', __package_version__);
|
|
17
|
+
```
|
package/dist/main.cjs
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/* @alwatr/dedupe v1.0.0 */
|
|
2
|
+
"use strict";var _=Object.defineProperty;var o=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var u=(e,r)=>{for(var t in r)_(e,t,{get:r[t],enumerable:!0})},f=(e,r,t,d)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of p(r))!c.call(e,i)&&i!==t&&_(e,i,{get:()=>r[i],enumerable:!(d=o(r,i))||d.enumerable});return e};var l=e=>f(_({},"__esModule",{value:!0}),e);var s={};u(s,{definePackage:()=>n,definedPackageList:()=>a});module.exports=l(s);if(typeof __dedupe__<"u")throw new Error("duplicate_dedupe");var a={};function n(e,r="v?"){if(e in a)throw new Error("duplicate_package",{cause:e});a[e]=r}n("@alwatr/dedupe","1.0.0");0&&(module.exports={definePackage,definedPackageList});
|
|
3
|
+
//# sourceMappingURL=main.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/main.ts"],
|
|
4
|
+
"sourcesContent": ["import type {Dictionary} from '@alwatr/type-helper'\n\ndeclare global {\n // eslint-disable-next-line no-var\n var __dedupe__: true;\n\n // eslint-disable-next-line no-var\n var __package_version__: string;\n}\n\nif (typeof __dedupe__ !== 'undefined') {\n throw new Error('duplicate_dedupe');\n}\n\nexport const definedPackageList: Dictionary<string> = {};\n\n/**\n * Global define package for managing package versions to prevent version conflicts.\n * @param packageName package name including scope. e.g. `@scope/package-name`\n * @param version package version (optional)\n *\n * @example\n * ```typescript\n * definePackage('@scope/package-name', __package_version__);\n * ```\n */\nexport function definePackage (packageName: string, version = 'v?'): void {\n if (packageName in definedPackageList) {\n throw new Error('duplicate_package', {\n cause: packageName,\n });\n }\n\n definedPackageList[packageName] = version;\n}\n\ndefinePackage('@alwatr/dedupe', __package_version__);\n"],
|
|
5
|
+
"mappings": ";yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mBAAAE,EAAA,uBAAAC,IAAA,eAAAC,EAAAJ,GAUA,GAAI,OAAO,WAAe,IACxB,MAAM,IAAI,MAAM,kBAAkB,EAG7B,IAAMG,EAAyC,CAAC,EAYhD,SAASD,EAAeG,EAAqBC,EAAU,KAAY,CACxE,GAAID,KAAeF,EACjB,MAAM,IAAI,MAAM,oBAAqB,CACnC,MAAOE,CACT,CAAC,EAGHF,EAAmBE,CAAW,EAAIC,CACpC,CAEAJ,EAAc,iBAAkB,OAAmB",
|
|
6
|
+
"names": ["main_exports", "__export", "definePackage", "definedPackageList", "__toCommonJS", "packageName", "version"]
|
|
7
|
+
}
|
package/dist/main.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Dictionary } from '@alwatr/type-helper';
|
|
2
|
+
declare global {
|
|
3
|
+
var __dedupe__: true;
|
|
4
|
+
var __package_version__: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const definedPackageList: Dictionary<string>;
|
|
7
|
+
/**
|
|
8
|
+
* Global define package for managing package versions to prevent version conflicts.
|
|
9
|
+
* @param packageName package name including scope. e.g. `@scope/package-name`
|
|
10
|
+
* @param version package version (optional)
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* definePackage('@scope/package-name', __package_version__);
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare function definePackage(packageName: string, version?: string): void;
|
|
18
|
+
//# sourceMappingURL=main.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,qBAAqB,CAAA;AAEnD,OAAO,CAAC,MAAM,CAAC;IAEb,IAAI,UAAU,EAAE,IAAI,CAAC;IAGrB,IAAI,mBAAmB,EAAE,MAAM,CAAC;CACjC;AAMD,eAAO,MAAM,kBAAkB,EAAE,UAAU,CAAC,MAAM,CAAM,CAAC;AAEzD;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAE,WAAW,EAAE,MAAM,EAAE,OAAO,SAAO,GAAG,IAAI,CAQxE"}
|
package/dist/main.mjs
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/* @alwatr/dedupe v1.0.0 */
|
|
2
|
+
if(typeof __dedupe__<"u")throw new Error("duplicate_dedupe");var r={};function t(e,i="v?"){if(e in r)throw new Error("duplicate_package",{cause:e});r[e]=i}t("@alwatr/dedupe","1.0.0");export{t as definePackage,r as definedPackageList};
|
|
3
|
+
//# sourceMappingURL=main.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/main.ts"],
|
|
4
|
+
"sourcesContent": ["import type {Dictionary} from '@alwatr/type-helper'\n\ndeclare global {\n // eslint-disable-next-line no-var\n var __dedupe__: true;\n\n // eslint-disable-next-line no-var\n var __package_version__: string;\n}\n\nif (typeof __dedupe__ !== 'undefined') {\n throw new Error('duplicate_dedupe');\n}\n\nexport const definedPackageList: Dictionary<string> = {};\n\n/**\n * Global define package for managing package versions to prevent version conflicts.\n * @param packageName package name including scope. e.g. `@scope/package-name`\n * @param version package version (optional)\n *\n * @example\n * ```typescript\n * definePackage('@scope/package-name', __package_version__);\n * ```\n */\nexport function definePackage (packageName: string, version = 'v?'): void {\n if (packageName in definedPackageList) {\n throw new Error('duplicate_package', {\n cause: packageName,\n });\n }\n\n definedPackageList[packageName] = version;\n}\n\ndefinePackage('@alwatr/dedupe', __package_version__);\n"],
|
|
5
|
+
"mappings": ";AAUA,GAAI,OAAO,WAAe,IACxB,MAAM,IAAI,MAAM,kBAAkB,EAG7B,IAAMA,EAAyC,CAAC,EAYhD,SAASC,EAAeC,EAAqBC,EAAU,KAAY,CACxE,GAAID,KAAeF,EACjB,MAAM,IAAI,MAAM,oBAAqB,CACnC,MAAOE,CACT,CAAC,EAGHF,EAAmBE,CAAW,EAAIC,CACpC,CAEAF,EAAc,iBAAkB,OAAmB",
|
|
6
|
+
"names": ["definedPackageList", "definePackage", "packageName", "version"]
|
|
7
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@alwatr/dedupe",
|
|
3
|
+
"version": "1.0.0",
|
|
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
|
+
"author": "S. Ali Mihandoost <ali.mihandoost@gmail.com>",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"dedupe",
|
|
8
|
+
"define-package",
|
|
9
|
+
"deduplicate",
|
|
10
|
+
"package",
|
|
11
|
+
"package-manager",
|
|
12
|
+
"cross-platform",
|
|
13
|
+
"ECMAScript",
|
|
14
|
+
"typescript",
|
|
15
|
+
"javascript",
|
|
16
|
+
"node",
|
|
17
|
+
"nodejs",
|
|
18
|
+
"esm",
|
|
19
|
+
"module",
|
|
20
|
+
"utility",
|
|
21
|
+
"util",
|
|
22
|
+
"utils",
|
|
23
|
+
"nanolib",
|
|
24
|
+
"alwatr"
|
|
25
|
+
],
|
|
26
|
+
"type": "module",
|
|
27
|
+
"main": "./dist/main.cjs",
|
|
28
|
+
"module": "./dist/main.mjs",
|
|
29
|
+
"types": "./dist/main.d.ts",
|
|
30
|
+
"exports": {
|
|
31
|
+
".": {
|
|
32
|
+
"import": "./dist/main.mjs",
|
|
33
|
+
"require": "./dist/main.cjs",
|
|
34
|
+
"types": "./dist/main.d.ts"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"license": "MIT",
|
|
38
|
+
"files": [
|
|
39
|
+
"**/*.{js,mjs,cjs,map,d.ts,html,md}",
|
|
40
|
+
"!demo/**/*"
|
|
41
|
+
],
|
|
42
|
+
"publishConfig": {
|
|
43
|
+
"access": "public"
|
|
44
|
+
},
|
|
45
|
+
"repository": {
|
|
46
|
+
"type": "git",
|
|
47
|
+
"url": "https://github.com/Alwatr/nanolib",
|
|
48
|
+
"directory": "packages/dedupe"
|
|
49
|
+
},
|
|
50
|
+
"homepage": "https://github.com/Alwatr/nanolib/tree/next/packages/dedupe#readme",
|
|
51
|
+
"bugs": {
|
|
52
|
+
"url": "https://github.com/Alwatr/nanolib/issues"
|
|
53
|
+
},
|
|
54
|
+
"prettier": "@alwatr/prettier-config",
|
|
55
|
+
"scripts": {
|
|
56
|
+
"b": "yarn run build",
|
|
57
|
+
"w": "yarn run watch",
|
|
58
|
+
"c": "yarn run clean",
|
|
59
|
+
"cb": "yarn run clean && yarn run build",
|
|
60
|
+
"d": "yarn run build:es && DEBUG=1 yarn node",
|
|
61
|
+
"build": "yarn run build:ts & yarn run build:es",
|
|
62
|
+
"build:es": "nano-build --preset=module",
|
|
63
|
+
"build:ts": "tsc --build",
|
|
64
|
+
"watch": "yarn run watch:ts & yarn run watch:es",
|
|
65
|
+
"watch:es": "yarn run build:es --watch",
|
|
66
|
+
"watch:ts": "yarn run build:ts --watch --preserveWatchOutput",
|
|
67
|
+
"clean": "rm -rfv dist *.tsbuildinfo"
|
|
68
|
+
},
|
|
69
|
+
"devDependencies": {
|
|
70
|
+
"@alwatr/nano-build": "^1.3.0",
|
|
71
|
+
"@alwatr/prettier-config": "^1.0.4",
|
|
72
|
+
"@alwatr/tsconfig-base": "^1.1.0",
|
|
73
|
+
"@alwatr/type-helper": "^1.0.3",
|
|
74
|
+
"@types/node": "^20.10.6",
|
|
75
|
+
"typescript": "^5.3.3"
|
|
76
|
+
},
|
|
77
|
+
"gitHead": "fbde73ac9e67b644449f142518a9bdd6303c64b3"
|
|
78
|
+
}
|