Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd8b34df

Browse files
committed
Init projector-typescript
0 parents  commitd8b34df

File tree

3 files changed

+2703
-0
lines changed

3 files changed

+2703
-0
lines changed

‎index.js‎

Lines changed: 318 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,318 @@
1+
//@flow
2+
3+
/**
4+
Docs:
5+
https://www.typescriptlang.org/docs/handbook/compiler-options.html
6+
*/
7+
8+
/* ::
9+
export type CompilerOptions = {
10+
// Allow JavaScript files to be compiled.
11+
allowJs?: boolean, // default: false
12+
13+
// Allow default imports from modules with no default export. This does not affect code emit, just typechecking.
14+
allowSyntheticDefaultImports?: boolean, // default: module === "system"
15+
16+
// Do not report errors on unreachable code.
17+
allowUnreachableCode?: boolean, // default: false
18+
19+
// Do not report errors on unused labels.
20+
allowUnusedLabels?: boolean, // default: false
21+
22+
// Parse in strict mode and emit "use strict" for each source file
23+
alwaysStrict?: boolean, // default: false
24+
25+
// Base directory to resolve non-relative module names. See Module Resolution documentation for more details.
26+
baseUrl?: string,
27+
28+
// The character set of the input files.
29+
charset?: string, // default: "utf8"
30+
31+
// Report errors in .js files. Use in conjunction with --allowJs.
32+
checkJs?: boolean, // default: false
33+
34+
// Generates corresponding .d.ts file.
35+
declaration?: boolean, // default: false
36+
37+
// Output directory for generated declaration files.
38+
declarationDir?: string,
39+
40+
// Show diagnostic information.
41+
diagnostics?: boolean, // default: false
42+
43+
// Disable size limitation on JavaScript project.
44+
disableSizeLimit?: boolean, // default: false
45+
46+
// Provide full support for iterables in for..of, spread and destructuring when targeting ES5 or ES3.
47+
downlevelIteration?: boolean, // default: false
48+
49+
// Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files.
50+
emitBOM?: boolean, // default: false
51+
52+
// Emit design-type metadata for decorated declarations in source. See issue #2577 for details.
53+
emitDecoratorMetadata?: boolean, // default: false
54+
55+
// Enables experimental support for ES decorators.
56+
experimentalDecorators?: boolean, // default: false
57+
58+
// Disallow inconsistently-cased references to the same file.
59+
forceConsistentCasingInFileNames?: boolean, // default: false
60+
61+
// Print help message.
62+
help?: boolean,
63+
64+
// Import emit helpers (e.g. __extends, __rest, etc..) from tslib
65+
importHelpers?: boolean, // default: false
66+
67+
// Emit a single file with source maps instead of having a separate file.
68+
inlineSourceMap?: boolean, // default: false
69+
70+
// Emit the source alongside the sourcemaps within a single file; requires --inlineSourceMap or --sourceMap to be set.
71+
inlineSources?: boolean, // default: false
72+
73+
// Initializes a TypeScript project and creates a tsconfig.json file.
74+
init?: boolean,
75+
76+
// Transpile each file as a separate module (similar to `ts.transpileModule`).
77+
isolatedModules?: boolean, // default: false
78+
79+
// Support JSX in .tsx files: "React" or "Preserve". See JSX.
80+
jsx?: string, // default: "Preserve"
81+
82+
// Specify the JSX factory function to use when targeting react JSX emit, e.g. React.createElement or h.
83+
jsxFactory?: string, // default: "React.createElement"
84+
85+
// List of library files to be included in the compilation.
86+
// Possible values are:
87+
// - ES5
88+
// - ES6
89+
// - ES2015
90+
// - ES7
91+
// - ES2016
92+
// - ES2017
93+
// - ESNext
94+
// - DOM
95+
// - DOM.Iterable
96+
// - WebWorker
97+
// - ScriptHost
98+
// - ES2015.Core
99+
// - ES2015.Collection
100+
// - ES2015.Generator
101+
// - ES2015.Iterable
102+
// - ES2015.Promise
103+
// - ES2015.Proxy
104+
// - ES2015.Reflect
105+
// - ES2015.Symbol
106+
// - ES2015.Symbol.WellKnown
107+
// - ES2016.Array.Include
108+
// - ES2017.object
109+
// - ES2017.SharedMemory
110+
// - esnext.asynciterable
111+
//
112+
// Note: If --lib is not specified a default library is injected. The default library injected is:
113+
// - For --target ES5: DOM,ES5,ScriptHost
114+
// - For --target ES6: DOM,ES6,DOM.Iterable,ScriptHost
115+
lib?: string[],
116+
117+
// Print names of generated files part of the compilation.
118+
listEmittedFiles?: boolean, // default: false
119+
120+
// Print names of files part of the compilation.
121+
listFiles?: boolean, // default: false
122+
123+
// The locale to use to show error messages, e.g. en-us.
124+
locale?: string, // default: (platform specific)
125+
126+
// Specifies the location where debugger should locate map files instead of generated locations.
127+
// Use this flag if the .map files will be located at run-time in a different location than the .js files.
128+
// The location specified will be embedded in the sourceMap to direct the debugger where the map files will be located.
129+
mapRoot?: string,
130+
131+
// The maximum dependency depth to search under node_modules and load JavaScript files. Only applicable with --allowJs.
132+
maxNodeModuleJsDepth?: number, // default: 0
133+
134+
// Specify module code generation: "None", "CommonJS", "AMD", "System", "UMD", "ES6", "ES2015" or "ESNext".
135+
// - Only "AMD" and "System" can be used in conjunction with --outFile.
136+
// - "ES6" and "ES2015" values may be used when targeting "ES5" or lower.
137+
module?: string, // default: target === "ES6" ? "ES6" : "CommonJS"
138+
139+
// Determine how modules get resolved. Either "Node" for Node.js/io.js style resolution, or "Classic".
140+
// See Module Resolution documentation for more details.
141+
moduleResolution?: string, // default: module === "AMD" | "System" | "ES6" ? "Classic" : "Node"
142+
143+
// Use the specified end of line sequence to be used when emitting files: "crlf" (windows) or "lf" (unix).
144+
newLine?: string, // default: (platform specific)
145+
146+
// Do not emit outputs.
147+
noEmit?: boolean, // default: false
148+
149+
// Do not generate custom helper functions like __extends in compiled output.
150+
noEmitHelpers?: boolean, // default: false
151+
152+
// Do not emit outputs if any errors were reported.
153+
noEmitOnError?: boolean, // default: false
154+
155+
// Report errors for fallthrough cases in switch statement.
156+
noFallthroughCasesInSwitch?: boolean, // default: false
157+
158+
// Raise error on expressions and declarations with an implied any type.
159+
noImplicitAny?: boolean, // default: false
160+
161+
// Report error when not all code paths in function return a value.
162+
noImplicitReturns?: boolean, // default: false
163+
164+
// Raise error on this expressions with an implied any type.
165+
noImplicitThis?: boolean, // default: false
166+
167+
// Do not emit "use strict" directives in module output.
168+
noImplicitUseStrict?: boolean, // default: false
169+
170+
// Do not include the default library file (lib.d.ts).
171+
noLib?: boolean, // default: false
172+
173+
// Do not add triple-slash references or module import targets to the list of compiled files.
174+
noResolve?: boolean, // default: false
175+
176+
// Disable strict checking of generic signatures in function types.
177+
noStrictGenericChecks?: boolean, // default: false
178+
179+
// Report errors on unused locals.
180+
noUnusedLocals?: boolean, // default: false
181+
182+
// Report errors on unused parameters.
183+
noUnusedParameters?: boolean, // default: false
184+
185+
// DEPRECATED. Use --outFile instead.
186+
out?: string,
187+
188+
// Redirect output structure to the directory.
189+
outDir?: string,
190+
191+
// Concatenate and emit output to single file. The order of concatenation is determined
192+
// by the list of files passed to the compiler on the command line along with triple-slash references and imports.
193+
// See output file order documentation for more details.
194+
outFile?: string,
195+
196+
// List of path mapping entries for module names to locations relative to the baseUrl.
197+
// See Module Resolution documentation for more details.
198+
paths?: Object,
199+
200+
// Do not erase const enum declarations in generated code. See const enums documentation for more details.
201+
preserveConstEnums?: boolean, // default: false
202+
203+
// Stylize errors and messages using color and context.
204+
pretty?: boolean, // default: false
205+
206+
// Compile a project given a valid configuration file.
207+
// The argument can be a file path to a valid JSON configuration file, or a directory path to a directory containing a tsconfig.json file.
208+
// See tsconfig.json documentation for more details.
209+
project?: string,
210+
211+
// DEPRECATED. Use --jsxFactory instead.
212+
// Specifies the object invoked for createElement and __spread when targeting "react" JSX emit.
213+
reactNamespace?: string, // default: "React"
214+
215+
// Remove all comments except copy-right header comments beginning with /*!
216+
removeComments?: boolean, // default: false
217+
218+
// Specifies the root directory of input files. Only use to control the output directory structure with --outDir.
219+
rootDir?: string, // default: (common root directory is computed from the list of input files)
220+
221+
// List of root folders whose combined content represent the structure of the project at runtime.
222+
// See Module Resolution documentation for more details.
223+
rootDirs?: string[],
224+
225+
// DEPRECATED. Use --skipLibCheck instead.
226+
// Skip type checking of default library declaration files.
227+
skipDefaultLibCheck?: boolean, // default: false
228+
229+
// Skip type checking of all declaration files (*.d.ts).
230+
skipLibCheck?: boolean, // default: false
231+
232+
// Generates corresponding .map file.
233+
sourceMap?: boolean, // default: false
234+
235+
// Specifies the location where debugger should locate TypeScript files instead of source locations.
236+
// Use this flag if the sources will be located at run-time in a different location than that at design-time.
237+
// The location specified will be embedded in the sourceMap to direct the debugger where the source files will be located.
238+
sourceRoot?: string,
239+
240+
// Enable all strict type checking options.
241+
// Enabling --strict enables --noImplicitAny, --noImplicitThis, --alwaysStrict and --strictNullChecks.
242+
strict?: boolean, // default: false
243+
244+
// In strict null checking mode, the null and undefined values are not in the domain of every type
245+
// and are only assignable to themselves and any (the one exception being that undefined is also assignable to void).
246+
strictNullChecks?: boolean, // default: false
247+
248+
// Do not emit declarations for code that has an JSDoc annotation.
249+
stripInternal?: boolean, // default: false
250+
251+
// Suppress excess property checks for object literals.
252+
suppressExcessPropertyErrors?: boolean, // default: false
253+
254+
// Suppress --noImplicitAny errors for indexing objects lacking index signatures. See issue #1232 for more details.
255+
suppressImplicitAnyIndexErrors?: boolean, // default: false
256+
257+
// Specify ECMAScript target version: "ES3" (default), "ES5", "ES6"/"ES2015", "ES2016", "ES2017" or "ESNext".
258+
//
259+
// Note: "ESNext" targets latest supported ES proposed features.
260+
target?: string, // default: "ES3"
261+
262+
// Report module resolution log messages.
263+
traceResolution?: boolean, // default: false
264+
265+
// List of names of type definitions to include. See@types, �typeRoots and �types for more details.
266+
types?: string[],
267+
268+
// List of folders to include type definitions from. See@types, �typeRoots and �types for more details.
269+
typeRoots?: string[],
270+
271+
// Print the compiler�s version.
272+
version?: boolean,
273+
274+
// Run the compiler in watch mode. Watch input files and trigger recompilation on changes.
275+
watch?: boolean,
276+
};
277+
278+
export type Diagnostic = {
279+
// Starting file location at which text applies.
280+
start: Location;
281+
282+
// The last file location at which the text applies.
283+
end: Location;
284+
285+
// Text of diagnostic message.
286+
text: string;
287+
288+
// The category of the diagnostic message, e.g. "error" vs. "warning"
289+
category: string;
290+
291+
// The error code of the diagnostic message.
292+
code?: number;
293+
294+
// The name of the plugin reporting the message.
295+
source?: string;
296+
}
297+
298+
export type TranspileOptions = {
299+
code: string,
300+
compilerOptions?: CompilerOptions,
301+
fileName?: string,
302+
reportDiagnostics?: boolean,
303+
moduleName?: string,
304+
renamedDependencies?: Map<string>;
305+
};
306+
307+
export type TranspileOutput = {
308+
outputText: string;
309+
diagnostics?: Diagnostic[];
310+
sourceMapText?: string;
311+
};
312+
*/
313+
314+
constts=require("typescript");
315+
316+
exports.transpile=functiontranspile(opts/*: TranspileOptions */)/*: Promise<TranspileOutput> */{
317+
returnPromise.resolve(ts.transpileModule(opts.code,opts));
318+
};

‎package.json‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"name":"projector-typescript",
3+
"version":"0.0.0",
4+
"description":"Projector wrapper for TypeScript",
5+
"main":"index.js",
6+
"scripts": {
7+
"test":"echo\"Error: no test specified\" && exit 0",
8+
"lint:flow":"flow",
9+
"lint:staged":"lint-staged"
10+
},
11+
"author":"Stanislav Sysoev <@d4rkr00t>",
12+
"license":"MIT",
13+
"dependencies": {
14+
"typescript":"^2.4.2"
15+
},
16+
"devDependencies": {
17+
"flow-bin":"^0.53.1",
18+
"jest":"^20.0.4",
19+
"lint-staged":"^4.0.3",
20+
"pre-commit":"^1.2.2",
21+
"prettier":"^1.5.3"
22+
},
23+
"pre-commit": ["lint:flow","test","lint:staged"],
24+
"lint-staged": {
25+
"*.js": ["prettier --write --print-width 120","git add"]
26+
}
27+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp