@wyw-in-js/shared 0.5.4 → 0.6.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/esm/index.js +0 -1
- package/esm/index.js.map +1 -1
- package/esm/options/types.js.map +1 -1
- package/lib/index.js +0 -7
- package/lib/index.js.map +1 -1
- package/lib/options/types.js.map +1 -1
- package/package.json +5 -5
- package/types/index.d.ts +2 -2
- package/types/options/types.d.ts +5 -0
package/esm/index.js
CHANGED
|
@@ -3,7 +3,6 @@ export { asyncResolveFallback, syncResolve } from './asyncResolveFallback';
|
|
|
3
3
|
export { hasEvalMeta } from './hasEvalMeta';
|
|
4
4
|
export { findPackageJSON } from './findPackageJSON';
|
|
5
5
|
export { isBoxedPrimitive } from './isBoxedPrimitive';
|
|
6
|
-
export { IVariableContext } from './IVariableContext';
|
|
7
6
|
export { enableDebug, logger } from './logger';
|
|
8
7
|
export { isFeatureEnabled } from './options/isFeatureEnabled';
|
|
9
8
|
export { slugify } from './slugify';
|
package/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["Debugger","asyncResolveFallback","syncResolve","hasEvalMeta","findPackageJSON","isBoxedPrimitive","
|
|
1
|
+
{"version":3,"file":"index.js","names":["Debugger","asyncResolveFallback","syncResolve","hasEvalMeta","findPackageJSON","isBoxedPrimitive","enableDebug","logger","isFeatureEnabled","slugify","ValueType"],"sources":["../src/index.ts"],"sourcesContent":["export { Debugger } from 'debug';\n\nexport { asyncResolveFallback, syncResolve } from './asyncResolveFallback';\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 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":"AAAA,SAASA,QAAQ,QAAQ,OAAO;AAEhC,SAASC,oBAAoB,EAAEC,WAAW,QAAQ,wBAAwB;AAC1E,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"}
|
package/esm/options/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../src/options/types.ts"],"sourcesContent":["import type { TransformOptions } from '@babel/core';\nimport type { File } from '@babel/types';\n\nimport type { IVariableContext } from '../IVariableContext';\nimport type { Core } from '../babel';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype VmContext = Record<string, any>; // It's Context from `vm`\n\nexport type ClassNameSlugVars = {\n dir: string;\n ext: string;\n file: string;\n hash: string;\n index: number;\n name: string;\n title: string;\n};\n\nexport type ClassNameFn = (\n hash: string,\n title: string,\n args: ClassNameSlugVars\n) => string;\n\nexport type VariableNameFn = (context: IVariableContext) => string;\n\nexport type EvaluatorConfig = {\n features: StrictOptions['features'];\n highPriorityPlugins: string[];\n onlyExports: string[];\n};\n\nexport type Evaluator = (\n evalConfig: TransformOptions,\n ast: File,\n code: string,\n config: EvaluatorConfig,\n babel: Core\n) => [\n ast: File,\n code: string,\n imports: Map<string, string[]> | null,\n exports?: string[] | null,\n];\n\nexport type EvalRule = {\n action: Evaluator | 'ignore' | string;\n babelOptions?: TransformOptions;\n test?: RegExp | ((path: string, code: string) => boolean);\n};\n\nexport type FeatureFlag = boolean | string | string[];\n\ntype AllFeatureFlags = {\n dangerousCodeRemover: FeatureFlag;\n globalCache: FeatureFlag;\n happyDOM: FeatureFlag;\n softErrors: FeatureFlag;\n useBabelConfigs: FeatureFlag;\n useWeakRefInEval: FeatureFlag;\n};\n\nexport type FeatureFlags<\n TOnly extends keyof AllFeatureFlags = keyof AllFeatureFlags,\n> = Pick<AllFeatureFlags, TOnly>;\n\nexport type StrictOptions = {\n babelOptions: TransformOptions;\n classNameSlug?: string | ClassNameFn;\n displayName: boolean;\n evaluate: boolean;\n extensions: string[];\n features: FeatureFlags;\n highPriorityPlugins: string[];\n ignore?: RegExp;\n overrideContext?: (\n context: Partial<VmContext>,\n filename: string\n ) => Partial<VmContext>;\n rules: EvalRule[];\n tagResolver?: (source: string, tag: string) => string | null;\n variableNameConfig?: 'var' | 'dashes' | 'raw';\n variableNameSlug?: string | VariableNameFn;\n};\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../src/options/types.ts"],"sourcesContent":["import type { TransformOptions } from '@babel/core';\nimport type { File } from '@babel/types';\n\nimport type { IVariableContext } from '../IVariableContext';\nimport type { Core } from '../babel';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype VmContext = Record<string, any>; // It's Context from `vm`\n\nexport type ClassNameSlugVars = {\n dir: string;\n ext: string;\n file: string;\n hash: string;\n index: number;\n name: string;\n title: string;\n};\n\nexport type ClassNameFn = (\n hash: string,\n title: string,\n args: ClassNameSlugVars\n) => string;\n\nexport type VariableNameFn = (context: IVariableContext) => string;\n\nexport type EvaluatorConfig = {\n features: StrictOptions['features'];\n highPriorityPlugins: string[];\n onlyExports: string[];\n};\n\nexport type Evaluator = (\n evalConfig: TransformOptions,\n ast: File,\n code: string,\n config: EvaluatorConfig,\n babel: Core\n) => [\n ast: File,\n code: string,\n imports: Map<string, string[]> | null,\n exports?: string[] | null,\n];\n\nexport type EvalRule = {\n action: Evaluator | 'ignore' | string;\n babelOptions?: TransformOptions;\n test?: RegExp | ((path: string, code: string) => boolean);\n};\n\nexport type FeatureFlag = boolean | string | string[];\n\ntype AllFeatureFlags = {\n dangerousCodeRemover: FeatureFlag;\n globalCache: FeatureFlag;\n happyDOM: FeatureFlag;\n softErrors: FeatureFlag;\n useBabelConfigs: FeatureFlag;\n useWeakRefInEval: FeatureFlag;\n};\n\nexport type FeatureFlags<\n TOnly extends keyof AllFeatureFlags = keyof AllFeatureFlags,\n> = Pick<AllFeatureFlags, TOnly>;\n\nexport type CodeRemoverOptions = {\n componentTypes?: Record<string, string[]>;\n hocs?: Record<string, string[]>;\n};\n\nexport type StrictOptions = {\n babelOptions: TransformOptions;\n classNameSlug?: string | ClassNameFn;\n codeRemover?: CodeRemoverOptions;\n displayName: boolean;\n evaluate: boolean;\n extensions: string[];\n features: FeatureFlags;\n highPriorityPlugins: string[];\n ignore?: RegExp;\n overrideContext?: (\n context: Partial<VmContext>,\n filename: string\n ) => Partial<VmContext>;\n rules: EvalRule[];\n tagResolver?: (source: string, tag: string) => string | null;\n variableNameConfig?: 'var' | 'dashes' | 'raw';\n variableNameSlug?: string | VariableNameFn;\n};\n"],"mappings":""}
|
package/lib/index.js
CHANGED
|
@@ -9,12 +9,6 @@ Object.defineProperty(exports, "Debugger", {
|
|
|
9
9
|
return _debug.Debugger;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
Object.defineProperty(exports, "IVariableContext", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _IVariableContext.IVariableContext;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
12
|
Object.defineProperty(exports, "ValueType", {
|
|
19
13
|
enumerable: true,
|
|
20
14
|
get: function () {
|
|
@@ -80,7 +74,6 @@ var _asyncResolveFallback = require("./asyncResolveFallback");
|
|
|
80
74
|
var _hasEvalMeta = require("./hasEvalMeta");
|
|
81
75
|
var _findPackageJSON = require("./findPackageJSON");
|
|
82
76
|
var _isBoxedPrimitive = require("./isBoxedPrimitive");
|
|
83
|
-
var _IVariableContext = require("./IVariableContext");
|
|
84
77
|
var _logger = require("./logger");
|
|
85
78
|
var _isFeatureEnabled = require("./options/isFeatureEnabled");
|
|
86
79
|
var _slugify = require("./slugify");
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_debug","require","_asyncResolveFallback","_hasEvalMeta","_findPackageJSON","_isBoxedPrimitive","
|
|
1
|
+
{"version":3,"file":"index.js","names":["_debug","require","_asyncResolveFallback","_hasEvalMeta","_findPackageJSON","_isBoxedPrimitive","_logger","_isFeatureEnabled","_slugify","_types"],"sources":["../src/index.ts"],"sourcesContent":["export { Debugger } from 'debug';\n\nexport { asyncResolveFallback, syncResolve } from './asyncResolveFallback';\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 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,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"}
|
package/lib/options/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../src/options/types.ts"],"sourcesContent":["import type { TransformOptions } from '@babel/core';\nimport type { File } from '@babel/types';\n\nimport type { IVariableContext } from '../IVariableContext';\nimport type { Core } from '../babel';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype VmContext = Record<string, any>; // It's Context from `vm`\n\nexport type ClassNameSlugVars = {\n dir: string;\n ext: string;\n file: string;\n hash: string;\n index: number;\n name: string;\n title: string;\n};\n\nexport type ClassNameFn = (\n hash: string,\n title: string,\n args: ClassNameSlugVars\n) => string;\n\nexport type VariableNameFn = (context: IVariableContext) => string;\n\nexport type EvaluatorConfig = {\n features: StrictOptions['features'];\n highPriorityPlugins: string[];\n onlyExports: string[];\n};\n\nexport type Evaluator = (\n evalConfig: TransformOptions,\n ast: File,\n code: string,\n config: EvaluatorConfig,\n babel: Core\n) => [\n ast: File,\n code: string,\n imports: Map<string, string[]> | null,\n exports?: string[] | null,\n];\n\nexport type EvalRule = {\n action: Evaluator | 'ignore' | string;\n babelOptions?: TransformOptions;\n test?: RegExp | ((path: string, code: string) => boolean);\n};\n\nexport type FeatureFlag = boolean | string | string[];\n\ntype AllFeatureFlags = {\n dangerousCodeRemover: FeatureFlag;\n globalCache: FeatureFlag;\n happyDOM: FeatureFlag;\n softErrors: FeatureFlag;\n useBabelConfigs: FeatureFlag;\n useWeakRefInEval: FeatureFlag;\n};\n\nexport type FeatureFlags<\n TOnly extends keyof AllFeatureFlags = keyof AllFeatureFlags,\n> = Pick<AllFeatureFlags, TOnly>;\n\nexport type StrictOptions = {\n babelOptions: TransformOptions;\n classNameSlug?: string | ClassNameFn;\n displayName: boolean;\n evaluate: boolean;\n extensions: string[];\n features: FeatureFlags;\n highPriorityPlugins: string[];\n ignore?: RegExp;\n overrideContext?: (\n context: Partial<VmContext>,\n filename: string\n ) => Partial<VmContext>;\n rules: EvalRule[];\n tagResolver?: (source: string, tag: string) => string | null;\n variableNameConfig?: 'var' | 'dashes' | 'raw';\n variableNameSlug?: string | VariableNameFn;\n};\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../src/options/types.ts"],"sourcesContent":["import type { TransformOptions } from '@babel/core';\nimport type { File } from '@babel/types';\n\nimport type { IVariableContext } from '../IVariableContext';\nimport type { Core } from '../babel';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype VmContext = Record<string, any>; // It's Context from `vm`\n\nexport type ClassNameSlugVars = {\n dir: string;\n ext: string;\n file: string;\n hash: string;\n index: number;\n name: string;\n title: string;\n};\n\nexport type ClassNameFn = (\n hash: string,\n title: string,\n args: ClassNameSlugVars\n) => string;\n\nexport type VariableNameFn = (context: IVariableContext) => string;\n\nexport type EvaluatorConfig = {\n features: StrictOptions['features'];\n highPriorityPlugins: string[];\n onlyExports: string[];\n};\n\nexport type Evaluator = (\n evalConfig: TransformOptions,\n ast: File,\n code: string,\n config: EvaluatorConfig,\n babel: Core\n) => [\n ast: File,\n code: string,\n imports: Map<string, string[]> | null,\n exports?: string[] | null,\n];\n\nexport type EvalRule = {\n action: Evaluator | 'ignore' | string;\n babelOptions?: TransformOptions;\n test?: RegExp | ((path: string, code: string) => boolean);\n};\n\nexport type FeatureFlag = boolean | string | string[];\n\ntype AllFeatureFlags = {\n dangerousCodeRemover: FeatureFlag;\n globalCache: FeatureFlag;\n happyDOM: FeatureFlag;\n softErrors: FeatureFlag;\n useBabelConfigs: FeatureFlag;\n useWeakRefInEval: FeatureFlag;\n};\n\nexport type FeatureFlags<\n TOnly extends keyof AllFeatureFlags = keyof AllFeatureFlags,\n> = Pick<AllFeatureFlags, TOnly>;\n\nexport type CodeRemoverOptions = {\n componentTypes?: Record<string, string[]>;\n hocs?: Record<string, string[]>;\n};\n\nexport type StrictOptions = {\n babelOptions: TransformOptions;\n classNameSlug?: string | ClassNameFn;\n codeRemover?: CodeRemoverOptions;\n displayName: boolean;\n evaluate: boolean;\n extensions: string[];\n features: FeatureFlags;\n highPriorityPlugins: string[];\n ignore?: RegExp;\n overrideContext?: (\n context: Partial<VmContext>,\n filename: string\n ) => Partial<VmContext>;\n rules: EvalRule[];\n tagResolver?: (source: string, tag: string) => string | null;\n variableNameConfig?: 'var' | 'dashes' | 'raw';\n variableNameSlug?: string | VariableNameFn;\n};\n"],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wyw-in-js/shared",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"debug": "^4.3.4",
|
|
6
6
|
"find-up": "^5.0.0",
|
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
"@types/debug": "^4.1.9",
|
|
13
13
|
"@types/node": "^16.18.55",
|
|
14
14
|
"typescript": "^5.2.2",
|
|
15
|
-
"@wyw-in-js/babel-config": "0.
|
|
16
|
-
"@wyw-in-js/eslint-config": "0.
|
|
17
|
-
"@wyw-in-js/jest-preset": "0.
|
|
18
|
-
"@wyw-in-js/ts-config": "0.
|
|
15
|
+
"@wyw-in-js/babel-config": "0.6.0",
|
|
16
|
+
"@wyw-in-js/eslint-config": "0.6.0",
|
|
17
|
+
"@wyw-in-js/jest-preset": "0.6.0",
|
|
18
|
+
"@wyw-in-js/ts-config": "0.6.0"
|
|
19
19
|
},
|
|
20
20
|
"engines": {
|
|
21
21
|
"node": ">=16.0.0"
|
package/types/index.d.ts
CHANGED
|
@@ -3,10 +3,10 @@ export { asyncResolveFallback, syncResolve } from './asyncResolveFallback';
|
|
|
3
3
|
export { hasEvalMeta } from './hasEvalMeta';
|
|
4
4
|
export { findPackageJSON } from './findPackageJSON';
|
|
5
5
|
export { isBoxedPrimitive } from './isBoxedPrimitive';
|
|
6
|
-
export { IVariableContext } from './IVariableContext';
|
|
7
6
|
export { enableDebug, logger } from './logger';
|
|
8
7
|
export { isFeatureEnabled } from './options/isFeatureEnabled';
|
|
9
8
|
export { slugify } from './slugify';
|
|
10
9
|
export { ValueType } from './types';
|
|
11
|
-
export type {
|
|
10
|
+
export type { IVariableContext } from './IVariableContext';
|
|
11
|
+
export type { ClassNameSlugVars, ClassNameFn, CodeRemoverOptions, StrictOptions, EvalRule, Evaluator, FeatureFlag, EvaluatorConfig, FeatureFlags, VariableNameFn, } from './options/types';
|
|
12
12
|
export type { Artifact, BuildCodeFrameErrorFn, ConstValue, ExpressionValue, FunctionValue, ICSSRule, LazyValue, Location, Replacement, Replacements, Rules, WYWEvalMeta, } from './types';
|
package/types/options/types.d.ts
CHANGED
|
@@ -40,9 +40,14 @@ type AllFeatureFlags = {
|
|
|
40
40
|
useWeakRefInEval: FeatureFlag;
|
|
41
41
|
};
|
|
42
42
|
export type FeatureFlags<TOnly extends keyof AllFeatureFlags = keyof AllFeatureFlags> = Pick<AllFeatureFlags, TOnly>;
|
|
43
|
+
export type CodeRemoverOptions = {
|
|
44
|
+
componentTypes?: Record<string, string[]>;
|
|
45
|
+
hocs?: Record<string, string[]>;
|
|
46
|
+
};
|
|
43
47
|
export type StrictOptions = {
|
|
44
48
|
babelOptions: TransformOptions;
|
|
45
49
|
classNameSlug?: string | ClassNameFn;
|
|
50
|
+
codeRemover?: CodeRemoverOptions;
|
|
46
51
|
displayName: boolean;
|
|
47
52
|
evaluate: boolean;
|
|
48
53
|
extensions: string[];
|