@wyw-in-js/shared 1.0.1 → 1.0.3
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/esm/debugger.js +2 -0
- package/esm/debugger.js.map +1 -0
- package/esm/index.js +0 -1
- package/esm/index.js.map +1 -1
- package/esm/logger.js.map +1 -1
- package/lib/debugger.js +2 -0
- package/lib/debugger.js.map +1 -0
- package/lib/index.js +0 -7
- package/lib/index.js.map +1 -1
- package/lib/logger.js.map +1 -1
- package/package.json +2 -2
- package/types/debugger.d.ts +10 -0
- package/types/debugger.js +2 -0
- package/types/index.d.ts +1 -1
- package/types/logger.d.ts +2 -2
package/esm/debugger.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debugger.js","names":[],"sources":["../src/debugger.ts"],"sourcesContent":["export type Debugger = {\n (formatter: unknown, ...args: unknown[]): void;\n color: string;\n destroy: () => boolean;\n diff: number;\n enabled: boolean;\n extend: (namespace: string, delimiter?: string) => Debugger;\n log: (...args: unknown[]) => unknown;\n namespace: string;\n};\n"],"mappings":"","ignoreList":[]}
|
package/esm/index.js
CHANGED
package/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["
|
|
1
|
+
{"version":3,"file":"index.js","names":["asyncResolveFallback","syncResolve","asyncResolverFactory","hasEvalMeta","findPackageJSON","isBoxedPrimitive","enableDebug","logger","isFeatureEnabled","slugify","ValueType"],"sources":["../src/index.ts"],"sourcesContent":["export type { Debugger } from './debugger';\n\nexport { asyncResolveFallback, syncResolve } from './asyncResolveFallback';\nexport { asyncResolverFactory } from './asyncResolverFactory';\nexport { hasEvalMeta } from './hasEvalMeta';\nexport { findPackageJSON } from './findPackageJSON';\nexport { isBoxedPrimitive } from './isBoxedPrimitive';\nexport { enableDebug, logger } from './logger';\nexport { isFeatureEnabled } from './options/isFeatureEnabled';\nexport { slugify } from './slugify';\nexport { ValueType } from './types';\n\nexport type { IVariableContext } from './IVariableContext';\nexport type {\n ClassNameSlugVars,\n ClassNameFn,\n CodeRemoverOptions,\n ImportLoader,\n ImportLoaderContext,\n ImportLoaders,\n ImportOverride,\n ImportOverrides,\n TagResolverMeta,\n StrictOptions,\n EvalRule,\n Evaluator,\n FeatureFlag,\n EvaluatorConfig,\n FeatureFlags,\n VariableNameFn,\n} from './options/types';\nexport type {\n Artifact,\n BuildCodeFrameErrorFn,\n ConstValue,\n ExpressionValue,\n FunctionValue,\n ICSSRule,\n LazyValue,\n Location,\n Replacement,\n Replacements,\n Rules,\n WYWEvalMeta,\n} from './types';\n"],"mappings":"AAEA,SAASA,oBAAoB,EAAEC,WAAW,QAAQ,wBAAwB;AAC1E,SAASC,oBAAoB,QAAQ,wBAAwB;AAC7D,SAASC,WAAW,QAAQ,eAAe;AAC3C,SAASC,eAAe,QAAQ,mBAAmB;AACnD,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,WAAW,EAAEC,MAAM,QAAQ,UAAU;AAC9C,SAASC,gBAAgB,QAAQ,4BAA4B;AAC7D,SAASC,OAAO,QAAQ,WAAW;AACnC,SAASC,SAAS,QAAQ,SAAS","ignoreList":[]}
|
package/esm/logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","names":["genericDebug","BASE_NAMESPACE","logger","loggers","Map","gerOrCreate","namespace","lastIndexOf","has","set","substring","extend","get","formatters","r","ref","text","color","parseInt","colorCode","f","fn","JSON","stringify","enableDebug","enable"],"sources":["../src/logger.ts"],"sourcesContent":["import genericDebug from 'debug';\nimport type { Debugger } from '
|
|
1
|
+
{"version":3,"file":"logger.js","names":["genericDebug","BASE_NAMESPACE","logger","loggers","Map","gerOrCreate","namespace","lastIndexOf","has","set","substring","extend","get","formatters","r","ref","text","color","parseInt","colorCode","f","fn","JSON","stringify","enableDebug","enable"],"sources":["../src/logger.ts"],"sourcesContent":["import genericDebug from 'debug';\n\nimport type { Debugger } from './debugger';\n\nconst BASE_NAMESPACE = 'wyw-in-js';\n\nexport const logger: Debugger = genericDebug(BASE_NAMESPACE);\n\nconst loggers = new Map<string, Debugger>();\n\nfunction gerOrCreate(namespace: string | null | undefined): Debugger {\n if (!namespace) return logger;\n const lastIndexOf = namespace.lastIndexOf(':');\n if (!loggers.has(namespace)) {\n loggers.set(\n namespace,\n gerOrCreate(namespace.substring(0, lastIndexOf)).extend(\n namespace.substring(lastIndexOf + 1)\n )\n );\n }\n\n return loggers.get(namespace)!;\n}\n\ngenericDebug.formatters.r = (\n ref: string | { namespace: string; text?: string }\n) => {\n const namespace = typeof ref === 'string' ? ref : ref.namespace;\n const text = typeof ref === 'string' ? namespace : ref.text ?? namespace;\n const color = parseInt(gerOrCreate(namespace).color, 10);\n const colorCode = `\\u001B[3${color < 8 ? color : `8;5;${color}`}`;\n return `${colorCode};1m${text}\\u001B[0m`;\n};\n\ngenericDebug.formatters.f = function f(fn: () => unknown) {\n return JSON.stringify(fn());\n};\n\nexport function enableDebug(namespace = `${BASE_NAMESPACE}:*`) {\n genericDebug.enable(namespace);\n}\n"],"mappings":"AAAA,OAAOA,YAAY,MAAM,OAAO;AAIhC,MAAMC,cAAc,GAAG,WAAW;AAElC,OAAO,MAAMC,MAAgB,GAAGF,YAAY,CAACC,cAAc,CAAC;AAE5D,MAAME,OAAO,GAAG,IAAIC,GAAG,CAAmB,CAAC;AAE3C,SAASC,WAAWA,CAACC,SAAoC,EAAY;EACnE,IAAI,CAACA,SAAS,EAAE,OAAOJ,MAAM;EAC7B,MAAMK,WAAW,GAAGD,SAAS,CAACC,WAAW,CAAC,GAAG,CAAC;EAC9C,IAAI,CAACJ,OAAO,CAACK,GAAG,CAACF,SAAS,CAAC,EAAE;IAC3BH,OAAO,CAACM,GAAG,CACTH,SAAS,EACTD,WAAW,CAACC,SAAS,CAACI,SAAS,CAAC,CAAC,EAAEH,WAAW,CAAC,CAAC,CAACI,MAAM,CACrDL,SAAS,CAACI,SAAS,CAACH,WAAW,GAAG,CAAC,CACrC,CACF,CAAC;EACH;EAEA,OAAOJ,OAAO,CAACS,GAAG,CAACN,SAAS,CAAC;AAC/B;AAEAN,YAAY,CAACa,UAAU,CAACC,CAAC,GACvBC,GAAkD,IAC/C;EACH,MAAMT,SAAS,GAAG,OAAOS,GAAG,KAAK,QAAQ,GAAGA,GAAG,GAAGA,GAAG,CAACT,SAAS;EAC/D,MAAMU,IAAI,GAAG,OAAOD,GAAG,KAAK,QAAQ,GAAGT,SAAS,GAAGS,GAAG,CAACC,IAAI,IAAIV,SAAS;EACxE,MAAMW,KAAK,GAAGC,QAAQ,CAACb,WAAW,CAACC,SAAS,CAAC,CAACW,KAAK,EAAE,EAAE,CAAC;EACxD,MAAME,SAAS,GAAG,WAAWF,KAAK,GAAG,CAAC,GAAGA,KAAK,GAAG,OAAOA,KAAK,EAAE,EAAE;EACjE,OAAO,GAAGE,SAAS,MAAMH,IAAI,WAAW;AAC1C,CAAC;AAEDhB,YAAY,CAACa,UAAU,CAACO,CAAC,GAAG,SAASA,CAACA,CAACC,EAAiB,EAAE;EACxD,OAAOC,IAAI,CAACC,SAAS,CAACF,EAAE,CAAC,CAAC,CAAC;AAC7B,CAAC;AAED,OAAO,SAASG,WAAWA,CAAClB,SAAS,GAAG,GAAGL,cAAc,IAAI,EAAE;EAC7DD,YAAY,CAACyB,MAAM,CAACnB,SAAS,CAAC;AAChC","ignoreList":[]}
|
package/lib/debugger.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debugger.js","names":[],"sources":["../src/debugger.ts"],"sourcesContent":["export type Debugger = {\n (formatter: unknown, ...args: unknown[]): void;\n color: string;\n destroy: () => boolean;\n diff: number;\n enabled: boolean;\n extend: (namespace: string, delimiter?: string) => Debugger;\n log: (...args: unknown[]) => unknown;\n namespace: string;\n};\n"],"mappings":"","ignoreList":[]}
|
package/lib/index.js
CHANGED
|
@@ -3,12 +3,6 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
Object.defineProperty(exports, "Debugger", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _debug.Debugger;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
6
|
Object.defineProperty(exports, "ValueType", {
|
|
13
7
|
enumerable: true,
|
|
14
8
|
get: function () {
|
|
@@ -75,7 +69,6 @@ Object.defineProperty(exports, "syncResolve", {
|
|
|
75
69
|
return _asyncResolveFallback.syncResolve;
|
|
76
70
|
}
|
|
77
71
|
});
|
|
78
|
-
var _debug = require("debug");
|
|
79
72
|
var _asyncResolveFallback = require("./asyncResolveFallback");
|
|
80
73
|
var _asyncResolverFactory = require("./asyncResolverFactory");
|
|
81
74
|
var _hasEvalMeta = require("./hasEvalMeta");
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["
|
|
1
|
+
{"version":3,"file":"index.js","names":["_asyncResolveFallback","require","_asyncResolverFactory","_hasEvalMeta","_findPackageJSON","_isBoxedPrimitive","_logger","_isFeatureEnabled","_slugify","_types"],"sources":["../src/index.ts"],"sourcesContent":["export type { Debugger } from './debugger';\n\nexport { asyncResolveFallback, syncResolve } from './asyncResolveFallback';\nexport { asyncResolverFactory } from './asyncResolverFactory';\nexport { hasEvalMeta } from './hasEvalMeta';\nexport { findPackageJSON } from './findPackageJSON';\nexport { isBoxedPrimitive } from './isBoxedPrimitive';\nexport { enableDebug, logger } from './logger';\nexport { isFeatureEnabled } from './options/isFeatureEnabled';\nexport { slugify } from './slugify';\nexport { ValueType } from './types';\n\nexport type { IVariableContext } from './IVariableContext';\nexport type {\n ClassNameSlugVars,\n ClassNameFn,\n CodeRemoverOptions,\n ImportLoader,\n ImportLoaderContext,\n ImportLoaders,\n ImportOverride,\n ImportOverrides,\n TagResolverMeta,\n StrictOptions,\n EvalRule,\n Evaluator,\n FeatureFlag,\n EvaluatorConfig,\n FeatureFlags,\n VariableNameFn,\n} from './options/types';\nexport type {\n Artifact,\n BuildCodeFrameErrorFn,\n ConstValue,\n ExpressionValue,\n FunctionValue,\n ICSSRule,\n LazyValue,\n Location,\n Replacement,\n Replacements,\n Rules,\n WYWEvalMeta,\n} from './types';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAAA,qBAAA,GAAAC,OAAA;AACA,IAAAC,qBAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAH,OAAA;AACA,IAAAI,iBAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,iBAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA","ignoreList":[]}
|
package/lib/logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","names":["_debug","_interopRequireDefault","require","e","__esModule","default","BASE_NAMESPACE","logger","exports","genericDebug","loggers","Map","gerOrCreate","namespace","lastIndexOf","has","set","substring","extend","get","formatters","r","ref","_ref$text","text","color","parseInt","colorCode","f","fn","JSON","stringify","enableDebug","enable"],"sources":["../src/logger.ts"],"sourcesContent":["import genericDebug from 'debug';\nimport type { Debugger } from '
|
|
1
|
+
{"version":3,"file":"logger.js","names":["_debug","_interopRequireDefault","require","e","__esModule","default","BASE_NAMESPACE","logger","exports","genericDebug","loggers","Map","gerOrCreate","namespace","lastIndexOf","has","set","substring","extend","get","formatters","r","ref","_ref$text","text","color","parseInt","colorCode","f","fn","JSON","stringify","enableDebug","enable"],"sources":["../src/logger.ts"],"sourcesContent":["import genericDebug from 'debug';\n\nimport type { Debugger } from './debugger';\n\nconst BASE_NAMESPACE = 'wyw-in-js';\n\nexport const logger: Debugger = genericDebug(BASE_NAMESPACE);\n\nconst loggers = new Map<string, Debugger>();\n\nfunction gerOrCreate(namespace: string | null | undefined): Debugger {\n if (!namespace) return logger;\n const lastIndexOf = namespace.lastIndexOf(':');\n if (!loggers.has(namespace)) {\n loggers.set(\n namespace,\n gerOrCreate(namespace.substring(0, lastIndexOf)).extend(\n namespace.substring(lastIndexOf + 1)\n )\n );\n }\n\n return loggers.get(namespace)!;\n}\n\ngenericDebug.formatters.r = (\n ref: string | { namespace: string; text?: string }\n) => {\n const namespace = typeof ref === 'string' ? ref : ref.namespace;\n const text = typeof ref === 'string' ? namespace : ref.text ?? namespace;\n const color = parseInt(gerOrCreate(namespace).color, 10);\n const colorCode = `\\u001B[3${color < 8 ? color : `8;5;${color}`}`;\n return `${colorCode};1m${text}\\u001B[0m`;\n};\n\ngenericDebug.formatters.f = function f(fn: () => unknown) {\n return JSON.stringify(fn());\n};\n\nexport function enableDebug(namespace = `${BASE_NAMESPACE}:*`) {\n genericDebug.enable(namespace);\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAiC,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAIjC,MAAMG,cAAc,GAAG,WAAW;AAE3B,MAAMC,MAAgB,GAAAC,OAAA,CAAAD,MAAA,GAAG,IAAAE,cAAY,EAACH,cAAc,CAAC;AAE5D,MAAMI,OAAO,GAAG,IAAIC,GAAG,CAAmB,CAAC;AAE3C,SAASC,WAAWA,CAACC,SAAoC,EAAY;EACnE,IAAI,CAACA,SAAS,EAAE,OAAON,MAAM;EAC7B,MAAMO,WAAW,GAAGD,SAAS,CAACC,WAAW,CAAC,GAAG,CAAC;EAC9C,IAAI,CAACJ,OAAO,CAACK,GAAG,CAACF,SAAS,CAAC,EAAE;IAC3BH,OAAO,CAACM,GAAG,CACTH,SAAS,EACTD,WAAW,CAACC,SAAS,CAACI,SAAS,CAAC,CAAC,EAAEH,WAAW,CAAC,CAAC,CAACI,MAAM,CACrDL,SAAS,CAACI,SAAS,CAACH,WAAW,GAAG,CAAC,CACrC,CACF,CAAC;EACH;EAEA,OAAOJ,OAAO,CAACS,GAAG,CAACN,SAAS,CAAC;AAC/B;AAEAJ,cAAY,CAACW,UAAU,CAACC,CAAC,GACvBC,GAAkD,IAC/C;EAAA,IAAAC,SAAA;EACH,MAAMV,SAAS,GAAG,OAAOS,GAAG,KAAK,QAAQ,GAAGA,GAAG,GAAGA,GAAG,CAACT,SAAS;EAC/D,MAAMW,IAAI,GAAG,OAAOF,GAAG,KAAK,QAAQ,GAAGT,SAAS,IAAAU,SAAA,GAAGD,GAAG,CAACE,IAAI,cAAAD,SAAA,cAAAA,SAAA,GAAIV,SAAS;EACxE,MAAMY,KAAK,GAAGC,QAAQ,CAACd,WAAW,CAACC,SAAS,CAAC,CAACY,KAAK,EAAE,EAAE,CAAC;EACxD,MAAME,SAAS,GAAG,WAAWF,KAAK,GAAG,CAAC,GAAGA,KAAK,GAAG,OAAOA,KAAK,EAAE,EAAE;EACjE,OAAO,GAAGE,SAAS,MAAMH,IAAI,WAAW;AAC1C,CAAC;AAEDf,cAAY,CAACW,UAAU,CAACQ,CAAC,GAAG,SAASA,CAACA,CAACC,EAAiB,EAAE;EACxD,OAAOC,IAAI,CAACC,SAAS,CAACF,EAAE,CAAC,CAAC,CAAC;AAC7B,CAAC;AAEM,SAASG,WAAWA,CAACnB,SAAS,GAAG,GAAGP,cAAc,IAAI,EAAE;EAC7DG,cAAY,CAACwB,MAAM,CAACpB,SAAS,CAAC;AAChC","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wyw-in-js/shared",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"@types/debug": "^4.1.9",
|
|
6
5
|
"debug": "^4.3.4",
|
|
7
6
|
"find-up": "^5.0.0",
|
|
8
7
|
"minimatch": "^9.0.3"
|
|
@@ -10,6 +9,7 @@
|
|
|
10
9
|
"devDependencies": {
|
|
11
10
|
"@babel/types": "^7.23.5",
|
|
12
11
|
"@types/babel__core": "^7.20.5",
|
|
12
|
+
"@types/debug": "^4.1.9",
|
|
13
13
|
"@types/node": "^16.18.55",
|
|
14
14
|
"@wyw-in-js/babel-config": "workspace:*",
|
|
15
15
|
"@wyw-in-js/eslint-config": "workspace:*",
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type Debugger = {
|
|
2
|
+
(formatter: unknown, ...args: unknown[]): void;
|
|
3
|
+
color: string;
|
|
4
|
+
destroy: () => boolean;
|
|
5
|
+
diff: number;
|
|
6
|
+
enabled: boolean;
|
|
7
|
+
extend: (namespace: string, delimiter?: string) => Debugger;
|
|
8
|
+
log: (...args: unknown[]) => unknown;
|
|
9
|
+
namespace: string;
|
|
10
|
+
};
|
package/types/index.d.ts
CHANGED
package/types/logger.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
export declare const logger:
|
|
1
|
+
import type { Debugger } from './debugger';
|
|
2
|
+
export declare const logger: Debugger;
|
|
3
3
|
export declare function enableDebug(namespace?: string): void;
|