@suseejs/types 0.1.2 → 0.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.
@@ -0,0 +1,230 @@
1
+ import type ts from "typescript";
2
+ export declare const pkgName = "SU-SEE";
3
+ export type Target = "commonjs" | "esm" | "both";
4
+ export interface DepsFile {
5
+ file: string;
6
+ content: string;
7
+ }
8
+ export interface NamesSet {
9
+ base: string;
10
+ file: string;
11
+ newName: string;
12
+ isEd?: boolean;
13
+ }
14
+ export type NamesSets = NamesSet[];
15
+ export type DuplicatesNameMap = Map<string, Set<{
16
+ file: string;
17
+ }>>;
18
+ export type BundleHandler = ({ file, content }: DepsFile) => DepsFile;
19
+ export type NodeVisit = (node: ts.Node) => ts.Node;
20
+ export type BundleVisitorFunc = (context: ts.TransformationContext, { file, content }: DepsFile, sourceFile: ts.SourceFile, ...args: any[]) => NodeVisit;
21
+ export interface NamesMap {
22
+ base: string;
23
+ file: string;
24
+ short: string;
25
+ oldName: string;
26
+ }
27
+ export type OutFiles = {
28
+ commonjs: string | undefined;
29
+ commonjsTypes: string | undefined;
30
+ esm: string | undefined;
31
+ esmTypes: string | undefined;
32
+ main: string | undefined;
33
+ module: string | undefined;
34
+ types: string | undefined;
35
+ };
36
+ export type Exports = Record<string, {
37
+ import?: {
38
+ default: string;
39
+ types: string;
40
+ };
41
+ require?: {
42
+ default: string;
43
+ types: string;
44
+ };
45
+ }>;
46
+ export type LocalHookReturn = string | ts.Node | BundleHandler;
47
+ export type LocalHookReturnFun<P extends any[] = any[], M = LocalHookReturn> = (...args: P) => M;
48
+ export type LocalHookKey = "commonJsHook" | "removeCommonJsExports" | "removeEsmExports";
49
+ export type LocalHook<P extends any[] = any[], M = LocalHookReturn> = {
50
+ name: LocalHookKey;
51
+ fun: LocalHookReturnFun<P, M>;
52
+ };
53
+ export interface DepsObj {
54
+ depFiles: DepsFile[];
55
+ modOpts: {
56
+ commonjs: () => {
57
+ isMain: boolean;
58
+ compilerOptions: ts.CompilerOptions;
59
+ out_dir: string;
60
+ };
61
+ esm: () => {
62
+ isMain: boolean;
63
+ compilerOptions: ts.CompilerOptions;
64
+ out_dir: string;
65
+ };
66
+ };
67
+ generalOptions: ts.CompilerOptions;
68
+ }
69
+ export type RequireImportObject = {
70
+ isNamespace: boolean;
71
+ isTypeOnly: boolean;
72
+ isTypeNamespace: boolean;
73
+ source: string;
74
+ importedString: string | undefined;
75
+ importedObject: string[] | undefined;
76
+ };
77
+ export type TypeObj = Record<string, string[]>;
78
+ export type PrePostPluginAsyncCallback = (code: string, file?: string) => Promise<string>;
79
+ export type PrePostPluginCallback = (code: string, file?: string) => string;
80
+ export type ASTPluginCallback = (node: ts.Node, factory: ts.NodeFactory, file: string) => ts.Node;
81
+ export type ASTPluginAsyncCallback = (node: ts.Node, factory: ts.NodeFactory, file: string) => Promise<ts.Node>;
82
+ export type DependencyPluginAsyncCallback = (files: DepsFile[]) => Promise<DepsFile[]>;
83
+ export type DependencyPluginCallback = (files: DepsFile[]) => DepsFile[];
84
+ export type PostProcessPlugin = {
85
+ type: "post-process";
86
+ async: true;
87
+ func: PrePostPluginAsyncCallback;
88
+ } | {
89
+ type: "post-process";
90
+ async: false;
91
+ func: PrePostPluginCallback;
92
+ };
93
+ export type PreProcessPlugin = {
94
+ type: "pre-process";
95
+ async: true;
96
+ func: PrePostPluginAsyncCallback;
97
+ } | {
98
+ type: "pre-process";
99
+ async: false;
100
+ func: PrePostPluginCallback;
101
+ };
102
+ export type DependencyPlugin = {
103
+ type: "dependency";
104
+ async: true;
105
+ func: (files: DepsFile[]) => Promise<DepsFile[]>;
106
+ } | {
107
+ type: "dependency";
108
+ async: false;
109
+ func: (files: DepsFile[]) => DepsFile[];
110
+ };
111
+ export type ASTPlugin = {
112
+ type: "ast";
113
+ func: ASTPluginCallback;
114
+ };
115
+ export type ASTPluginParserReturnFn = (fileName: string, sourceCode: string, compilerOptions: ts.CompilerOptions) => string;
116
+ export type PrePostProcessPluginParserReturnFn = (code: string, file?: string) => string;
117
+ export type DependencyPluginParserReturnFn = (files: DepsFile[]) => DepsFile[];
118
+ export type PluginParserReturnFn = ASTPluginParserReturnFn | PrePostProcessPluginParserReturnFn | DependencyPluginParserReturnFn;
119
+ export type SuseePluginFunc = (...args: any[]) => ASTPlugin | DependencyPlugin | PostProcessPlugin | PreProcessPlugin;
120
+ export type SuseePlugin = ASTPlugin | DependencyPlugin | PostProcessPlugin | PreProcessPlugin | SuseePluginFunc;
121
+ export type SuseePlugins = SuseePlugin[];
122
+ type NodeJsOutput = {
123
+ target: "nodejs";
124
+ /**
125
+ * path for package
126
+ *
127
+ * required
128
+ */
129
+ exportPath: "." | `./${string}`;
130
+ /**
131
+ * Output module type of package , commonjs,esm or both esm and commonjs
132
+ *
133
+ * default - esm
134
+ */
135
+ format?: "commonjs" | "esm" | "both";
136
+ /**
137
+ * Allow bundler to update your package.json.
138
+ *
139
+ * default - true
140
+ */
141
+ allowUpdatePackageJson?: boolean;
142
+ };
143
+ type WebOutput = {
144
+ target: "web";
145
+ outFile: string;
146
+ htmlTemplate: string;
147
+ };
148
+ /**
149
+ * Entry point for SuSee configuration
150
+ */
151
+ export interface EntryPoint {
152
+ /**
153
+ * Entry of file path of package
154
+ *
155
+ * required
156
+ */
157
+ entry: string;
158
+ /**
159
+ * Info for output
160
+ *
161
+ * required
162
+ */
163
+ output: NodeJsOutput | WebOutput;
164
+ /**
165
+ * Custom tsconfig.json path for package typescript compiler options
166
+ *
167
+ * Priority -
168
+ * 1. this custom tsconfig.json
169
+ * 2. tsconfig.json at root directory
170
+ * 3. default compiler options of susee
171
+ *
172
+ * default - undefined
173
+ */
174
+ tsconfigFilePath?: string | undefined;
175
+ /**
176
+ * When bundling , if there are duplicate declared names , susee will auto rename , if renameDuplicates = false exist with code 1.
177
+ *
178
+ * default - true
179
+ */
180
+ renameDuplicates?: boolean;
181
+ }
182
+ /**
183
+ * Configuration for Susee Bundler
184
+ */
185
+ export interface SuSeeConfig {
186
+ /**
187
+ * Array of entry points object
188
+ *
189
+ * required
190
+ */
191
+ entryPoints: EntryPoint[];
192
+ /**
193
+ * Array of susee extension
194
+ *
195
+ * default - []
196
+ */
197
+ plugins?: SuseePlugins;
198
+ }
199
+ export type TsCompilerOptionsReturn = {
200
+ defaultCompilerOptions: ts.CompilerOptions;
201
+ commonJsCompilerOptions: () => ts.CompilerOptions;
202
+ esmCompilerOptions: () => ts.CompilerOptions;
203
+ webCompilerOptions: () => ts.CompilerOptions;
204
+ };
205
+ export interface InitCollationsResult {
206
+ dependencyFilesObject: DepsFile[];
207
+ tsOptions: TsCompilerOptionsReturn;
208
+ plugins: SuseePlugin[];
209
+ includeNodeModules: boolean;
210
+ allowRenameDuplicates: boolean;
211
+ allowUpdatePackageJson: boolean;
212
+ outputTarget: "nodejs" | "web";
213
+ entryFileName: string;
214
+ outputFormat: "commonjs" | "esm" | "both" | undefined;
215
+ exportPath: "." | `./${string}` | undefined;
216
+ }
217
+ export interface BundleResult {
218
+ tsOptions: TsCompilerOptionsReturn;
219
+ plugins: SuseePlugin[];
220
+ includeNodeModules: boolean;
221
+ allowRenameDuplicates: boolean;
222
+ allowUpdatePackageJson: boolean;
223
+ outputTarget: "nodejs" | "web";
224
+ entryFileName: string;
225
+ outputFormat: "commonjs" | "esm" | "both" | undefined;
226
+ exportPath: "." | `./${string}` | undefined;
227
+ bundleContent: string;
228
+ }
229
+ export {};
230
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC,eAAO,MAAM,OAAO,WAAW,CAAC;AAEhC,MAAM,MAAM,MAAM,GAAG,UAAU,GAAG,KAAK,GAAG,MAAM,CAAC;AACjD,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AACD,MAAM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AAoB;IACnC,qBAAqB,EAAE,QAAQ,EAAE,CAAC;IAClC,SAAS,EAAE,uBAAuB,CAAC;IACnC,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,qBAAqB,EAAE,OAAO,CAAC;IAC/B,sBAAsB,EAAE,OAAO,CAAC;IAChC,YAAY,EAAE,QAAQ,GAAG,KAAK,CAAC;IAC/B,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,UAAU,GAAG,KAAK,GAAG,MAAM,GAAG,SAAS,CAAC;IACtD,UAAU,EAAE,GAAG,GAAG,KAAK,MAAM,EAAE,GAAG,SAAS,CAAC;CAC7C;AAED,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,uBAAuB,CAAC;IACnC,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,qBAAqB,EAAE,OAAO,CAAC;IAC/B,sBAAsB,EAAE,OAAO,CAAC;IAChC,YAAY,EAAE,QAAQ,GAAG,KAAK,CAAC;IAC/B,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,UAAU,GAAG,KAAK,GAAG,MAAM,GAAG,SAAS,CAAC;IACtD,UAAU,EAAE,GAAG,GAAG,KAAK,MAAM,EAAE,GAAG,SAAS,CAAC;IAC5C,aAAa,EAAE,MAAM,CAAC;CACvB"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.pkgName = void 0;
4
+ exports.pkgName = "SU-SEE";
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAEa,QAAA,OAAO,GAAG,QAAQ,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,44 +1,105 @@
1
- import ts from "typescript";
2
- interface DepsFile {
1
+ import type ts from "typescript";
2
+ export declare const pkgName = "SU-SEE";
3
+ export type Target = "commonjs" | "esm" | "both";
4
+ export interface DepsFile {
3
5
  file: string;
4
6
  content: string;
5
7
  }
6
- interface NamesSet {
8
+ export interface NamesSet {
7
9
  base: string;
8
10
  file: string;
9
11
  newName: string;
10
12
  isEd?: boolean;
11
13
  }
12
- type NamesSets = NamesSet[];
13
- type DuplicatesNameMap = Map<string, Set<{
14
+ export type NamesSets = NamesSet[];
15
+ export type DuplicatesNameMap = Map<string, Set<{
14
16
  file: string;
15
17
  }>>;
16
- type BundleHandler = ({ file, content }: DepsFile) => DepsFile;
17
- interface NamesMap {
18
+ export type BundleHandler = ({ file, content }: DepsFile) => DepsFile;
19
+ export type NodeVisit = (node: ts.Node) => ts.Node;
20
+ export type BundleVisitorFunc = (context: ts.TransformationContext, { file, content }: DepsFile, sourceFile: ts.SourceFile, ...args: any[]) => NodeVisit;
21
+ export interface NamesMap {
18
22
  base: string;
19
23
  file: string;
20
24
  short: string;
21
25
  oldName: string;
22
26
  }
23
- type PostProcessExtension = {
27
+ export type OutFiles = {
28
+ commonjs: string | undefined;
29
+ commonjsTypes: string | undefined;
30
+ esm: string | undefined;
31
+ esmTypes: string | undefined;
32
+ main: string | undefined;
33
+ module: string | undefined;
34
+ types: string | undefined;
35
+ };
36
+ export type Exports = Record<string, {
37
+ import?: {
38
+ default: string;
39
+ types: string;
40
+ };
41
+ require?: {
42
+ default: string;
43
+ types: string;
44
+ };
45
+ }>;
46
+ export type LocalHookReturn = string | ts.Node | BundleHandler;
47
+ export type LocalHookReturnFun<P extends any[] = any[], M = LocalHookReturn> = (...args: P) => M;
48
+ export type LocalHookKey = "commonJsHook" | "removeCommonJsExports" | "removeEsmExports";
49
+ export type LocalHook<P extends any[] = any[], M = LocalHookReturn> = {
50
+ name: LocalHookKey;
51
+ fun: LocalHookReturnFun<P, M>;
52
+ };
53
+ export interface DepsObj {
54
+ depFiles: DepsFile[];
55
+ modOpts: {
56
+ commonjs: () => {
57
+ isMain: boolean;
58
+ compilerOptions: ts.CompilerOptions;
59
+ out_dir: string;
60
+ };
61
+ esm: () => {
62
+ isMain: boolean;
63
+ compilerOptions: ts.CompilerOptions;
64
+ out_dir: string;
65
+ };
66
+ };
67
+ generalOptions: ts.CompilerOptions;
68
+ }
69
+ export type RequireImportObject = {
70
+ isNamespace: boolean;
71
+ isTypeOnly: boolean;
72
+ isTypeNamespace: boolean;
73
+ source: string;
74
+ importedString: string | undefined;
75
+ importedObject: string[] | undefined;
76
+ };
77
+ export type TypeObj = Record<string, string[]>;
78
+ export type PrePostPluginAsyncCallback = (code: string, file?: string) => Promise<string>;
79
+ export type PrePostPluginCallback = (code: string, file?: string) => string;
80
+ export type ASTPluginCallback = (node: ts.Node, factory: ts.NodeFactory, file: string) => ts.Node;
81
+ export type ASTPluginAsyncCallback = (node: ts.Node, factory: ts.NodeFactory, file: string) => Promise<ts.Node>;
82
+ export type DependencyPluginAsyncCallback = (files: DepsFile[]) => Promise<DepsFile[]>;
83
+ export type DependencyPluginCallback = (files: DepsFile[]) => DepsFile[];
84
+ export type PostProcessPlugin = {
24
85
  type: "post-process";
25
86
  async: true;
26
- func: (code: string, file?: string) => Promise<string>;
87
+ func: PrePostPluginAsyncCallback;
27
88
  } | {
28
89
  type: "post-process";
29
90
  async: false;
30
- func: (code: string, file?: string) => string;
91
+ func: PrePostPluginCallback;
31
92
  };
32
- type PreProcessExtension = {
93
+ export type PreProcessPlugin = {
33
94
  type: "pre-process";
34
95
  async: true;
35
- func: (code: string, file?: string) => Promise<string>;
96
+ func: PrePostPluginAsyncCallback;
36
97
  } | {
37
98
  type: "pre-process";
38
99
  async: false;
39
- func: (code: string, file?: string) => string;
100
+ func: PrePostPluginCallback;
40
101
  };
41
- type DependencyExtension = {
102
+ export type DependencyPlugin = {
42
103
  type: "dependency";
43
104
  async: true;
44
105
  func: (files: DepsFile[]) => Promise<DepsFile[]>;
@@ -47,36 +108,17 @@ type DependencyExtension = {
47
108
  async: false;
48
109
  func: (files: DepsFile[]) => DepsFile[];
49
110
  };
50
- type ASTExtension = {
111
+ export type ASTPlugin = {
51
112
  type: "ast";
52
- async: true;
53
- func: (sourceFile: ts.SourceFile) => Promise<ts.SourceFile>;
54
- } | {
55
- type: "ast";
56
- async: false;
57
- func: (sourceFile: ts.SourceFile) => ts.SourceFile;
113
+ func: ASTPluginCallback;
58
114
  };
59
- type SuseeExtension = PostProcessExtension | PreProcessExtension | DependencyExtension | ASTExtension;
60
- type OutFiles = {
61
- commonjs: string | undefined;
62
- commonjsTypes: string | undefined;
63
- esm: string | undefined;
64
- esmTypes: string | undefined;
65
- main: string | undefined;
66
- module: string | undefined;
67
- types: string | undefined;
68
- };
69
- type Target = "commonjs" | "esm" | "both";
70
- type Exports = Record<string, {
71
- import?: {
72
- default: string;
73
- types: string;
74
- };
75
- require?: {
76
- default: string;
77
- types: string;
78
- };
79
- }>;
115
+ export type ASTPluginParserReturnFn = (fileName: string, sourceCode: string, compilerOptions: ts.CompilerOptions) => string;
116
+ export type PrePostProcessPluginParserReturnFn = (code: string, file?: string) => string;
117
+ export type DependencyPluginParserReturnFn = (files: DepsFile[]) => DepsFile[];
118
+ export type PluginParserReturnFn = ASTPluginParserReturnFn | PrePostProcessPluginParserReturnFn | DependencyPluginParserReturnFn;
119
+ export type SuseePluginFunc = (...args: any[]) => ASTPlugin | DependencyPlugin | PostProcessPlugin | PreProcessPlugin;
120
+ export type SuseePlugin = ASTPlugin | DependencyPlugin | PostProcessPlugin | PreProcessPlugin | SuseePluginFunc;
121
+ export type SuseePlugins = SuseePlugin[];
80
122
  type NodeJsOutput = {
81
123
  target: "nodejs";
82
124
  /**
@@ -84,21 +126,29 @@ type NodeJsOutput = {
84
126
  *
85
127
  * required
86
128
  */
87
- Path: "." | `./${string}`;
129
+ exportPath: "." | `./${string}`;
88
130
  /**
89
131
  * Output module type of package , commonjs,esm or both esm and commonjs
90
132
  *
91
133
  * default - esm
92
134
  */
93
135
  format?: "commonjs" | "esm" | "both";
136
+ /**
137
+ * Allow bundler to update your package.json.
138
+ *
139
+ * default - true
140
+ */
141
+ allowUpdatePackageJson?: boolean;
94
142
  };
95
143
  type WebOutput = {
96
144
  target: "web";
145
+ outFile: string;
146
+ htmlTemplate: string;
97
147
  };
98
148
  /**
99
149
  * Entry point for SuSee configuration
100
150
  */
101
- type EntryPoint = {
151
+ export interface EntryPoint {
102
152
  /**
103
153
  * Entry of file path of package
104
154
  *
@@ -128,11 +178,11 @@ type EntryPoint = {
128
178
  * default - true
129
179
  */
130
180
  renameDuplicates?: boolean;
131
- };
181
+ }
132
182
  /**
133
183
  * Configuration for Susee Bundler
134
184
  */
135
- interface SuSeeConfig {
185
+ export interface SuSeeConfig {
136
186
  /**
137
187
  * Array of entry points object
138
188
  *
@@ -144,13 +194,37 @@ interface SuSeeConfig {
144
194
  *
145
195
  * default - []
146
196
  */
147
- extensions?: SuseeExtension[];
148
- /**
149
- * Allow bundler to update your package.json.
150
- *
151
- * default - true
152
- */
153
- allowUpdatePackageJson?: boolean;
197
+ plugins?: SuseePlugins;
198
+ }
199
+ export type TsCompilerOptionsReturn = {
200
+ defaultCompilerOptions: ts.CompilerOptions;
201
+ commonJsCompilerOptions: () => ts.CompilerOptions;
202
+ esmCompilerOptions: () => ts.CompilerOptions;
203
+ webCompilerOptions: () => ts.CompilerOptions;
204
+ };
205
+ export interface InitCollationsResult {
206
+ dependencyFilesObject: DepsFile[];
207
+ tsOptions: TsCompilerOptionsReturn;
208
+ plugins: SuseePlugin[];
209
+ includeNodeModules: boolean;
210
+ allowRenameDuplicates: boolean;
211
+ allowUpdatePackageJson: boolean;
212
+ outputTarget: "nodejs" | "web";
213
+ entryFileName: string;
214
+ outputFormat: "commonjs" | "esm" | "both" | undefined;
215
+ exportPath: "." | `./${string}` | undefined;
216
+ }
217
+ export interface BundleResult {
218
+ tsOptions: TsCompilerOptionsReturn;
219
+ plugins: SuseePlugin[];
220
+ includeNodeModules: boolean;
221
+ allowRenameDuplicates: boolean;
222
+ allowUpdatePackageJson: boolean;
223
+ outputTarget: "nodejs" | "web";
224
+ entryFileName: string;
225
+ outputFormat: "commonjs" | "esm" | "both" | undefined;
226
+ exportPath: "." | `./${string}` | undefined;
227
+ bundleContent: string;
154
228
  }
155
- export type { SuseeExtension, Target, EntryPoint, SuSeeConfig, DepsFile, DuplicatesNameMap, NamesMap, NamesSet, NamesSets, BundleHandler, Exports, OutFiles, };
229
+ export {};
156
230
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAI5B,UAAU,QAAQ;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AACD,UAAU,QAAQ;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AACD,KAAK,SAAS,GAAG,QAAQ,EAAE,CAAC;AAE5B,KAAK,iBAAiB,GAAG,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,CAAC;AAE5D,KAAK,aAAa,GAAG,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,QAAQ,KAAK,QAAQ,CAAC;AAE/D,UAAU,QAAQ;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB;AACD,KAAK,oBAAoB,GACrB;IACE,IAAI,EAAE,cAAc,CAAC;IACrB,KAAK,EAAE,IAAI,CAAC;IACZ,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CACxD,GACD;IACE,IAAI,EAAE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,CAAC;IAC5B,qBAAqB,EAAE,OAAO,CAAC;IAC/B,sBAAsB,EAAE,OAAO,CAAC;IAChC,YAAY,EAAE,QAAQ,GAAG,KAAK,CAAC;IAC/B,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,UAAU,GAAG,KAAK,GAAG,MAAM,GAAG,SAAS,CAAC;IACtD,UAAU,EAAE,GAAG,GAAG,KAAK,MAAM,EAAE,GAAG,SAAS,CAAC;IAC5C,aAAa,EAAE,MAAM,CAAC;CACvB"}
package/dist/index.js CHANGED
@@ -1,3 +1,2 @@
1
- import ts from "typescript";
2
- const pkgName = "SU-SEE";
1
+ export const pkgName = "SU-SEE";
3
2
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,MAAM,OAAO,GAAG,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC"}
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@suseejs/types",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Type definitions for suseejs",
5
5
  "type": "module",
6
- "main": "dist/index.cjs",
6
+ "main": "dist/commonjs/index.js",
7
7
  "module": "dist/index.js",
8
- "types": "dist/index.d.cts",
8
+ "types": "dist/commonjs/index.d.ts",
9
9
  "exports": {
10
10
  ".": {
11
11
  "require": {
12
- "types": "./dist/index.d.cts",
13
- "default": "./dist/index.cjs"
12
+ "types": "./dist/commonjs/index.js",
13
+ "default": "./dist/commonjs/index.d.ts"
14
14
  },
15
15
  "import": {
16
16
  "types": "./dist/index.d.ts",
@@ -19,7 +19,9 @@
19
19
  }
20
20
  },
21
21
  "scripts": {
22
- "build": "tsc"
22
+ "commonjs": "tsc -p tsconfig.commonjs.json",
23
+ "esm": "tsc -p tsconfig.esm.json",
24
+ "build": "npm run esm && npm run commonjs"
23
25
  },
24
26
  "repository": {
25
27
  "type": "git",
package/dist/index.cjs DELETED
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const ts = require("typescript");
4
- const pkgName = "SU-SEE";
5
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.cts"],"names":[],"mappings":";;AAAA,iCAAkC;AAElC,MAAM,OAAO,GAAG,QAAQ,CAAC"}
package/dist/index.d.cts DELETED
@@ -1,156 +0,0 @@
1
- import ts = require("typescript");
2
- interface DepsFile {
3
- file: string;
4
- content: string;
5
- }
6
- interface NamesSet {
7
- base: string;
8
- file: string;
9
- newName: string;
10
- isEd?: boolean;
11
- }
12
- type NamesSets = NamesSet[];
13
- type DuplicatesNameMap = Map<string, Set<{
14
- file: string;
15
- }>>;
16
- type BundleHandler = ({ file, content }: DepsFile) => DepsFile;
17
- interface NamesMap {
18
- base: string;
19
- file: string;
20
- short: string;
21
- oldName: string;
22
- }
23
- type PostProcessExtension = {
24
- type: "post-process";
25
- async: true;
26
- func: (code: string, file?: string) => Promise<string>;
27
- } | {
28
- type: "post-process";
29
- async: false;
30
- func: (code: string, file?: string) => string;
31
- };
32
- type PreProcessExtension = {
33
- type: "pre-process";
34
- async: true;
35
- func: (code: string, file?: string) => Promise<string>;
36
- } | {
37
- type: "pre-process";
38
- async: false;
39
- func: (code: string, file?: string) => string;
40
- };
41
- type DependencyExtension = {
42
- type: "dependency";
43
- async: true;
44
- func: (files: DepsFile[]) => Promise<DepsFile[]>;
45
- } | {
46
- type: "dependency";
47
- async: false;
48
- func: (files: DepsFile[]) => DepsFile[];
49
- };
50
- type ASTExtension = {
51
- type: "ast";
52
- async: true;
53
- func: (sourceFile: ts.SourceFile) => Promise<ts.SourceFile>;
54
- } | {
55
- type: "ast";
56
- async: false;
57
- func: (sourceFile: ts.SourceFile) => ts.SourceFile;
58
- };
59
- type SuseeExtension = PostProcessExtension | PreProcessExtension | DependencyExtension | ASTExtension;
60
- type OutFiles = {
61
- commonjs: string | undefined;
62
- commonjsTypes: string | undefined;
63
- esm: string | undefined;
64
- esmTypes: string | undefined;
65
- main: string | undefined;
66
- module: string | undefined;
67
- types: string | undefined;
68
- };
69
- type Target = "commonjs" | "esm" | "both";
70
- type Exports = Record<string, {
71
- import?: {
72
- default: string;
73
- types: string;
74
- };
75
- require?: {
76
- default: string;
77
- types: string;
78
- };
79
- }>;
80
- type NodeJsOutput = {
81
- target: "nodejs";
82
- /**
83
- * path for package
84
- *
85
- * required
86
- */
87
- Path: "." | `./${string}`;
88
- /**
89
- * Output module type of package , commonjs,esm or both esm and commonjs
90
- *
91
- * default - esm
92
- */
93
- format?: "commonjs" | "esm" | "both";
94
- };
95
- type WebOutput = {
96
- target: "web";
97
- };
98
- /**
99
- * Entry point for SuSee configuration
100
- */
101
- type EntryPoint = {
102
- /**
103
- * Entry of file path of package
104
- *
105
- * required
106
- */
107
- entry: string;
108
- /**
109
- * Info for output
110
- *
111
- * required
112
- */
113
- output: NodeJsOutput | WebOutput;
114
- /**
115
- * Custom tsconfig.json path for package typescript compiler options
116
- *
117
- * Priority -
118
- * 1. this custom tsconfig.json
119
- * 2. tsconfig.json at root directory
120
- * 3. default compiler options of susee
121
- *
122
- * default - undefined
123
- */
124
- tsconfigFilePath?: string | undefined;
125
- /**
126
- * When bundling , if there are duplicate declared names , susee will auto rename , if renameDuplicates = false exist with code 1.
127
- *
128
- * default - true
129
- */
130
- renameDuplicates?: boolean;
131
- };
132
- /**
133
- * Configuration for Susee Bundler
134
- */
135
- interface SuSeeConfig {
136
- /**
137
- * Array of entry points object
138
- *
139
- * required
140
- */
141
- entryPoints: EntryPoint[];
142
- /**
143
- * Array of susee extension
144
- *
145
- * default - []
146
- */
147
- extensions?: SuseeExtension[];
148
- /**
149
- * Allow bundler to update your package.json.
150
- *
151
- * default - true
152
- */
153
- allowUpdatePackageJson?: boolean;
154
- }
155
- export type { SuseeExtension, Target, EntryPoint, SuSeeConfig, DepsFile, DuplicatesNameMap, NamesMap, NamesSet, NamesSets, BundleHandler, Exports, OutFiles, };
156
- //# sourceMappingURL=index.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.cts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,QAAQ,YAAY,CAAC,CAAC;AAIlC,UAAU,QAAQ;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AACD,UAAU,QAAQ;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AACD,KAAK,SAAS,GAAG,QAAQ,EAAE,CAAC;AAE5B,KAAK,iBAAiB,GAAG,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,CAAC;AAE5D,KAAK,aAAa,GAAG,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,QAAQ,KAAK,QAAQ,CAAC;AAE/D,UAAU,QAAQ;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB;AACD,KAAK,oBAAoB,GACrB;IACE,IAAI,EAAE,cAAc,CAAC;IACrB,KAAK,EAAE,IAAI,CAAC;IACZ,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CACxD,GACD;IACE,IAAI,EAAE,cAAc,CAAC;IACrB,KAAK,EAAE,KAAK,C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