@hubol/smooch 1.0.0-beta.2 → 1.0.0-beta.20
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/README.md +56 -0
- package/index.js +44808 -86821
- package/package.json +7 -3
- package/schema.json +20 -4
- package/template-api.d.ts +185 -48
- package/templates/audio-convert.js +13 -13
- package/templates/json-aggregate.js +11 -11
- package/templates/texture-pack.js +15 -15
package/package.json
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubol/smooch",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.20",
|
|
4
4
|
"description": "Generate texture atlases, browser-compatible audio, and source code from directories",
|
|
5
5
|
"bin": {
|
|
6
6
|
"smooch": "index.js"
|
|
7
7
|
},
|
|
8
8
|
"author": "Hubol",
|
|
9
|
-
"license": "ISC"
|
|
10
|
-
|
|
9
|
+
"license": "ISC",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/hubol/smooch.git"
|
|
13
|
+
}
|
|
14
|
+
}
|
package/schema.json
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
},
|
|
13
13
|
"typeof__tag": {
|
|
14
14
|
"properties": {
|
|
15
|
-
"__@toStringTag@
|
|
15
|
+
"__@toStringTag@299": {
|
|
16
16
|
"type": "string"
|
|
17
17
|
},
|
|
18
18
|
"description": {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
},
|
|
24
24
|
"typeof__tag_1": {
|
|
25
25
|
"properties": {
|
|
26
|
-
"__@toStringTag@
|
|
26
|
+
"__@toStringTag@299": {
|
|
27
27
|
"type": "string"
|
|
28
28
|
},
|
|
29
29
|
"description": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"typeof__tag_2": {
|
|
36
36
|
"properties": {
|
|
37
|
-
"__@toStringTag@
|
|
37
|
+
"__@toStringTag@299": {
|
|
38
38
|
"type": "string"
|
|
39
39
|
},
|
|
40
40
|
"description": {
|
|
@@ -54,6 +54,19 @@
|
|
|
54
54
|
},
|
|
55
55
|
"type": "object"
|
|
56
56
|
},
|
|
57
|
+
"{endOfLineSequence:\"crlf\"|\"lf\"|\"os\";}": {
|
|
58
|
+
"properties": {
|
|
59
|
+
"endOfLineSequence": {
|
|
60
|
+
"enum": [
|
|
61
|
+
"crlf",
|
|
62
|
+
"lf",
|
|
63
|
+
"os"
|
|
64
|
+
],
|
|
65
|
+
"type": "string"
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"type": "object"
|
|
69
|
+
},
|
|
57
70
|
"{format:string;zip?:Path.File.t|undefined;directory?:Path.Directory.t|undefined;}": {
|
|
58
71
|
"properties": {
|
|
59
72
|
"directory": {
|
|
@@ -155,6 +168,9 @@
|
|
|
155
168
|
},
|
|
156
169
|
"type": "array"
|
|
157
170
|
},
|
|
171
|
+
"global": {
|
|
172
|
+
"$ref": "#/definitions/{endOfLineSequence:\"crlf\"|\"lf\"|\"os\";}"
|
|
173
|
+
},
|
|
158
174
|
"jsonFiles": {
|
|
159
175
|
"items": {
|
|
160
176
|
"$ref": "#/definitions/{glob:Path.Glob.t;template:{program:Path.File.t;out:Path.File.t;};}"
|
|
@@ -169,4 +185,4 @@
|
|
|
169
185
|
}
|
|
170
186
|
},
|
|
171
187
|
"type": "object"
|
|
172
|
-
}
|
|
188
|
+
}
|
package/template-api.d.ts
CHANGED
|
@@ -1,54 +1,189 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
stripRegexp?: RegExp | RegExp[];
|
|
4
|
-
delimiter?: string;
|
|
5
|
-
transform?: (part: string, index: number, parts: string[]) => string;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
declare function pascalCase(input: string, options?: Options): string;
|
|
1
|
+
import * as fs from 'fs';
|
|
2
|
+
import * as path from 'path';
|
|
9
3
|
|
|
10
|
-
|
|
4
|
+
type EndOfLineSequence = "crlf" | "lf" | "os";
|
|
11
5
|
|
|
12
|
-
declare
|
|
13
|
-
interface
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
6
|
+
declare namespace Boundary_Prettier {
|
|
7
|
+
interface PrinterOptions {
|
|
8
|
+
/**
|
|
9
|
+
* Specify the line length that the printer will wrap on.
|
|
10
|
+
* @default 80
|
|
11
|
+
*/
|
|
12
|
+
printWidth: number;
|
|
13
|
+
/**
|
|
14
|
+
* Specify the number of spaces per indentation-level.
|
|
15
|
+
* @default 2
|
|
16
|
+
*/
|
|
17
|
+
tabWidth: number;
|
|
18
|
+
/**
|
|
19
|
+
* Indent lines with tabs instead of spaces
|
|
20
|
+
* @default false
|
|
21
|
+
*/
|
|
22
|
+
useTabs?: boolean;
|
|
23
|
+
parentParser?: string | undefined;
|
|
24
|
+
__embeddedInHtml?: boolean | undefined;
|
|
25
|
+
}
|
|
26
|
+
type LiteralUnion<T extends U, U = string> = T | (Pick<U, never> & {
|
|
27
|
+
_?: never | undefined;
|
|
28
|
+
});
|
|
29
|
+
export type BuiltInParserName = "acorn" | "angular" | "babel-flow" | "babel-ts" | "babel" | "css" | "espree" | "flow" | "glimmer" | "graphql" | "html" | "json-stringify" | "json" | "json5" | "less" | "lwc" | "markdown" | "mdx" | "meriyah" | "scss" | "typescript" | "vue" | "yaml";
|
|
30
|
+
export interface Options extends PrinterOptions {
|
|
31
|
+
/**
|
|
32
|
+
* Print semicolons at the ends of statements.
|
|
33
|
+
* @default true
|
|
34
|
+
*/
|
|
35
|
+
semi: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Use single quotes instead of double quotes.
|
|
38
|
+
* @default false
|
|
39
|
+
*/
|
|
40
|
+
singleQuote: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Use single quotes in JSX.
|
|
43
|
+
* @default false
|
|
44
|
+
*/
|
|
45
|
+
jsxSingleQuote: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Print trailing commas wherever possible.
|
|
48
|
+
* @default "all"
|
|
49
|
+
*/
|
|
50
|
+
trailingComma: "none" | "es5" | "all";
|
|
51
|
+
/**
|
|
52
|
+
* Print spaces between brackets in object literals.
|
|
53
|
+
* @default true
|
|
54
|
+
*/
|
|
55
|
+
bracketSpacing: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Put the `>` of a multi-line HTML (HTML, JSX, Vue, Angular) element at the end of the last line instead of being
|
|
58
|
+
* alone on the next line (does not apply to self closing elements).
|
|
59
|
+
* @default false
|
|
60
|
+
*/
|
|
61
|
+
bracketSameLine: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Put the `>` of a multi-line JSX element at the end of the last line instead of being alone on the next line.
|
|
64
|
+
* @default false
|
|
65
|
+
* @deprecated use bracketSameLine instead
|
|
66
|
+
*/
|
|
67
|
+
jsxBracketSameLine: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Format only a segment of a file.
|
|
70
|
+
* @default 0
|
|
71
|
+
*/
|
|
72
|
+
rangeStart: number;
|
|
73
|
+
/**
|
|
74
|
+
* Format only a segment of a file.
|
|
75
|
+
* @default Number.POSITIVE_INFINITY
|
|
76
|
+
*/
|
|
77
|
+
rangeEnd: number;
|
|
78
|
+
/**
|
|
79
|
+
* Specify which parser to use.
|
|
80
|
+
*/
|
|
81
|
+
parser: LiteralUnion<BuiltInParserName>;
|
|
82
|
+
/**
|
|
83
|
+
* Specify the input filepath. This will be used to do parser inference.
|
|
84
|
+
*/
|
|
85
|
+
filepath: string;
|
|
86
|
+
/**
|
|
87
|
+
* Prettier can restrict itself to only format files that contain a special comment, called a pragma, at the top of the file.
|
|
88
|
+
* This is very useful when gradually transitioning large, unformatted codebases to prettier.
|
|
89
|
+
* @default false
|
|
90
|
+
*/
|
|
91
|
+
requirePragma: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Prettier can insert a special @format marker at the top of files specifying that
|
|
94
|
+
* the file has been formatted with prettier. This works well when used in tandem with
|
|
95
|
+
* the --require-pragma option. If there is already a docblock at the top of
|
|
96
|
+
* the file then this option will add a newline to it with the @format marker.
|
|
97
|
+
* @default false
|
|
98
|
+
*/
|
|
99
|
+
insertPragma: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* By default, Prettier will wrap markdown text as-is since some services use a linebreak-sensitive renderer.
|
|
102
|
+
* In some cases you may want to rely on editor/viewer soft wrapping instead, so this option allows you to opt out.
|
|
103
|
+
* @default "preserve"
|
|
104
|
+
*/
|
|
105
|
+
proseWrap: "always" | "never" | "preserve";
|
|
106
|
+
/**
|
|
107
|
+
* Include parentheses around a sole arrow function parameter.
|
|
108
|
+
* @default "always"
|
|
109
|
+
*/
|
|
110
|
+
arrowParens: "avoid" | "always";
|
|
111
|
+
/**
|
|
112
|
+
* Provide ability to support new languages to prettier.
|
|
113
|
+
*/
|
|
114
|
+
plugins: Array<string | Plugin>;
|
|
115
|
+
/**
|
|
116
|
+
* How to handle whitespaces in HTML.
|
|
117
|
+
* @default "css"
|
|
118
|
+
*/
|
|
119
|
+
htmlWhitespaceSensitivity: "css" | "strict" | "ignore";
|
|
120
|
+
/**
|
|
121
|
+
* Which end of line characters to apply.
|
|
122
|
+
* @default "lf"
|
|
123
|
+
*/
|
|
124
|
+
endOfLine: "auto" | "lf" | "crlf" | "cr";
|
|
125
|
+
/**
|
|
126
|
+
* Change when properties in objects are quoted.
|
|
127
|
+
* @default "as-needed"
|
|
128
|
+
*/
|
|
129
|
+
quoteProps: "as-needed" | "consistent" | "preserve";
|
|
130
|
+
/**
|
|
131
|
+
* Whether or not to indent the code inside <script> and <style> tags in Vue files.
|
|
132
|
+
* @default false
|
|
133
|
+
*/
|
|
134
|
+
vueIndentScriptAndStyle: boolean;
|
|
135
|
+
/**
|
|
136
|
+
* Control whether Prettier formats quoted code embedded in the file.
|
|
137
|
+
* @default "auto"
|
|
138
|
+
*/
|
|
139
|
+
embeddedLanguageFormatting: "auto" | "off";
|
|
140
|
+
/**
|
|
141
|
+
* Enforce single attribute per line in HTML, Vue and JSX.
|
|
142
|
+
* @default false
|
|
143
|
+
*/
|
|
144
|
+
singleAttributePerLine: boolean;
|
|
145
|
+
}
|
|
146
|
+
export interface Api {
|
|
147
|
+
format(source: string, options?: Options): Promise<string>;
|
|
148
|
+
}
|
|
149
|
+
export {};
|
|
43
150
|
}
|
|
44
151
|
|
|
45
152
|
declare const utils: {
|
|
46
|
-
camel:
|
|
47
|
-
pascal:
|
|
153
|
+
camel: (string: string) => string;
|
|
154
|
+
pascal: (string: string) => string;
|
|
155
|
+
kebab: (string: string) => string;
|
|
48
156
|
noext: (string: string) => string;
|
|
49
157
|
json: (object: any) => string;
|
|
50
158
|
oneline: (string: string) => string;
|
|
51
|
-
|
|
159
|
+
format: (source: string, options?: Boundary_Prettier.Options | undefined) => Promise<string>;
|
|
160
|
+
Fs: {
|
|
161
|
+
resolve: (...paths: string[]) => string;
|
|
162
|
+
_setWriteFileLineEnding: (endOfLineSequence: EndOfLineSequence) => void;
|
|
163
|
+
normalize(path: string): string;
|
|
164
|
+
join(...paths: string[]): string;
|
|
165
|
+
isAbsolute(path: string): boolean;
|
|
166
|
+
relative(from: string, to: string): string;
|
|
167
|
+
dirname(path: string): string;
|
|
168
|
+
basename(path: string, suffix?: string | undefined): string;
|
|
169
|
+
extname(path: string): string;
|
|
170
|
+
sep: "\\" | "/";
|
|
171
|
+
delimiter: ";" | ":";
|
|
172
|
+
parse(path: string): path.ParsedPath;
|
|
173
|
+
format(pathObject: path.FormatInputPathObject): string;
|
|
174
|
+
toNamespacedPath(path: string): string;
|
|
175
|
+
posix: path.PlatformPath;
|
|
176
|
+
win32: path.PlatformPath;
|
|
177
|
+
createWriteStream: typeof fs.createWriteStream;
|
|
178
|
+
readFile: typeof fs.readFile.__promisify__;
|
|
179
|
+
readFileSync: typeof fs.readFileSync;
|
|
180
|
+
writeFile: (file: fs.PathOrFileDescriptor, data: string | NodeJS.ArrayBufferView) => Promise<void>;
|
|
181
|
+
copyFile: typeof fs.copyFile.__promisify__;
|
|
182
|
+
mkdir: (path: fs.PathLike, options?: fs.Mode | fs.MakeDirectoryOptions | null | undefined) => Promise<void>;
|
|
183
|
+
rm: typeof fs.rm.__promisify__;
|
|
184
|
+
exists: typeof fs.exists.__promisify__;
|
|
185
|
+
rename: typeof fs.rename.__promisify__;
|
|
186
|
+
};
|
|
52
187
|
};
|
|
53
188
|
type Utils = typeof utils;
|
|
54
189
|
|
|
@@ -330,10 +465,11 @@ type GlobRoot = string & {
|
|
|
330
465
|
readonly __tag: unique symbol;
|
|
331
466
|
};
|
|
332
467
|
|
|
333
|
-
declare function createAtlases(imageFilePaths:
|
|
334
|
-
|
|
468
|
+
declare function createAtlases(imageFilePaths: Path.File.t[], options: Infer<typeof PackerOptions>): Promise<(Bin<{
|
|
469
|
+
buffer: Buffer;
|
|
470
|
+
filePath: Path.File.t;
|
|
335
471
|
height: number;
|
|
336
|
-
|
|
472
|
+
width: number;
|
|
337
473
|
} & {
|
|
338
474
|
x: number;
|
|
339
475
|
y: number;
|
|
@@ -345,9 +481,10 @@ declare function createAtlases(imageFilePaths: string[], options: Infer<typeof P
|
|
|
345
481
|
type Atlases = AsyncReturnType<typeof createAtlases>;
|
|
346
482
|
declare function createTemplateContext(atlases: Atlases, globRoot: GlobRoot): {
|
|
347
483
|
atlases: (Bin<{
|
|
348
|
-
|
|
484
|
+
buffer: Buffer;
|
|
485
|
+
filePath: Path.File.t;
|
|
349
486
|
height: number;
|
|
350
|
-
|
|
487
|
+
width: number;
|
|
351
488
|
} & {
|
|
352
489
|
x: number;
|
|
353
490
|
y: number;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
/**
|
|
2
|
-
@param {import("smooch/template-api").TemplateContext.AudioConvert} context;
|
|
3
|
-
@param {import("smooch/template-api").Utils} utils;
|
|
4
|
-
*/
|
|
5
|
-
module.exports = function ({ files }, { pascal, noext }) {
|
|
6
|
-
return `
|
|
7
|
-
// This file is generated
|
|
8
|
-
|
|
9
|
-
export const Sfx = {
|
|
10
|
-
${files.map(file =>
|
|
11
|
-
` "${pascal(noext(file.path))}": { ogg: "${file.convertedPaths.ogg}", mp3: "${file.convertedPaths.mp3}", }`).join(`,
|
|
12
|
-
`)}
|
|
13
|
-
}`;
|
|
1
|
+
/**
|
|
2
|
+
@param {import("@hubol/smooch/template-api").TemplateContext.AudioConvert} context;
|
|
3
|
+
@param {import("@hubol/smooch/template-api").Utils} utils;
|
|
4
|
+
*/
|
|
5
|
+
module.exports = function ({ files }, { pascal, noext }) {
|
|
6
|
+
return `
|
|
7
|
+
// This file is generated
|
|
8
|
+
|
|
9
|
+
export const Sfx = {
|
|
10
|
+
${files.map(file =>
|
|
11
|
+
` "${pascal(noext(file.path))}": { ogg: "${file.convertedPaths.ogg}", mp3: "${file.convertedPaths.mp3}", }`).join(`,
|
|
12
|
+
`)}
|
|
13
|
+
}`;
|
|
14
14
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
/**
|
|
2
|
-
@param {import("smooch/template-api").TemplateContext.JsonAggregate} context;
|
|
3
|
-
@param {import("smooch/template-api").Utils} utils;
|
|
4
|
-
*/
|
|
5
|
-
module.exports = function ({ files }, { pascal, noext, oneline, json }) {
|
|
6
|
-
return `// This file is generated.
|
|
7
|
-
|
|
8
|
-
export const JsonFiles = {
|
|
9
|
-
${ files.map(file => ` "${ pascal(noext(file.fileName)) }": ${ oneline(json(file.json)) }`).join(`,
|
|
10
|
-
`) }
|
|
11
|
-
}`;
|
|
1
|
+
/**
|
|
2
|
+
@param {import("@hubol/smooch/template-api").TemplateContext.JsonAggregate} context;
|
|
3
|
+
@param {import("@hubol/smooch/template-api").Utils} utils;
|
|
4
|
+
*/
|
|
5
|
+
module.exports = function ({ files }, { pascal, noext, oneline, json }) {
|
|
6
|
+
return `// This file is generated.
|
|
7
|
+
|
|
8
|
+
export const JsonFiles = {
|
|
9
|
+
${ files.map(file => ` "${ pascal(noext(file.fileName)) }": ${ oneline(json(file.json)) }`).join(`,
|
|
10
|
+
`) }
|
|
11
|
+
}`;
|
|
12
12
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
/**
|
|
2
|
-
@param {import("smooch/template-api").TemplateContext.TexturePack} context;
|
|
3
|
-
@param {import("smooch/template-api").Utils} utils;
|
|
4
|
-
*/
|
|
5
|
-
module.exports = function ({ atlases, textures }, { pascal, noext }) {
|
|
6
|
-
return `
|
|
7
|
-
// This file is generated
|
|
8
|
-
|
|
9
|
-
export const Atlases = [ ${atlases.map(x => `"${x.fileName}"`).join(', ')} ];
|
|
10
|
-
|
|
11
|
-
export const Txs = {
|
|
12
|
-
${textures.map(tx =>
|
|
13
|
-
` "${pascal(noext(tx.fileName))}": { atlas: "${tx.atlasFileName}", x: ${tx.x}, y: ${tx.y}, width: ${tx.width}, height: ${tx.height} }`).join(`,
|
|
14
|
-
`)}
|
|
15
|
-
}`;
|
|
1
|
+
/**
|
|
2
|
+
@param {import("@hubol/smooch/template-api").TemplateContext.TexturePack} context;
|
|
3
|
+
@param {import("@hubol/smooch/template-api").Utils} utils;
|
|
4
|
+
*/
|
|
5
|
+
module.exports = function ({ atlases, textures }, { pascal, noext }) {
|
|
6
|
+
return `
|
|
7
|
+
// This file is generated
|
|
8
|
+
|
|
9
|
+
export const Atlases = [ ${atlases.map(x => `"${x.fileName}"`).join(', ')} ];
|
|
10
|
+
|
|
11
|
+
export const Txs = {
|
|
12
|
+
${textures.map(tx =>
|
|
13
|
+
` "${pascal(noext(tx.fileName))}": { atlas: "${tx.atlasFileName}", x: ${tx.x}, y: ${tx.y}, width: ${tx.width}, height: ${tx.height} }`).join(`,
|
|
14
|
+
`)}
|
|
15
|
+
}`;
|
|
16
16
|
}
|