stencil-public-compiler.d.ts 83 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327
  1. import type { ConfigFlags } from '../cli/config-flags';
  2. import type { PrerenderUrlResults } from '../internal';
  3. import type { JsonDocs } from './stencil-public-docs';
  4. export * from './stencil-public-docs';
  5. /**
  6. * https://stenciljs.com/docs/config/
  7. */
  8. export interface StencilConfig {
  9. /**
  10. * By default, Stencil will attempt to optimize small scripts by inlining them in HTML. Setting
  11. * this flag to `false` will prevent this optimization and keep all scripts separate from HTML.
  12. */
  13. allowInlineScripts?: boolean;
  14. /**
  15. * By setting `autoprefixCss` to `true`, Stencil will use the appropriate config to automatically
  16. * prefix css. For example, developers can write modern and standard css properties, such as
  17. * "transform", and Stencil will automatically add in the prefixed version, such as "-webkit-transform".
  18. * As of Stencil v2, autoprefixing CSS is no longer the default.
  19. * Defaults to `false`
  20. */
  21. autoprefixCss?: boolean | any;
  22. /**
  23. * By default, Stencil will statically analyze the application and generate a component graph of
  24. * how all the components are interconnected.
  25. *
  26. * From the component graph it is able to best decide how components should be grouped
  27. * depending on their usage with one another within the app.
  28. * By doing so it's able to bundle components together in order to reduce network requests.
  29. * However, bundles can be manually generated using the bundles config.
  30. *
  31. * The bundles config is an array of objects that represent how components are grouped together
  32. * in lazy-loaded bundles.
  33. * This config is rarely needed as Stencil handles this automatically behind the scenes.
  34. */
  35. bundles?: ConfigBundle[];
  36. /**
  37. * Stencil will cache build results in order to speed up rebuilds.
  38. * To disable this feature, set enableCache to false.
  39. */
  40. enableCache?: boolean;
  41. /**
  42. * Stencil is traditionally used to compile many components into an app,
  43. * and each component comes with its own compartmentalized styles.
  44. * However, it's still common to have styles which should be "global" across all components and the website.
  45. * A global CSS file is often useful to set CSS Variables.
  46. *
  47. * Additionally, the globalStyle config can be used to precompile styles with Sass, PostCss, etc.
  48. * Below is an example folder structure containing a webapp's global sass file, named app.css.
  49. */
  50. globalStyle?: string;
  51. /**
  52. * When the hashFileNames config is set to true, and it is a production build,
  53. * the hashedFileNameLength config is used to determine how many characters the file name's hash should be.
  54. */
  55. hashedFileNameLength?: number;
  56. /**
  57. * During production builds, the content of each generated file is hashed to represent the content,
  58. * and the hashed value is used as the filename. If the content isn't updated between builds,
  59. * then it receives the same filename. When the content is updated, then the filename is different.
  60. *
  61. * By doing this, deployed apps can "forever-cache" the build directory and take full advantage of
  62. * content delivery networks (CDNs) and heavily caching files for faster apps.
  63. */
  64. hashFileNames?: boolean;
  65. /**
  66. * The namespace config is a string representing a namespace for the app.
  67. * For apps that are not meant to be a library of reusable components,
  68. * the default of App is just fine. However, if the app is meant to be consumed
  69. * as a third-party library, such as Ionic, a unique namespace is required.
  70. */
  71. namespace?: string;
  72. /**
  73. * Stencil is able to take an app's source and compile it to numerous targets,
  74. * such as an app to be deployed on an http server, or as a third-party library
  75. * to be distributed on npm. By default, Stencil apps have an output target type of www.
  76. *
  77. * The outputTargets config is an array of objects, with types of www and dist.
  78. */
  79. outputTargets?: OutputTarget[];
  80. /**
  81. * The plugins config can be used to add your own rollup plugins.
  82. * By default, Stencil does not come with Sass or PostCss support.
  83. * However, either can be added using the plugin array.
  84. */
  85. plugins?: any[];
  86. /**
  87. * Generate js source map files for all bundles
  88. */
  89. sourceMap?: boolean;
  90. /**
  91. * The srcDir config specifies the directory which should contain the source typescript files
  92. * for each component. The standard for Stencil apps is to use src, which is the default.
  93. */
  94. srcDir?: string;
  95. /**
  96. * Passes custom configuration down to the "@rollup/plugin-commonjs" that Stencil uses under the hood.
  97. * For further information: https://stenciljs.com/docs/module-bundling
  98. */
  99. commonjs?: BundlingConfig;
  100. /**
  101. * Passes custom configuration down to the "@rollup/plugin-node-resolve" that Stencil uses under the hood.
  102. * For further information: https://stenciljs.com/docs/module-bundling
  103. */
  104. nodeResolve?: NodeResolveConfig;
  105. /**
  106. * Passes custom configuration down to rollup itself, not all rollup options can be overridden.
  107. */
  108. rollupConfig?: RollupConfig;
  109. /**
  110. * Sets if the ES5 build should be generated or not. Stencil generates a modern build without ES5,
  111. * whereas this setting to `true` will also create es5 builds for both dev and prod modes. Setting
  112. * `buildEs5` to `prod` will only build ES5 in prod mode. Basically if the app does not need to run
  113. * on legacy browsers (IE11 and Edge 18 and below), it's safe to not build ES5, which will also speed
  114. * up build times. Defaults to `false`.
  115. */
  116. buildEs5?: boolean | 'prod';
  117. /**
  118. * Sets if the JS browser files are minified or not. Stencil uses `terser` under the hood.
  119. * Defaults to `false` in dev mode and `true` in production mode.
  120. */
  121. minifyJs?: boolean;
  122. /**
  123. * Sets if the CSS is minified or not.
  124. * Defaults to `false` in dev mode and `true` in production mode.
  125. */
  126. minifyCss?: boolean;
  127. /**
  128. * Forces Stencil to run in `dev` mode if the value is `true` and `production` mode
  129. * if it's `false`.
  130. *
  131. * Defaults to `false` (ie. production) unless the `--dev` flag is used in the CLI.
  132. */
  133. devMode?: boolean;
  134. /**
  135. * Object to provide a custom logger. By default a `logger` is already provided for the
  136. * platform the compiler is running on, such as NodeJS or a browser.
  137. */
  138. logger?: Logger;
  139. /**
  140. * Config to add extra runtime for DOM features that require more polyfills. Note
  141. * that not all DOM APIs are fully polyfilled when using the slot polyfill. These
  142. * are opt-in since not all users will require the additional runtime.
  143. */
  144. extras?: ConfigExtras;
  145. /**
  146. * The hydrated flag identifies if a component and all of its child components
  147. * have finished hydrating. This helps prevent any flash of unstyled content (FOUC)
  148. * as various components are asynchronously downloaded and rendered. By default it
  149. * will add the `hydrated` CSS class to the element. The `hydratedFlag` config can be used
  150. * to change the name of the CSS class, change it to an attribute, or change which
  151. * type of CSS properties and values are assigned before and after hydrating. This config
  152. * can also be used to not include the hydrated flag at all by setting it to `null`.
  153. */
  154. hydratedFlag?: HydratedFlag;
  155. /**
  156. * Ionic prefers to hide all components prior to hydration with a style tag appended
  157. * to the head of the document containing some `visibility: hidden;` css rules.
  158. *
  159. * Disabling this will remove the style tag that sets `visibility: hidden;` on all
  160. * unhydrated web components. This more closely follows the HTML spec, and allows
  161. * you to set your own fallback content.
  162. *
  163. */
  164. invisiblePrehydration?: boolean;
  165. /**
  166. * Sets the task queue used by stencil's runtime. The task queue schedules DOM read and writes
  167. * across the frames to efficiently render and reduce layout thrashing. By default,
  168. * `async` is used. It's recommended to also try each setting to decide which works
  169. * best for your use-case. In all cases, if your app has many CPU intensive tasks causing the
  170. * main thread to periodically lock-up, it's always recommended to try
  171. * [Web Workers](https://stenciljs.com/docs/web-workers) for those tasks.
  172. *
  173. * - `async`: DOM read and writes are scheduled in the next frame to prevent layout thrashing.
  174. * During intensive CPU tasks it will not reschedule rendering to happen in the next frame.
  175. * `async` is ideal for most apps, and if the app has many intensive tasks causing the main
  176. * thread to lock-up, it's recommended to try [Web Workers](https://stenciljs.com/docs/web-workers)
  177. * rather than the congestion async queue.
  178. *
  179. * - `congestionAsync`: DOM reads and writes are scheduled in the next frame to prevent layout
  180. * thrashing. When the app is heavily tasked and the queue becomes congested it will then
  181. * split the work across multiple frames to prevent blocking the main thread. However, it can
  182. * also introduce unnecessary reflows in some cases, especially during startup. `congestionAsync`
  183. * is ideal for apps running animations while also simultaneously executing intensive tasks
  184. * which may lock-up the main thread.
  185. *
  186. * - `immediate`: Makes writeTask() and readTask() callbacks to be executed synchronously. Tasks
  187. * are not scheduled to run in the next frame, but do note there is at least one microtask.
  188. * The `immediate` setting is ideal for apps that do not provide long running and smooth
  189. * animations. Like the async setting, if the app has intensive tasks causing the main thread
  190. * to lock-up, it's recommended to try [Web Workers](https://stenciljs.com/docs/web-workers).
  191. */
  192. taskQueue?: 'async' | 'immediate' | 'congestionAsync';
  193. /**
  194. * Provide a object of key/values accessible within the app, using the `Env` object.
  195. */
  196. env?: {
  197. [prop: string]: string | undefined;
  198. };
  199. globalScript?: string;
  200. srcIndexHtml?: string;
  201. watch?: boolean;
  202. testing?: TestingConfig;
  203. maxConcurrentWorkers?: number;
  204. preamble?: string;
  205. rollupPlugins?: {
  206. before?: any[];
  207. after?: any[];
  208. };
  209. entryComponentsHint?: string[];
  210. buildDist?: boolean;
  211. buildLogFilePath?: string;
  212. cacheDir?: string;
  213. devInspector?: boolean;
  214. devServer?: StencilDevServerConfig;
  215. enableCacheStats?: boolean;
  216. sys?: CompilerSystem;
  217. tsconfig?: string;
  218. validateTypes?: boolean;
  219. /**
  220. * An array of RegExp patterns that are matched against all source files before adding
  221. * to the watch list in watch mode. If the file path matches any of the patterns, when it
  222. * is updated, it will not trigger a re-run of tests.
  223. */
  224. watchIgnoredRegex?: RegExp | RegExp[];
  225. excludeUnusedDependencies?: boolean;
  226. stencilCoreResolvedId?: string;
  227. }
  228. export interface ConfigExtras {
  229. /**
  230. * By default, the slot polyfill does not update `appendChild()` so that it appends
  231. * new child nodes into the correct child slot like how shadow dom works. This is an opt-in
  232. * polyfill for those who need it when using `element.appendChild(node)` and expecting the
  233. * child to be appended in the same location shadow dom would. This is not required for
  234. * IE11 or Edge 18, but can be enabled if the app is using `appendChild()`. Defaults to `false`.
  235. */
  236. appendChildSlotFix?: boolean;
  237. /**
  238. * By default, the runtime does not polyfill `cloneNode()` when cloning a component
  239. * that uses the slot polyfill. This is an opt-in polyfill for those who need it.
  240. * This is not required for IE11 or Edge 18, but can be enabled if the app is using
  241. * `cloneNode()` and unexpected node are being cloned due to the slot polyfill
  242. * simulating shadow dom. Defaults to `false`.
  243. */
  244. cloneNodeFix?: boolean;
  245. /**
  246. * Include the CSS Custom Property polyfill/shim for legacy browsers. ESM builds will
  247. * not include the css vars shim. Defaults to `false`
  248. */
  249. cssVarsShim?: boolean;
  250. /**
  251. * Dynamic `import()` shim. This is only needed for Edge 18 and below, and Firefox 67
  252. * and below. Defaults to `false`.
  253. */
  254. dynamicImportShim?: boolean;
  255. /**
  256. * Experimental flag. Projects that use a Stencil library built using the `dist` output target may have trouble lazily
  257. * loading components when using a bundler such as Vite or Parcel. Setting this flag to `true` will change how Stencil
  258. * lazily loads components in a way that works with additional bundlers. Setting this flag to `true` will increase
  259. * the size of the compiled output. Defaults to `false`.
  260. */
  261. experimentalImportInjection?: boolean;
  262. /**
  263. * Dispatches component lifecycle events. Mainly used for testing. Defaults to `false`.
  264. */
  265. lifecycleDOMEvents?: boolean;
  266. /**
  267. * Safari 10 supports ES modules with `<script type="module">`, however, it did not implement
  268. * `<script nomodule>`. When set to `true`, the runtime will patch support for Safari 10
  269. * due to its lack of `nomodule` support.
  270. * Defaults to `false`.
  271. */
  272. safari10?: boolean;
  273. /**
  274. * It is possible to assign data to the actual `<script>` element's `data-opts` property,
  275. * which then gets passed to Stencil's initial bootstrap. This feature is only required
  276. * for very special cases and rarely needed. Defaults to `false`.
  277. */
  278. scriptDataOpts?: boolean;
  279. /**
  280. * Experimental flag to align the behavior of invoking `textContent` on a scoped component to act more like a
  281. * component that uses the shadow DOM. Defaults to `false`
  282. */
  283. scopedSlotTextContentFix?: boolean;
  284. /**
  285. * If enabled `true`, the runtime will check if the shadow dom shim is required. However,
  286. * if it's determined that shadow dom is already natively supported by the browser then
  287. * it does not request the shim. When set to `false` it will avoid all shadow dom tests.
  288. * Defaults to `false`.
  289. */
  290. shadowDomShim?: boolean;
  291. /**
  292. * When a component is first attached to the DOM, this setting will wait a single tick before
  293. * rendering. This works around an Angular issue, where Angular attaches the elements before
  294. * settings their initial state, leading to double renders and unnecessary event dispatches.
  295. * Defaults to `false`.
  296. */
  297. initializeNextTick?: boolean;
  298. /**
  299. * For browsers that do not support shadow dom (IE11 and Edge 18 and below), slot is polyfilled
  300. * to simulate the same behavior. However, the host element's `childNodes` and `children`
  301. * getters are not patched to only show the child nodes and elements of the default slot.
  302. * Defaults to `false`.
  303. */
  304. slotChildNodesFix?: boolean;
  305. /**
  306. * Enables the tagNameTransform option of `defineCustomElements()`, so the component tagName
  307. * can be customized at runtime. Defaults to `false`.
  308. */
  309. tagNameTransform?: boolean;
  310. }
  311. export interface Config extends StencilConfig {
  312. buildAppCore?: boolean;
  313. buildDocs?: boolean;
  314. configPath?: string;
  315. writeLog?: boolean;
  316. devServer?: DevServerConfig;
  317. flags?: ConfigFlags;
  318. fsNamespace?: string;
  319. logLevel?: LogLevel;
  320. rootDir?: string;
  321. packageJsonFilePath?: string;
  322. suppressLogs?: boolean;
  323. profile?: boolean;
  324. tsCompilerOptions?: any;
  325. _isValidated?: boolean;
  326. _isTesting?: boolean;
  327. }
  328. /**
  329. * A 'loose' type useful for wrapping an incomplete / possible malformed
  330. * object as we work on getting it comply with a particular Interface T.
  331. *
  332. * Example:
  333. *
  334. * ```ts
  335. * interface Foo {
  336. * bar: string
  337. * }
  338. *
  339. * function validateFoo(foo: Loose<Foo>): Foo {
  340. * let validatedFoo = {
  341. * ...foo,
  342. * bar: foo.bar || DEFAULT_BAR
  343. * }
  344. *
  345. * return validatedFoo
  346. * }
  347. * ```
  348. *
  349. * Use this when you need to take user input or something from some other part
  350. * of the world that we don't control and transform it into something
  351. * conforming to a given interface. For best results, pair with a validation
  352. * function as shown in the example.
  353. */
  354. declare type Loose<T extends Object> = Record<string, any> & Partial<T>;
  355. /**
  356. * A Loose version of the Config interface. This is intended to let us load a partial config
  357. * and have type information carry though as we construct an object which is a valid `Config`.
  358. */
  359. export declare type UnvalidatedConfig = Loose<Config>;
  360. /**
  361. * Helper type to strip optional markers from keys in a type, while preserving other type information for the key.
  362. * This type takes a union of keys, K, in type T to allow for the type T to be gradually updated.
  363. *
  364. * ```typescript
  365. * type Foo { bar?: number, baz?: string }
  366. * type ReqFieldFoo = RequireFields<Foo, 'bar'>; // { bar: number, baz?: string }
  367. * ```
  368. */
  369. declare type RequireFields<T, K extends keyof T> = T & {
  370. [P in K]-?: T[P];
  371. };
  372. /**
  373. * Fields in {@link Config} to make required for {@link ValidatedConfig}
  374. */
  375. declare type StrictConfigFields = 'flags' | 'logger' | 'outputTargets' | 'rootDir' | 'sys' | 'testing';
  376. /**
  377. * A version of {@link Config} that makes certain fields required. This type represents a valid configuration entity.
  378. * When a configuration is received by the user, it is a bag of unverified data. In order to make stricter guarantees
  379. * about the data from a type-safety perspective, this type is intended to be used throughout the codebase once
  380. * validations have occurred at runtime.
  381. */
  382. export declare type ValidatedConfig = RequireFields<Config, StrictConfigFields>;
  383. export interface HydratedFlag {
  384. /**
  385. * Defaults to `hydrated`.
  386. */
  387. name?: string;
  388. /**
  389. * Can be either `class` or `attribute`. Defaults to `class`.
  390. */
  391. selector?: 'class' | 'attribute';
  392. /**
  393. * The CSS property used to show and hide components. Defaults to use the CSS `visibility`
  394. * property. Other commonly used CSS properties would be `display` with the `initialValue`
  395. * setting as `none`, or `opacity` with the `initialValue` as `0`. Defaults to `visibility`
  396. * and the default `initialValue` is `hidden`.
  397. */
  398. property?: string;
  399. /**
  400. * This is the CSS value to give all components before it has been hydrated.
  401. * Defaults to `hidden`.
  402. */
  403. initialValue?: string;
  404. /**
  405. * This is the CSS value to assign once a component has finished hydrating.
  406. * This is the CSS value that'll allow the component to show. Defaults to `inherit`.
  407. */
  408. hydratedValue?: string;
  409. }
  410. export interface StencilDevServerConfig {
  411. /**
  412. * IP address used by the dev server. The default is `0.0.0.0`, which points to all IPv4 addresses
  413. * on the local machine, such as `localhost`.
  414. */
  415. address?: string;
  416. /**
  417. * Base path to be used by the server. Defaults to the root pathname.
  418. */
  419. basePath?: string;
  420. /**
  421. * EXPERIMENTAL!
  422. * During development, node modules can be independently requested and bundled, making for
  423. * faster build times. This is only available using the Stencil Dev Server throughout
  424. * development. Production builds and builds with the `es5` flag will override
  425. * this setting to `false`. Default is `false`.
  426. */
  427. experimentalDevModules?: boolean;
  428. /**
  429. * If the dev server should respond with gzip compressed content. Defaults to `true`.
  430. */
  431. gzip?: boolean;
  432. /**
  433. * When set, the dev server will run via https using the SSL certificate and key you provide
  434. * (use `fs` if you want to read them from files).
  435. */
  436. https?: Credentials;
  437. /**
  438. * The URL the dev server should first open to. Defaults to `/`.
  439. */
  440. initialLoadUrl?: string;
  441. /**
  442. * When `true`, every request to the server will be logged within the terminal.
  443. * Defaults to `false`.
  444. */
  445. logRequests?: boolean;
  446. /**
  447. * By default, when dev server is started the local dev URL is opened in your default browser.
  448. * However, to prevent this URL to be opened change this value to `false`. Defaults to `true`.
  449. */
  450. openBrowser?: boolean;
  451. /**
  452. * Sets the server's port. Defaults to `3333`.
  453. */
  454. port?: number;
  455. /**
  456. * When files are watched and updated, by default the dev server will use `hmr` (Hot Module Replacement)
  457. * to update the page without a full page refresh. To have the page do a full refresh use `pageReload`.
  458. * To disable any reloading, use `null`. Defaults to `hmr`.
  459. */
  460. reloadStrategy?: PageReloadStrategy;
  461. /**
  462. * Local path to a NodeJs file with a dev server request listener as the default export.
  463. * The user's request listener is given the first chance to handle every request the dev server
  464. * receives, and can choose to handle it or instead pass it on to the default dev server
  465. * by calling `next()`.
  466. *
  467. * Below is an example of a NodeJs file the `requestListenerPath` config is using.
  468. * The request and response arguments are the same as Node's `http` module and `RequestListener`
  469. * callback. https://nodejs.org/api/http.html#http_http_createserver_options_requestlistener
  470. *
  471. * ```js
  472. * module.exports = function (req, res, next) {
  473. * if (req.url === '/ping') {
  474. * // custom response overriding the dev server
  475. * res.setHeader('Content-Type', 'text/plain');
  476. * res.writeHead(200);
  477. * res.end('pong');
  478. * } else {
  479. * // pass request on to the default dev server
  480. * next();
  481. * }
  482. * };
  483. * ```
  484. */
  485. requestListenerPath?: string;
  486. /**
  487. * The root directory to serve the files from.
  488. */
  489. root?: string;
  490. /**
  491. * If the dev server should Server-Side Render (SSR) each page, meaning it'll dynamically generate
  492. * server-side rendered html on each page load. The `--ssr` flag will most commonly be used with
  493. * the`--dev --watch --serve` flags during development. Note that this is for development purposes
  494. * only, and the built-in dev server should not be used for production. Defaults to `false`.
  495. */
  496. ssr?: boolean;
  497. /**
  498. * If the dev server fails to start up within the given timeout (in milliseconds), the startup will
  499. * be canceled. Set to zero to disable the timeout. Defaults to `15000`.
  500. */
  501. startupTimeout?: number;
  502. /**
  503. * Whether to use the dev server's websocket client or not. Defaults to `true`.
  504. */
  505. websocket?: boolean;
  506. /**
  507. * If the dev server should fork a worker for the server process or not. A singled-threaded dev server
  508. * is slower, however it is useful for debugging http requests and responses. Defaults to `true`.
  509. */
  510. worker?: boolean;
  511. }
  512. export interface DevServerConfig extends StencilDevServerConfig {
  513. browserUrl?: string;
  514. devServerDir?: string;
  515. excludeHmr?: string[];
  516. historyApiFallback?: HistoryApiFallback;
  517. openBrowser?: boolean;
  518. prerenderConfig?: string;
  519. protocol?: 'http' | 'https';
  520. srcIndexHtml?: string;
  521. }
  522. export interface HistoryApiFallback {
  523. index?: string;
  524. disableDotRule?: boolean;
  525. }
  526. export interface DevServerEditor {
  527. id: string;
  528. name?: string;
  529. supported?: boolean;
  530. priority?: number;
  531. }
  532. export declare type TaskCommand = 'build' | 'docs' | 'generate' | 'g' | 'help' | 'info' | 'prerender' | 'serve' | 'telemetry' | 'test' | 'version';
  533. export declare type PageReloadStrategy = 'hmr' | 'pageReload' | null;
  534. /**
  535. * The prerender config is used when prerendering a `www` output target.
  536. * Within `stencil.config.ts`, set the path to the prerendering
  537. * config file path using the `prerenderConfig` property, such as:
  538. *
  539. * ```tsx
  540. * import { Config } from '@stencil/core';
  541. * export const config: Config = {
  542. * outputTargets: [
  543. * {
  544. * type: 'www',
  545. * baseUrl: 'https://stenciljs.com/',
  546. * prerenderConfig: './prerender.config.ts',
  547. * }
  548. * ]
  549. * };
  550. * ```
  551. *
  552. * The `prerender.config.ts` should export a `config` object using
  553. * the `PrerenderConfig` interface.
  554. *
  555. * ```tsx
  556. * import { PrerenderConfig } from '@stencil/core';
  557. * export const config: PrerenderConfig = {
  558. * ...
  559. * };
  560. * ```
  561. *
  562. * For more info: https://stenciljs.com/docs/static-site-generation
  563. */
  564. export interface PrerenderConfig {
  565. /**
  566. * Run after each `document` is hydrated, but before it is serialized
  567. * into an HTML string. Hook is passed the `document` and its `URL`.
  568. */
  569. afterHydrate?(document: Document, url: URL, results: PrerenderUrlResults): any | Promise<any>;
  570. /**
  571. * Run before each `document` is hydrated. Hook is passed the `document` it's `URL`.
  572. */
  573. beforeHydrate?(document: Document, url: URL): any | Promise<any>;
  574. /**
  575. * Runs after the template Document object has serialize into an
  576. * HTML formatted string. Returns an HTML string to be used as the
  577. * base template for all prerendered pages.
  578. */
  579. afterSerializeTemplate?(html: string): string | Promise<string>;
  580. /**
  581. * Runs before the template Document object is serialize into an
  582. * HTML formatted string. Returns the Document to be serialized which
  583. * will become the base template html for all prerendered pages.
  584. */
  585. beforeSerializeTemplate?(document: Document): Document | Promise<Document>;
  586. /**
  587. * A hook to be used to generate the canonical `<link>` tag
  588. * which goes in the `<head>` of every prerendered page. Returning `null`
  589. * will not add a canonical url tag to the page.
  590. */
  591. canonicalUrl?(url: URL): string | null;
  592. /**
  593. * While prerendering, crawl same-origin URLs found within `<a href>` elements.
  594. * Defaults to `true`.
  595. */
  596. crawlUrls?: boolean;
  597. /**
  598. * URLs to start the prerendering from. By default the root URL of `/` is used.
  599. */
  600. entryUrls?: string[];
  601. /**
  602. * Return `true` the given `<a>` element should be crawled or not.
  603. */
  604. filterAnchor?(attrs: {
  605. [attrName: string]: string;
  606. }, base?: URL): boolean;
  607. /**
  608. * Return `true` if the given URL should be prerendered or not.
  609. */
  610. filterUrl?(url: URL, base: URL): boolean;
  611. /**
  612. * Returns the file path which the prerendered HTML content
  613. * should be written to.
  614. */
  615. filePath?(url: URL, filePath: string): string;
  616. /**
  617. * Returns the hydrate options to use for each individual prerendered page.
  618. */
  619. hydrateOptions?(url: URL): PrerenderHydrateOptions;
  620. /**
  621. * Returns the template file's content. The template is the base
  622. * HTML used for all prerendered pages.
  623. */
  624. loadTemplate?(filePath: string): string | Promise<string>;
  625. /**
  626. * Used to normalize the page's URL from a given a string and the current
  627. * page's base URL. Largely used when reading an anchor's `href` attribute
  628. * value and normalizing it into a `URL`.
  629. */
  630. normalizeUrl?(href: string, base: URL): URL;
  631. robotsTxt?(opts: RobotsTxtOpts): string | RobotsTxtResults;
  632. sitemapXml?(opts: SitemapXmpOpts): string | SitemapXmpResults;
  633. /**
  634. * Static Site Generated (SSG). Does not include Stencil's clientside
  635. * JavaScript, custom elements or preload modules.
  636. */
  637. staticSite?: boolean;
  638. /**
  639. * If the prerenndered URLs should have a trailing "/"" or not. Defaults to `false`.
  640. */
  641. trailingSlash?: boolean;
  642. }
  643. export interface HydrateDocumentOptions {
  644. /**
  645. * Build ID that will be added to `<html data-stencil-build="BUILD_ID">`. By default
  646. * a random ID will be generated
  647. */
  648. buildId?: string;
  649. /**
  650. * Sets the `href` attribute on the `<link rel="canonical">`
  651. * tag within the `<head>`. If the value is not defined it will
  652. * ensure a canonical link tag is no included in the `<head>`.
  653. */
  654. canonicalUrl?: string;
  655. /**
  656. * Include the HTML comments and attributes used by the clientside
  657. * JavaScript to read the structure of the HTML and rebuild each
  658. * component. Defaults to `true`.
  659. */
  660. clientHydrateAnnotations?: boolean;
  661. /**
  662. * Constrain `setTimeout()` to 1ms, but still async. Also
  663. * only allows `setInterval()` to fire once, also constrained to 1ms.
  664. * Defaults to `true`.
  665. */
  666. constrainTimeouts?: boolean;
  667. /**
  668. * Sets `document.cookie`
  669. */
  670. cookie?: string;
  671. /**
  672. * Sets the `dir` attribute on the top level `<html>`.
  673. */
  674. direction?: string;
  675. /**
  676. * Component tag names listed here will not be prerendered, nor will
  677. * hydrated on the clientside. Components listed here will be ignored
  678. * as custom elements and treated no differently than a `<div>`.
  679. */
  680. excludeComponents?: string[];
  681. /**
  682. * Sets the `lang` attribute on the top level `<html>`.
  683. */
  684. language?: string;
  685. /**
  686. * Maximum number of components to hydrate on one page. Defaults to `300`.
  687. */
  688. maxHydrateCount?: number;
  689. /**
  690. * Sets `document.referrer`
  691. */
  692. referrer?: string;
  693. /**
  694. * Removes every `<script>` element found in the `document`. Defaults to `false`.
  695. */
  696. removeScripts?: boolean;
  697. /**
  698. * Removes CSS not used by elements within the `document`. Defaults to `true`.
  699. */
  700. removeUnusedStyles?: boolean;
  701. /**
  702. * The url the runtime uses for the resources, such as the assets directory.
  703. */
  704. resourcesUrl?: string;
  705. /**
  706. * Prints out runtime console logs to the NodeJS process. Defaults to `false`.
  707. */
  708. runtimeLogging?: boolean;
  709. /**
  710. * Component tags listed here will only be prerendered or serverside-rendered
  711. * and will not be clientside hydrated. This is useful for components that
  712. * are not dynamic and do not need to be defined as a custom element within the
  713. * browser. For example, a header or footer component would be a good example that
  714. * may not require any clientside JavaScript.
  715. */
  716. staticComponents?: string[];
  717. /**
  718. * The amount of milliseconds to wait for a page to finish rendering until
  719. * a timeout error is thrown. Defaults to `15000`.
  720. */
  721. timeout?: number;
  722. /**
  723. * Sets `document.title`.
  724. */
  725. title?: string;
  726. /**
  727. * Sets `location.href`
  728. */
  729. url?: string;
  730. /**
  731. * Sets `navigator.userAgent`
  732. */
  733. userAgent?: string;
  734. }
  735. export interface SerializeDocumentOptions extends HydrateDocumentOptions {
  736. /**
  737. * Runs after the `document` has been hydrated.
  738. */
  739. afterHydrate?(document: any): any | Promise<any>;
  740. /**
  741. * Sets an approximate line width the HTML should attempt to stay within.
  742. * Note that this is "approximate", in that HTML may often not be able
  743. * to be split at an exact line width. Additionally, new lines created
  744. * is where HTML naturally already has whitespace, such as before an
  745. * attribute or spaces between words. Defaults to `100`.
  746. */
  747. approximateLineWidth?: number;
  748. /**
  749. * Runs before the `document` has been hydrated.
  750. */
  751. beforeHydrate?(document: any): any | Promise<any>;
  752. /**
  753. * Format the HTML in a nicely indented format.
  754. * Defaults to `false`.
  755. */
  756. prettyHtml?: boolean;
  757. /**
  758. * Remove quotes from attribute values when possible.
  759. * Defaults to `true`.
  760. */
  761. removeAttributeQuotes?: boolean;
  762. /**
  763. * Remove the `=""` from standardized `boolean` attributes,
  764. * such as `hidden` or `checked`. Defaults to `true`.
  765. */
  766. removeBooleanAttributeQuotes?: boolean;
  767. /**
  768. * Remove these standardized attributes when their value is empty:
  769. * `class`, `dir`, `id`, `lang`, and `name`, `title`. Defaults to `true`.
  770. */
  771. removeEmptyAttributes?: boolean;
  772. /**
  773. * Remove HTML comments. Defaults to `true`.
  774. */
  775. removeHtmlComments?: boolean;
  776. }
  777. export interface HydrateFactoryOptions extends SerializeDocumentOptions {
  778. serializeToHtml: boolean;
  779. destroyWindow: boolean;
  780. destroyDocument: boolean;
  781. }
  782. export interface PrerenderHydrateOptions extends SerializeDocumentOptions {
  783. /**
  784. * Adds `<link rel="modulepreload">` for modules that will eventually be requested.
  785. * Defaults to `true`.
  786. */
  787. addModulePreloads?: boolean;
  788. /**
  789. * Hash the content of assets, such as images, fonts and css files,
  790. * and add the hashed value as `v` querystring. For example,
  791. * `/assets/image.png?v=abcd1234`. This allows for assets to be
  792. * heavily cached by setting the server's response header with
  793. * `Cache-Control: max-age=31536000, immutable`.
  794. */
  795. hashAssets?: 'querystring';
  796. /**
  797. * External stylesheets from `<link rel="stylesheet">` are instead inlined
  798. * into `<style>` elements. Defaults to `false`.
  799. */
  800. inlineExternalStyleSheets?: boolean;
  801. /**
  802. * Minify CSS content within `<style>` elements. Defaults to `true`.
  803. */
  804. minifyStyleElements?: boolean;
  805. /**
  806. * Minify JavaScript content within `<script>` elements. Defaults to `true`.
  807. */
  808. minifyScriptElements?: boolean;
  809. /**
  810. * Entire `document` should be static. This is useful for specific pages that
  811. * should be static, rather than the entire site. If the whole site should be static,
  812. * use the `staticSite` property on the prerender config instead. If only certain
  813. * components should be static then use `staticComponents` instead.
  814. */
  815. staticDocument?: boolean;
  816. }
  817. export interface RobotsTxtOpts {
  818. urls: string[];
  819. sitemapUrl: string;
  820. baseUrl: string;
  821. dir: string;
  822. }
  823. export interface RobotsTxtResults {
  824. content: string;
  825. filePath: string;
  826. url: string;
  827. }
  828. export interface SitemapXmpOpts {
  829. urls: string[];
  830. baseUrl: string;
  831. dir: string;
  832. }
  833. export interface SitemapXmpResults {
  834. content: string;
  835. filePath: string;
  836. url: string;
  837. }
  838. /**
  839. * Common system used by the compiler. All file reads, writes, access, etc. will all use
  840. * this system. Additionally, throughout each build, the compiler will use an internal
  841. * in-memory file system as to prevent unnecessary fs reads and writes. At the end of each
  842. * build all actions the in-memory fs performed will be written to disk using this system.
  843. * A NodeJS based system will use APIs such as `fs` and `crypto`, and a web-based system
  844. * will use in-memory Maps and browser APIs. Either way, the compiler itself is unaware
  845. * of the actual platform it's being ran on top of.
  846. */
  847. export interface CompilerSystem {
  848. name: 'node' | 'in-memory';
  849. version: string;
  850. events?: BuildEvents;
  851. details?: SystemDetails;
  852. /**
  853. * Add a callback which will be ran when destroy() is called.
  854. */
  855. addDestory(cb: () => void): void;
  856. /**
  857. * Always returns a boolean, does not throw.
  858. */
  859. access(p: string): Promise<boolean>;
  860. /**
  861. * SYNC! Always returns a boolean, does not throw.
  862. */
  863. accessSync(p: string): boolean;
  864. applyGlobalPatch?(fromDir: string): Promise<void>;
  865. applyPrerenderGlobalPatch?(opts: {
  866. devServerHostUrl: string;
  867. window: any;
  868. }): void;
  869. cacheStorage?: CacheStorage;
  870. checkVersion?: (logger: Logger, currentVersion: string) => Promise<() => void>;
  871. copy?(copyTasks: Required<CopyTask>[], srcDir: string): Promise<CopyResults>;
  872. /**
  873. * Always returns a boolean if the files were copied or not. Does not throw.
  874. */
  875. copyFile(src: string, dst: string): Promise<boolean>;
  876. /**
  877. * Used to destroy any listeners, file watchers or child processes.
  878. */
  879. destroy(): Promise<void>;
  880. /**
  881. * Does not throw.
  882. */
  883. createDir(p: string, opts?: CompilerSystemCreateDirectoryOptions): Promise<CompilerSystemCreateDirectoryResults>;
  884. /**
  885. * SYNC! Does not throw.
  886. */
  887. createDirSync(p: string, opts?: CompilerSystemCreateDirectoryOptions): CompilerSystemCreateDirectoryResults;
  888. homeDir(): string;
  889. /**
  890. * Used to determine if the current context of the terminal is TTY.
  891. */
  892. isTTY(): boolean;
  893. /**
  894. * Each platform as a different way to dynamically import modules.
  895. */
  896. dynamicImport?(p: string): Promise<any>;
  897. /**
  898. * Creates the worker controller for the current system.
  899. */
  900. createWorkerController?(maxConcurrentWorkers: number): WorkerMainController;
  901. encodeToBase64(str: string): string;
  902. ensureDependencies?(opts: {
  903. rootDir: string;
  904. logger: Logger;
  905. dependencies: CompilerDependency[];
  906. }): Promise<{
  907. stencilPath: string;
  908. diagnostics: Diagnostic[];
  909. }>;
  910. ensureResources?(opts: {
  911. rootDir: string;
  912. logger: Logger;
  913. dependencies: CompilerDependency[];
  914. }): Promise<void>;
  915. /**
  916. * process.exit()
  917. */
  918. exit(exitCode: number): Promise<void>;
  919. /**
  920. * Optionally provide a fetch() function rather than using the built-in fetch().
  921. * First arg is a url string or Request object (RequestInfo).
  922. * Second arg is the RequestInit. Returns the Response object
  923. */
  924. fetch?(input: string | any, init?: any): Promise<any>;
  925. /**
  926. * Generates a sha1 digest encoded as HEX
  927. */
  928. generateContentHash?(content: string | any, length?: number): Promise<string>;
  929. /**
  930. * Generates a sha1 digest encoded as HEX from a file path
  931. */
  932. generateFileHash?(filePath: string | any, length?: number): Promise<string>;
  933. /**
  934. * Get the current directory.
  935. */
  936. getCurrentDirectory(): string;
  937. /**
  938. * The compiler's executing path.
  939. */
  940. getCompilerExecutingPath(): string;
  941. /**
  942. * The dev server's executing path.
  943. */
  944. getDevServerExecutingPath?(): string;
  945. getEnvironmentVar?(key: string): string;
  946. /**
  947. * Gets the absolute file path when for a dependency module.
  948. */
  949. getLocalModulePath(opts: {
  950. rootDir: string;
  951. moduleId: string;
  952. path: string;
  953. }): string;
  954. /**
  955. * Gets the full url when requesting a dependency module to fetch from a CDN.
  956. */
  957. getRemoteModuleUrl(opts: {
  958. moduleId: string;
  959. path?: string;
  960. version?: string;
  961. }): string;
  962. /**
  963. * Aync glob task. Only available in NodeJS compiler system.
  964. */
  965. glob?(pattern: string, options: {
  966. cwd?: string;
  967. nodir?: boolean;
  968. [key: string]: any;
  969. }): Promise<string[]>;
  970. /**
  971. * The number of logical processors available to run threads on the user's computer (cpus).
  972. */
  973. hardwareConcurrency: number;
  974. /**
  975. * Tests if the path is a symbolic link or not. Always resolves a boolean. Does not throw.
  976. */
  977. isSymbolicLink(p: string): Promise<boolean>;
  978. lazyRequire?: LazyRequire;
  979. nextTick(cb: () => void): void;
  980. /**
  981. * Normalize file system path.
  982. */
  983. normalizePath(p: string): string;
  984. onProcessInterrupt?(cb: () => void): void;
  985. parseYarnLockFile?: (content: string) => {
  986. type: 'success' | 'merge' | 'conflict';
  987. object: any;
  988. };
  989. platformPath: PlatformPath;
  990. /**
  991. * All return paths are full normalized paths, not just the basenames. Always returns an array, does not throw.
  992. */
  993. readDir(p: string): Promise<string[]>;
  994. /**
  995. * SYNC! All return paths are full normalized paths, not just the basenames. Always returns an array, does not throw.
  996. */
  997. readDirSync(p: string): string[];
  998. /**
  999. * Returns undefined if file is not found. Does not throw.
  1000. */
  1001. readFile(p: string): Promise<string>;
  1002. readFile(p: string, encoding: 'utf8'): Promise<string>;
  1003. readFile(p: string, encoding: 'binary'): Promise<any>;
  1004. /**
  1005. * SYNC! Returns undefined if file is not found. Does not throw.
  1006. */
  1007. readFileSync(p: string, encoding?: string): string;
  1008. /**
  1009. * Does not throw.
  1010. */
  1011. realpath(p: string): Promise<CompilerSystemRealpathResults>;
  1012. /**
  1013. * SYNC! Does not throw.
  1014. */
  1015. realpathSync(p: string): CompilerSystemRealpathResults;
  1016. /**
  1017. * Remove a callback which will be ran when destroy() is called.
  1018. */
  1019. removeDestory(cb: () => void): void;
  1020. /**
  1021. * Rename old path to new path. Does not throw.
  1022. */
  1023. rename(oldPath: string, newPath: string): Promise<CompilerSystemRenameResults>;
  1024. resolveModuleId?(opts: ResolveModuleIdOptions): Promise<ResolveModuleIdResults>;
  1025. resolvePath(p: string): string;
  1026. /**
  1027. * Does not throw.
  1028. */
  1029. removeDir(p: string, opts?: CompilerSystemRemoveDirectoryOptions): Promise<CompilerSystemRemoveDirectoryResults>;
  1030. /**
  1031. * SYNC! Does not throw.
  1032. */
  1033. removeDirSync(p: string, opts?: CompilerSystemRemoveDirectoryOptions): CompilerSystemRemoveDirectoryResults;
  1034. /**
  1035. * Does not throw.
  1036. */
  1037. removeFile(p: string): Promise<CompilerSystemRemoveFileResults>;
  1038. /**
  1039. * SYNC! Does not throw.
  1040. */
  1041. removeFileSync(p: string): CompilerSystemRemoveFileResults;
  1042. setupCompiler?: (c: {
  1043. ts: any;
  1044. }) => void;
  1045. /**
  1046. * Always returns an object. Does not throw. Check for "error" property if there's an error.
  1047. */
  1048. stat(p: string): Promise<CompilerFsStats>;
  1049. /**
  1050. * SYNC! Always returns an object. Does not throw. Check for "error" property if there's an error.
  1051. */
  1052. statSync(p: string): CompilerFsStats;
  1053. tmpDirSync(): string;
  1054. watchDirectory?(p: string, callback: CompilerFileWatcherCallback, recursive?: boolean): CompilerFileWatcher;
  1055. watchFile?(p: string, callback: CompilerFileWatcherCallback): CompilerFileWatcher;
  1056. /**
  1057. * How many milliseconds to wait after a change before calling watch callbacks.
  1058. */
  1059. watchTimeout?: number;
  1060. /**
  1061. * Does not throw.
  1062. */
  1063. writeFile(p: string, content: string): Promise<CompilerSystemWriteFileResults>;
  1064. /**
  1065. * SYNC! Does not throw.
  1066. */
  1067. writeFileSync(p: string, content: string): CompilerSystemWriteFileResults;
  1068. }
  1069. export interface TranspileOnlyResults {
  1070. diagnostics: Diagnostic[];
  1071. output: string;
  1072. sourceMap: any;
  1073. }
  1074. export interface ParsedPath {
  1075. root: string;
  1076. dir: string;
  1077. base: string;
  1078. ext: string;
  1079. name: string;
  1080. }
  1081. export interface PlatformPath {
  1082. normalize(p: string): string;
  1083. join(...paths: string[]): string;
  1084. resolve(...pathSegments: string[]): string;
  1085. isAbsolute(p: string): boolean;
  1086. relative(from: string, to: string): string;
  1087. dirname(p: string): string;
  1088. basename(p: string, ext?: string): string;
  1089. extname(p: string): string;
  1090. parse(p: string): ParsedPath;
  1091. sep: string;
  1092. delimiter: string;
  1093. posix: any;
  1094. win32: any;
  1095. }
  1096. export interface CompilerDependency {
  1097. name: string;
  1098. version: string;
  1099. main: string;
  1100. resources?: string[];
  1101. }
  1102. export interface ResolveModuleIdOptions {
  1103. moduleId: string;
  1104. containingFile?: string;
  1105. exts?: string[];
  1106. packageFilter?: (pkg: any) => void;
  1107. }
  1108. export interface ResolveModuleIdResults {
  1109. moduleId: string;
  1110. resolveId: string;
  1111. pkgData: {
  1112. name: string;
  1113. version: string;
  1114. [key: string]: any;
  1115. };
  1116. pkgDirPath: string;
  1117. }
  1118. export interface WorkerMainController {
  1119. send(...args: any[]): Promise<any>;
  1120. handler(name: string): (...args: any[]) => Promise<any>;
  1121. destroy(): void;
  1122. maxWorkers: number;
  1123. }
  1124. export interface CopyResults {
  1125. diagnostics: Diagnostic[];
  1126. filePaths: string[];
  1127. dirPaths: string[];
  1128. }
  1129. export interface SystemDetails {
  1130. cpuModel: string;
  1131. freemem(): number;
  1132. platform: 'darwin' | 'windows' | 'linux' | '';
  1133. release: string;
  1134. totalmem: number;
  1135. }
  1136. export interface BuildOnEvents {
  1137. on(cb: (eventName: CompilerEventName, data: any) => void): BuildOnEventRemove;
  1138. on(eventName: CompilerEventFileAdd, cb: (path: string) => void): BuildOnEventRemove;
  1139. on(eventName: CompilerEventFileDelete, cb: (path: string) => void): BuildOnEventRemove;
  1140. on(eventName: CompilerEventFileUpdate, cb: (path: string) => void): BuildOnEventRemove;
  1141. on(eventName: CompilerEventDirAdd, cb: (path: string) => void): BuildOnEventRemove;
  1142. on(eventName: CompilerEventDirDelete, cb: (path: string) => void): BuildOnEventRemove;
  1143. on(eventName: CompilerEventBuildStart, cb: (buildStart: CompilerBuildStart) => void): BuildOnEventRemove;
  1144. on(eventName: CompilerEventBuildFinish, cb: (buildResults: CompilerBuildResults) => void): BuildOnEventRemove;
  1145. on(eventName: CompilerEventBuildLog, cb: (buildLog: BuildLog) => void): BuildOnEventRemove;
  1146. on(eventName: CompilerEventBuildNoChange, cb: () => void): BuildOnEventRemove;
  1147. }
  1148. export interface BuildEmitEvents {
  1149. emit(eventName: CompilerEventFileAdd, path: string): void;
  1150. emit(eventName: CompilerEventFileDelete, path: string): void;
  1151. emit(eventName: CompilerEventFileUpdate, path: string): void;
  1152. emit(eventName: CompilerEventDirAdd, path: string): void;
  1153. emit(eventName: CompilerEventDirDelete, path: string): void;
  1154. emit(eventName: CompilerEventBuildStart, buildStart: CompilerBuildStart): void;
  1155. emit(eventName: CompilerEventBuildFinish, buildResults: CompilerBuildResults): void;
  1156. emit(eventName: CompilerEventBuildNoChange, buildNoChange: BuildNoChangeResults): void;
  1157. emit(eventName: CompilerEventBuildLog, buildLog: BuildLog): void;
  1158. emit(eventName: CompilerEventFsChange, fsWatchResults: FsWatchResults): void;
  1159. }
  1160. export interface FsWatchResults {
  1161. dirsAdded: string[];
  1162. dirsDeleted: string[];
  1163. filesUpdated: string[];
  1164. filesAdded: string[];
  1165. filesDeleted: string[];
  1166. }
  1167. export interface BuildLog {
  1168. buildId: number;
  1169. messages: string[];
  1170. progress: number;
  1171. }
  1172. export interface BuildNoChangeResults {
  1173. buildId: number;
  1174. noChange: boolean;
  1175. }
  1176. export interface CompilerBuildResults {
  1177. buildId: number;
  1178. componentGraph?: BuildResultsComponentGraph;
  1179. diagnostics: Diagnostic[];
  1180. dirsAdded: string[];
  1181. dirsDeleted: string[];
  1182. duration: number;
  1183. filesAdded: string[];
  1184. filesChanged: string[];
  1185. filesDeleted: string[];
  1186. filesUpdated: string[];
  1187. hasError: boolean;
  1188. hasSuccessfulBuild: boolean;
  1189. hmr?: HotModuleReplacement;
  1190. hydrateAppFilePath?: string;
  1191. isRebuild: boolean;
  1192. namespace: string;
  1193. outputs: BuildOutput[];
  1194. rootDir: string;
  1195. srcDir: string;
  1196. timestamp: string;
  1197. }
  1198. export interface BuildResultsComponentGraph {
  1199. [scopeId: string]: string[];
  1200. }
  1201. export interface BuildOutput {
  1202. type: string;
  1203. files: string[];
  1204. }
  1205. export interface HotModuleReplacement {
  1206. componentsUpdated?: string[];
  1207. excludeHmr?: string[];
  1208. externalStylesUpdated?: string[];
  1209. imagesUpdated?: string[];
  1210. indexHtmlUpdated?: boolean;
  1211. inlineStylesUpdated?: HmrStyleUpdate[];
  1212. reloadStrategy: PageReloadStrategy;
  1213. scriptsAdded?: string[];
  1214. scriptsDeleted?: string[];
  1215. serviceWorkerUpdated?: boolean;
  1216. versionId?: string;
  1217. }
  1218. export interface HmrStyleUpdate {
  1219. styleId: string;
  1220. styleTag: string;
  1221. styleText: string;
  1222. }
  1223. export declare type BuildOnEventRemove = () => boolean;
  1224. export interface BuildEvents extends BuildOnEvents, BuildEmitEvents {
  1225. unsubscribeAll(): void;
  1226. }
  1227. export interface CompilerBuildStart {
  1228. buildId: number;
  1229. timestamp: string;
  1230. }
  1231. export declare type CompilerFileWatcherCallback = (fileName: string, eventKind: CompilerFileWatcherEvent) => void;
  1232. export declare type CompilerFileWatcherEvent = CompilerEventFileAdd | CompilerEventFileDelete | CompilerEventFileUpdate | CompilerEventDirAdd | CompilerEventDirDelete;
  1233. export declare type CompilerEventName = CompilerEventFsChange | CompilerEventFileUpdate | CompilerEventFileAdd | CompilerEventFileDelete | CompilerEventDirAdd | CompilerEventDirDelete | CompilerEventBuildStart | CompilerEventBuildFinish | CompilerEventBuildNoChange | CompilerEventBuildLog;
  1234. export declare type CompilerEventFsChange = 'fsChange';
  1235. export declare type CompilerEventFileUpdate = 'fileUpdate';
  1236. export declare type CompilerEventFileAdd = 'fileAdd';
  1237. export declare type CompilerEventFileDelete = 'fileDelete';
  1238. export declare type CompilerEventDirAdd = 'dirAdd';
  1239. export declare type CompilerEventDirDelete = 'dirDelete';
  1240. export declare type CompilerEventBuildStart = 'buildStart';
  1241. export declare type CompilerEventBuildFinish = 'buildFinish';
  1242. export declare type CompilerEventBuildLog = 'buildLog';
  1243. export declare type CompilerEventBuildNoChange = 'buildNoChange';
  1244. export interface CompilerFileWatcher {
  1245. close(): void | Promise<void>;
  1246. }
  1247. export interface CompilerFsStats {
  1248. /**
  1249. * If it's a directory. `false` if there was an error.
  1250. */
  1251. isDirectory: boolean;
  1252. /**
  1253. * If it's a file. `false` if there was an error.
  1254. */
  1255. isFile: boolean;
  1256. /**
  1257. * If it's a symlink. `false` if there was an error.
  1258. */
  1259. isSymbolicLink: boolean;
  1260. /**
  1261. * The size of the file in bytes. `0` for directories or if there was an error.
  1262. */
  1263. size: number;
  1264. /**
  1265. * The timestamp indicating the last time this file was modified expressed in milliseconds since the POSIX Epoch.
  1266. */
  1267. mtimeMs?: number;
  1268. /**
  1269. * Error if there was one, otherwise `null`. `stat` and `statSync` do not throw errors but always returns this interface.
  1270. */
  1271. error: any;
  1272. }
  1273. export interface CompilerSystemCreateDirectoryOptions {
  1274. /**
  1275. * Indicates whether parent directories should be created.
  1276. * @default false
  1277. */
  1278. recursive?: boolean;
  1279. /**
  1280. * A file mode. If a string is passed, it is parsed as an octal integer. If not specified
  1281. * @default 0o777.
  1282. */
  1283. mode?: number;
  1284. }
  1285. export interface CompilerSystemCreateDirectoryResults {
  1286. basename: string;
  1287. dirname: string;
  1288. path: string;
  1289. newDirs: string[];
  1290. error: any;
  1291. }
  1292. export interface CompilerSystemRemoveDirectoryOptions {
  1293. /**
  1294. * Indicates whether child files and subdirectories should be removed.
  1295. * @default false
  1296. */
  1297. recursive?: boolean;
  1298. }
  1299. export interface CompilerSystemRemoveDirectoryResults {
  1300. basename: string;
  1301. dirname: string;
  1302. path: string;
  1303. removedDirs: string[];
  1304. removedFiles: string[];
  1305. error: any;
  1306. }
  1307. export interface CompilerSystemRenameResults extends CompilerSystemRenamedPath {
  1308. renamed: CompilerSystemRenamedPath[];
  1309. oldDirs: string[];
  1310. oldFiles: string[];
  1311. newDirs: string[];
  1312. newFiles: string[];
  1313. error: any;
  1314. }
  1315. export interface CompilerSystemRenamedPath {
  1316. oldPath: string;
  1317. newPath: string;
  1318. isFile: boolean;
  1319. isDirectory: boolean;
  1320. }
  1321. export interface CompilerSystemRealpathResults {
  1322. path: string;
  1323. error: any;
  1324. }
  1325. export interface CompilerSystemRemoveFileResults {
  1326. basename: string;
  1327. dirname: string;
  1328. path: string;
  1329. error: any;
  1330. }
  1331. export interface CompilerSystemWriteFileResults {
  1332. path: string;
  1333. error: any;
  1334. }
  1335. export interface Credentials {
  1336. key: string;
  1337. cert: string;
  1338. }
  1339. export interface ConfigBundle {
  1340. components: string[];
  1341. }
  1342. export interface CopyTask {
  1343. src: string;
  1344. dest?: string;
  1345. warn?: boolean;
  1346. keepDirStructure?: boolean;
  1347. }
  1348. export interface BundlingConfig {
  1349. namedExports?: {
  1350. [key: string]: string[];
  1351. };
  1352. }
  1353. export interface NodeResolveConfig {
  1354. module?: boolean;
  1355. jsnext?: boolean;
  1356. main?: boolean;
  1357. browser?: boolean;
  1358. extensions?: string[];
  1359. preferBuiltins?: boolean;
  1360. jail?: string;
  1361. only?: Array<string | RegExp>;
  1362. modulesOnly?: boolean;
  1363. /**
  1364. * @see https://github.com/browserify/resolve#resolveid-opts-cb
  1365. */
  1366. customResolveOptions?: {
  1367. basedir?: string;
  1368. package?: string;
  1369. extensions?: string[];
  1370. readFile?: Function;
  1371. isFile?: Function;
  1372. isDirectory?: Function;
  1373. packageFilter?: Function;
  1374. pathFilter?: Function;
  1375. paths?: Function | string[];
  1376. moduleDirectory?: string | string[];
  1377. preserveSymlinks?: boolean;
  1378. };
  1379. }
  1380. export interface RollupConfig {
  1381. inputOptions?: RollupInputOptions;
  1382. outputOptions?: RollupOutputOptions;
  1383. }
  1384. export interface RollupInputOptions {
  1385. context?: string;
  1386. moduleContext?: ((id: string) => string) | {
  1387. [id: string]: string;
  1388. };
  1389. treeshake?: boolean;
  1390. }
  1391. export interface RollupOutputOptions {
  1392. globals?: {
  1393. [name: string]: string;
  1394. } | ((name: string) => string);
  1395. }
  1396. export interface Testing {
  1397. run(opts: TestingRunOptions): Promise<boolean>;
  1398. destroy(): Promise<void>;
  1399. }
  1400. export interface TestingRunOptions {
  1401. e2e?: boolean;
  1402. screenshot?: boolean;
  1403. spec?: boolean;
  1404. updateScreenshot?: boolean;
  1405. }
  1406. export interface JestConfig {
  1407. /**
  1408. * This option tells Jest that all imported modules in your tests should be mocked automatically.
  1409. * All modules used in your tests will have a replacement implementation, keeping the API surface. Default: false
  1410. */
  1411. automock?: boolean;
  1412. /**
  1413. * By default, Jest runs all tests and produces all errors into the console upon completion.
  1414. * The bail config option can be used here to have Jest stop running tests after the first failure. Default: false
  1415. */
  1416. bail?: boolean;
  1417. /**
  1418. * The directory where Jest should store its cached dependency information. Jest attempts to scan your dependency tree once (up-front)
  1419. * and cache it in order to ease some of the filesystem raking that needs to happen while running tests. This config option lets you
  1420. * customize where Jest stores that cache data on disk. Default: "/tmp/<path>"
  1421. */
  1422. cacheDirectory?: string;
  1423. /**
  1424. * Automatically clear mock calls and instances between every test. Equivalent to calling jest.clearAllMocks()
  1425. * between each test. This does not remove any mock implementation that may have been provided. Default: false
  1426. */
  1427. clearMocks?: boolean;
  1428. /**
  1429. * Indicates whether the coverage information should be collected while executing the test. Because this retrofits all
  1430. * executed files with coverage collection statements, it may significantly slow down your tests. Default: false
  1431. */
  1432. collectCoverage?: boolean;
  1433. /**
  1434. * An array of glob patterns indicating a set of files for which coverage information should be collected.
  1435. * If a file matches the specified glob pattern, coverage information will be collected for it even if no tests exist
  1436. * for this file and it's never required in the test suite. Default: undefined
  1437. */
  1438. collectCoverageFrom?: any[];
  1439. /**
  1440. * The directory where Jest should output its coverage files. Default: undefined
  1441. */
  1442. coverageDirectory?: string;
  1443. /**
  1444. * An array of regexp pattern strings that are matched against all file paths before executing the test. If the file path matches
  1445. * any of the patterns, coverage information will be skipped. These pattern strings match against the full path.
  1446. * Use the <rootDir> string token to include the path to your project's root directory to prevent it from accidentally
  1447. * ignoring all of your files in different environments that may have different root directories.
  1448. * Example: ["<rootDir>/build/", "<rootDir>/node_modules/"]. Default: ["/node_modules/"]
  1449. */
  1450. coveragePathIgnorePatterns?: any[];
  1451. /**
  1452. * A list of reporter names that Jest uses when writing coverage reports. Any istanbul reporter can be used.
  1453. * Default: ["json", "lcov", "text"]
  1454. */
  1455. coverageReporters?: any[];
  1456. /**
  1457. * This will be used to configure minimum threshold enforcement for coverage results. Thresholds can be specified as global,
  1458. * as a glob, and as a directory or file path. If thresholds aren't met, jest will fail. Thresholds specified as a positive
  1459. * number are taken to be the minimum percentage required. Thresholds specified as a negative number represent the maximum
  1460. * number of uncovered entities allowed. Default: undefined
  1461. */
  1462. coverageThreshold?: any;
  1463. errorOnDeprecated?: boolean;
  1464. forceCoverageMatch?: any[];
  1465. globals?: any;
  1466. globalSetup?: string;
  1467. globalTeardown?: string;
  1468. /**
  1469. * An array of directory names to be searched recursively up from the requiring module's location. Setting this option will
  1470. * override the default, if you wish to still search node_modules for packages include it along with any other
  1471. * options: ["node_modules", "bower_components"]. Default: ["node_modules"]
  1472. */
  1473. moduleDirectories?: string[];
  1474. /**
  1475. * An array of file extensions your modules use. If you require modules without specifying a file extension,
  1476. * these are the extensions Jest will look for. Default: ['ts', 'tsx', 'js', 'json']
  1477. */
  1478. moduleFileExtensions?: string[];
  1479. moduleNameMapper?: any;
  1480. modulePaths?: any[];
  1481. modulePathIgnorePatterns?: any[];
  1482. notify?: boolean;
  1483. notifyMode?: string;
  1484. preset?: string;
  1485. prettierPath?: string;
  1486. projects?: any;
  1487. reporters?: any;
  1488. resetMocks?: boolean;
  1489. resetModules?: boolean;
  1490. resolver?: string;
  1491. restoreMocks?: string;
  1492. rootDir?: string;
  1493. roots?: any[];
  1494. runner?: string;
  1495. /**
  1496. * The paths to modules that run some code to configure or set up the testing environment before each test.
  1497. * Since every test runs in its own environment, these scripts will be executed in the testing environment
  1498. * immediately before executing the test code itself. Default: []
  1499. */
  1500. setupFiles?: string[];
  1501. setupFilesAfterEnv?: string[];
  1502. snapshotSerializers?: any[];
  1503. testEnvironment?: string;
  1504. testEnvironmentOptions?: any;
  1505. testMatch?: string[];
  1506. testPathIgnorePatterns?: string[];
  1507. testPreset?: string;
  1508. testRegex?: string;
  1509. testResultsProcessor?: string;
  1510. testRunner?: string;
  1511. testURL?: string;
  1512. timers?: string;
  1513. transform?: {
  1514. [key: string]: string;
  1515. };
  1516. transformIgnorePatterns?: any[];
  1517. unmockedModulePathPatterns?: any[];
  1518. verbose?: boolean;
  1519. watchPathIgnorePatterns?: any[];
  1520. }
  1521. export interface TestingConfig extends JestConfig {
  1522. /**
  1523. * The `allowableMismatchedPixels` value is used to determine an acceptable
  1524. * number of pixels that can be mismatched before the image is considered
  1525. * to have changes. Realistically, two screenshots representing the same
  1526. * content may have a small number of pixels that are not identical due to
  1527. * anti-aliasing, which is perfectly normal. If the `allowableMismatchedRatio`
  1528. * is provided it will take precedence, otherwise `allowableMismatchedPixels`
  1529. * will be used.
  1530. */
  1531. allowableMismatchedPixels?: number;
  1532. /**
  1533. * The `allowableMismatchedRatio` ranges from `0` to `1` and is used to
  1534. * determine an acceptable ratio of pixels that can be mismatched before
  1535. * the image is considered to have changes. Realistically, two screenshots
  1536. * representing the same content may have a small number of pixels that
  1537. * are not identical due to anti-aliasing, which is perfectly normal. The
  1538. * `allowableMismatchedRatio` is the number of pixels that were mismatched,
  1539. * divided by the total number of pixels in the screenshot. For example,
  1540. * a ratio value of `0.06` means 6% of the pixels can be mismatched before
  1541. * the image is considered to have changes. If the `allowableMismatchedRatio`
  1542. * is provided it will take precedence, otherwise `allowableMismatchedPixels`
  1543. * will be used.
  1544. */
  1545. allowableMismatchedRatio?: number;
  1546. /**
  1547. * Matching threshold while comparing two screenshots. Value ranges from `0` to `1`.
  1548. * Smaller values make the comparison more sensitive. The `pixelmatchThreshold`
  1549. * value helps to ignore anti-aliasing. Default: `0.1`
  1550. */
  1551. pixelmatchThreshold?: number;
  1552. /**
  1553. * Additional arguments to pass to the browser instance.
  1554. */
  1555. browserArgs?: string[];
  1556. /**
  1557. * Path to a Chromium or Chrome executable to run instead of the bundled Chromium.
  1558. */
  1559. browserExecutablePath?: string;
  1560. /**
  1561. * Url of remote Chrome instance to use instead of local Chrome.
  1562. */
  1563. browserWSEndpoint?: string;
  1564. /**
  1565. * Whether to run browser e2e tests in headless mode. Defaults to true.
  1566. */
  1567. browserHeadless?: boolean;
  1568. /**
  1569. * Slows down e2e browser operations by the specified amount of milliseconds.
  1570. * Useful so that you can see what is going on.
  1571. */
  1572. browserSlowMo?: number;
  1573. /**
  1574. * By default, all E2E pages wait until the "load" event, this global setting can be used
  1575. * to change the default `waitUntil` behavior.
  1576. */
  1577. browserWaitUntil?: 'load' | 'domcontentloaded' | 'networkidle0' | 'networkidle2';
  1578. /**
  1579. * Whether to auto-open a DevTools panel for each tab.
  1580. * If this option is true, the headless option will be set false
  1581. */
  1582. browserDevtools?: boolean;
  1583. /**
  1584. * Array of browser emulations to be using during e2e tests. A full e2e
  1585. * test is ran for each emulation.
  1586. */
  1587. emulate?: EmulateConfig[];
  1588. /**
  1589. * Path to the Screenshot Connector module.
  1590. */
  1591. screenshotConnector?: string;
  1592. /**
  1593. * Amount of time in milliseconds to wait before a screenshot is taken.
  1594. */
  1595. waitBeforeScreenshot?: number;
  1596. }
  1597. export interface EmulateConfig {
  1598. /**
  1599. * Predefined device descriptor name, such as "iPhone X" or "Nexus 10".
  1600. * For a complete list please see: https://github.com/puppeteer/puppeteer/blob/main/src/common/DeviceDescriptors.ts
  1601. */
  1602. device?: string;
  1603. /**
  1604. * User-Agent to be used. Defaults to the user-agent of the installed Puppeteer version.
  1605. */
  1606. userAgent?: string;
  1607. viewport?: EmulateViewport;
  1608. }
  1609. export interface EmulateViewport {
  1610. /**
  1611. * Page width in pixels.
  1612. */
  1613. width: number;
  1614. /**
  1615. * page height in pixels.
  1616. */
  1617. height: number;
  1618. /**
  1619. * Specify device scale factor (can be thought of as dpr). Defaults to 1.
  1620. */
  1621. deviceScaleFactor?: number;
  1622. /**
  1623. * Whether the meta viewport tag is taken into account. Defaults to false.
  1624. */
  1625. isMobile?: boolean;
  1626. /**
  1627. * Specifies if viewport supports touch events. Defaults to false
  1628. */
  1629. hasTouch?: boolean;
  1630. /**
  1631. * Specifies if viewport is in landscape mode. Defaults to false.
  1632. */
  1633. isLandscape?: boolean;
  1634. }
  1635. /**
  1636. * This sets the log level hierarchy for our terminal logger, ranging from
  1637. * most to least verbose.
  1638. *
  1639. * Ordering the levels like this lets us easily check whether we should log a
  1640. * message at a given time. For instance, if the log level is set to `'warn'`,
  1641. * then anything passed to the logger with level `'warn'` or `'error'` should
  1642. * be logged, but we should _not_ log anything with level `'info'` or `'debug'`.
  1643. *
  1644. * If we have a current log level `currentLevel` and a message with level
  1645. * `msgLevel` is passed to the logger, we can determine whether or not we should
  1646. * log it by checking if the log level on the message is further up or at the
  1647. * same level in the hierarchy than `currentLevel`, like so:
  1648. *
  1649. * ```ts
  1650. * LOG_LEVELS.indexOf(msgLevel) >= LOG_LEVELS.indexOf(currentLevel)
  1651. * ```
  1652. *
  1653. * NOTE: for the reasons described above, do not change the order of the entries
  1654. * in this array without good reason!
  1655. */
  1656. export declare const LOG_LEVELS: readonly ["debug", "info", "warn", "error"];
  1657. export declare type LogLevel = typeof LOG_LEVELS[number];
  1658. /**
  1659. * Common logger to be used by the compiler, dev-server and CLI. The CLI will use a
  1660. * NodeJS based console logging and colors, and the web will use browser based
  1661. * logs and colors.
  1662. */
  1663. export interface Logger {
  1664. enableColors: (useColors: boolean) => void;
  1665. setLevel: (level: LogLevel) => void;
  1666. getLevel: () => LogLevel;
  1667. debug: (...msg: any[]) => void;
  1668. info: (...msg: any[]) => void;
  1669. warn: (...msg: any[]) => void;
  1670. error: (...msg: any[]) => void;
  1671. createTimeSpan: (startMsg: string, debug?: boolean, appendTo?: string[]) => LoggerTimeSpan;
  1672. printDiagnostics: (diagnostics: Diagnostic[], cwd?: string) => void;
  1673. red: (msg: string) => string;
  1674. green: (msg: string) => string;
  1675. yellow: (msg: string) => string;
  1676. blue: (msg: string) => string;
  1677. magenta: (msg: string) => string;
  1678. cyan: (msg: string) => string;
  1679. gray: (msg: string) => string;
  1680. bold: (msg: string) => string;
  1681. dim: (msg: string) => string;
  1682. bgRed: (msg: string) => string;
  1683. emoji: (e: string) => string;
  1684. setLogFilePath?: (p: string) => void;
  1685. writeLogs?: (append: boolean) => void;
  1686. createLineUpdater?: () => Promise<LoggerLineUpdater>;
  1687. }
  1688. export interface LoggerLineUpdater {
  1689. update(text: string): Promise<void>;
  1690. stop(): Promise<void>;
  1691. }
  1692. export interface LoggerTimeSpan {
  1693. duration(): number;
  1694. finish(finishedMsg: string, color?: string, bold?: boolean, newLineSuffix?: boolean): number;
  1695. }
  1696. export interface OutputTargetDist extends OutputTargetBase {
  1697. type: 'dist';
  1698. buildDir?: string;
  1699. dir?: string;
  1700. collectionDir?: string | null;
  1701. /**
  1702. * When `true` this flag will transform aliased import paths defined in
  1703. * a project's `tsconfig.json` to relative import paths in the compiled output's
  1704. * `dist-collection` bundle if it is generated (i.e. `collectionDir` is set).
  1705. *
  1706. * Paths will be left in aliased format if `false` or `undefined`.
  1707. *
  1708. * @example
  1709. * // tsconfig.json
  1710. * {
  1711. * paths: {
  1712. * "@utils/*": ['/src/utils/*']
  1713. * }
  1714. * }
  1715. *
  1716. * // Source file
  1717. * import * as dateUtils from '@utils/date-utils';
  1718. * // Output file
  1719. * import * as dateUtils from '../utils/date-utils';
  1720. */
  1721. transformAliasedImportPathsInCollection?: boolean | null;
  1722. typesDir?: string;
  1723. esmLoaderPath?: string;
  1724. copy?: CopyTask[];
  1725. polyfills?: boolean;
  1726. empty?: boolean;
  1727. }
  1728. export interface OutputTargetDistCollection extends OutputTargetBase {
  1729. type: 'dist-collection';
  1730. empty?: boolean;
  1731. dir: string;
  1732. collectionDir: string;
  1733. /**
  1734. * When `true` this flag will transform aliased import paths defined in
  1735. * a project's `tsconfig.json` to relative import paths in the compiled output.
  1736. *
  1737. * Paths will be left in aliased format if `false` or `undefined`.
  1738. *
  1739. * @example
  1740. * // tsconfig.json
  1741. * {
  1742. * paths: {
  1743. * "@utils/*": ['/src/utils/*']
  1744. * }
  1745. * }
  1746. *
  1747. * // Source file
  1748. * import * as dateUtils from '@utils/date-utils';
  1749. * // Output file
  1750. * import * as dateUtils from '../utils/date-utils';
  1751. */
  1752. transformAliasedImportPaths?: boolean | null;
  1753. }
  1754. export interface OutputTargetDistTypes extends OutputTargetBase {
  1755. type: 'dist-types';
  1756. dir: string;
  1757. typesDir: string;
  1758. }
  1759. export interface OutputTargetDistLazy extends OutputTargetBase {
  1760. type: 'dist-lazy';
  1761. dir?: string;
  1762. esmDir?: string;
  1763. esmEs5Dir?: string;
  1764. systemDir?: string;
  1765. cjsDir?: string;
  1766. polyfills?: boolean;
  1767. isBrowserBuild?: boolean;
  1768. esmIndexFile?: string;
  1769. cjsIndexFile?: string;
  1770. systemLoaderFile?: string;
  1771. legacyLoaderFile?: string;
  1772. empty?: boolean;
  1773. }
  1774. export interface OutputTargetDistGlobalStyles extends OutputTargetBase {
  1775. type: 'dist-global-styles';
  1776. file: string;
  1777. }
  1778. export interface OutputTargetDistLazyLoader extends OutputTargetBase {
  1779. type: 'dist-lazy-loader';
  1780. dir: string;
  1781. esmDir: string;
  1782. esmEs5Dir?: string;
  1783. cjsDir: string;
  1784. componentDts: string;
  1785. empty: boolean;
  1786. }
  1787. export interface OutputTargetHydrate extends OutputTargetBase {
  1788. type: 'dist-hydrate-script';
  1789. dir?: string;
  1790. /**
  1791. * Module IDs that should not be bundled into the script.
  1792. * By default, all node builtin's, such as `fs` or `path`
  1793. * will be considered "external" and not bundled.
  1794. */
  1795. external?: string[];
  1796. empty?: boolean;
  1797. }
  1798. export interface OutputTargetCustom extends OutputTargetBase {
  1799. type: 'custom';
  1800. name: string;
  1801. validate?: (config: Config, diagnostics: Diagnostic[]) => void;
  1802. generator: (config: Config, compilerCtx: any, buildCtx: any, docs: any) => Promise<void>;
  1803. copy?: CopyTask[];
  1804. }
  1805. /**
  1806. * Output target for generating [custom data](https://github.com/microsoft/vscode-custom-data) for VS Code as a JSON
  1807. * file.
  1808. */
  1809. export interface OutputTargetDocsVscode extends OutputTargetBase {
  1810. /**
  1811. * Designates this output target to be used for generating VS Code custom data.
  1812. * @see OutputTargetBase#type
  1813. */
  1814. type: 'docs-vscode';
  1815. /**
  1816. * The location on disk to write the JSON file.
  1817. */
  1818. file: string;
  1819. /**
  1820. * A base URL to find the source code of the component(s) described in the JSON file.
  1821. */
  1822. sourceCodeBaseUrl?: string;
  1823. }
  1824. export interface OutputTargetDocsReadme extends OutputTargetBase {
  1825. type: 'docs-readme';
  1826. dir?: string;
  1827. dependencies?: boolean;
  1828. footer?: string;
  1829. strict?: boolean;
  1830. }
  1831. export interface OutputTargetDocsJson extends OutputTargetBase {
  1832. type: 'docs-json';
  1833. file: string;
  1834. typesFile?: string | null;
  1835. strict?: boolean;
  1836. }
  1837. export interface OutputTargetDocsCustom extends OutputTargetBase {
  1838. type: 'docs-custom';
  1839. generator: (docs: JsonDocs, config: Config) => void | Promise<void>;
  1840. strict?: boolean;
  1841. }
  1842. export interface OutputTargetStats extends OutputTargetBase {
  1843. type: 'stats';
  1844. file?: string;
  1845. }
  1846. export interface OutputTargetBaseNext {
  1847. type: string;
  1848. dir?: string;
  1849. }
  1850. export interface OutputTargetDistCustomElements extends OutputTargetBaseNext {
  1851. type: 'dist-custom-elements';
  1852. empty?: boolean;
  1853. externalRuntime?: boolean;
  1854. copy?: CopyTask[];
  1855. inlineDynamicImports?: boolean;
  1856. includeGlobalScripts?: boolean;
  1857. minify?: boolean;
  1858. /**
  1859. * Enables the auto-definition of a component and its children (recursively) in the custom elements registry. This
  1860. * functionality allows consumers to bypass the explicit call to define a component, its children, its children's
  1861. * children, etc. Users of this flag should be aware that enabling this functionality may increase bundle size.
  1862. */
  1863. autoDefineCustomElements?: boolean;
  1864. /**
  1865. * Enables the generation of type definition files for the output target.
  1866. */
  1867. generateTypeDeclarations?: boolean;
  1868. }
  1869. export interface OutputTargetDistCustomElementsBundle extends OutputTargetBaseNext {
  1870. type: 'dist-custom-elements-bundle';
  1871. empty?: boolean;
  1872. externalRuntime?: boolean;
  1873. copy?: CopyTask[];
  1874. inlineDynamicImports?: boolean;
  1875. includeGlobalScripts?: boolean;
  1876. minify?: boolean;
  1877. }
  1878. /**
  1879. * The base type for output targets. All output targets should extend this base type.
  1880. */
  1881. export interface OutputTargetBase {
  1882. /**
  1883. * A unique string to differentiate one output target from another
  1884. */
  1885. type: string;
  1886. }
  1887. export declare type OutputTargetBuild = OutputTargetDistCollection | OutputTargetDistLazy;
  1888. export interface OutputTargetAngular extends OutputTargetBase {
  1889. type: 'angular';
  1890. componentCorePackage: string;
  1891. directivesProxyFile?: string;
  1892. directivesArrayFile?: string;
  1893. directivesUtilsFile?: string;
  1894. excludeComponents?: string[];
  1895. }
  1896. export interface OutputTargetCopy extends OutputTargetBase {
  1897. type: 'copy';
  1898. dir: string;
  1899. copy?: CopyTask[];
  1900. copyAssets?: 'collection' | 'dist';
  1901. }
  1902. export interface OutputTargetWww extends OutputTargetBase {
  1903. /**
  1904. * Webapp output target.
  1905. */
  1906. type: 'www';
  1907. /**
  1908. * The directory to write the app's JavaScript and CSS build
  1909. * files to. The default is to place this directory as a child
  1910. * to the `dir` config. Default: `build`
  1911. */
  1912. buildDir?: string;
  1913. /**
  1914. * The directory to write the entire application to.
  1915. * Note, the `buildDir` is where the app's JavaScript and CSS build
  1916. * files are written. Default: `www`
  1917. */
  1918. dir?: string;
  1919. /**
  1920. * Empty the build directory of all files and directories on first build.
  1921. * Default: `true`
  1922. */
  1923. empty?: boolean;
  1924. /**
  1925. * The default index html file of the app, commonly found at the
  1926. * root of the `src` directory.
  1927. * Default: `index.html`
  1928. */
  1929. indexHtml?: string;
  1930. /**
  1931. * The copy config is an array of objects that defines any files or folders that should
  1932. * be copied over to the build directory.
  1933. *
  1934. * Each object in the array must include a src property which can be either an absolute path,
  1935. * a relative path or a glob pattern. The config can also provide an optional dest property
  1936. * which can be either an absolute path or a path relative to the build directory.
  1937. * Also note that any files within src/assets are automatically copied to www/assets for convenience.
  1938. *
  1939. * In the copy config below, it will copy the entire directory from src/docs-content over to www/docs-content.
  1940. */
  1941. copy?: CopyTask[];
  1942. /**
  1943. * The base url of the app, it's required during prerendering to be the absolute path
  1944. * of your app, such as: `https://my.app.com/app`.
  1945. *
  1946. * Default: `/`
  1947. */
  1948. baseUrl?: string;
  1949. /**
  1950. * By default, stencil will include all the polyfills required by legacy browsers in the ES5 build.
  1951. * If it's `false`, stencil will not emit this polyfills anymore and it's your responsibility to provide them before
  1952. * stencil initializes.
  1953. */
  1954. polyfills?: boolean;
  1955. /**
  1956. * Path to an external node module which has exports of the prerender config object.
  1957. * ```
  1958. * module.exports = {
  1959. * afterHydrate(document, url) {
  1960. * document.title = `URL: ${url.href}`;
  1961. * }
  1962. * }
  1963. * ```
  1964. */
  1965. prerenderConfig?: string;
  1966. /**
  1967. * Service worker config for production builds. During development builds
  1968. * service worker script will be injected to automatically unregister existing
  1969. * service workers. When set to `false` neither a service worker registration
  1970. * or unregistration will be added to the index.html.
  1971. */
  1972. serviceWorker?: ServiceWorkerConfig | null | false;
  1973. appDir?: string;
  1974. }
  1975. export declare type OutputTarget = OutputTargetAngular | OutputTargetCopy | OutputTargetCustom | OutputTargetDist | OutputTargetDistCollection | OutputTargetDistCustomElements | OutputTargetDistCustomElementsBundle | OutputTargetDistLazy | OutputTargetDistGlobalStyles | OutputTargetDistLazyLoader | OutputTargetDocsJson | OutputTargetDocsCustom | OutputTargetDocsReadme | OutputTargetDocsVscode | OutputTargetWww | OutputTargetHydrate | OutputTargetStats | OutputTargetDistTypes;
  1976. export interface ServiceWorkerConfig {
  1977. unregister?: boolean;
  1978. swDest?: string;
  1979. swSrc?: string;
  1980. globPatterns?: string[];
  1981. globDirectory?: string | string[];
  1982. globIgnores?: string | string[];
  1983. templatedUrls?: any;
  1984. maximumFileSizeToCacheInBytes?: number;
  1985. manifestTransforms?: any;
  1986. modifyUrlPrefix?: any;
  1987. dontCacheBustURLsMatching?: RegExp;
  1988. navigateFallback?: string;
  1989. navigateFallbackWhitelist?: RegExp[];
  1990. navigateFallbackBlacklist?: RegExp[];
  1991. cacheId?: string;
  1992. skipWaiting?: boolean;
  1993. clientsClaim?: boolean;
  1994. directoryIndex?: string;
  1995. runtimeCaching?: any[];
  1996. ignoreUrlParametersMatching?: any[];
  1997. handleFetch?: boolean;
  1998. }
  1999. export interface LoadConfigInit {
  2000. /**
  2001. * User config object to merge into default config and
  2002. * config loaded from a file path.
  2003. */
  2004. config?: UnvalidatedConfig;
  2005. /**
  2006. * Absolute path to a Stencil config file. This path cannot be
  2007. * relative and it does not resolve config files within a directory.
  2008. */
  2009. configPath?: string;
  2010. logger?: Logger;
  2011. sys?: CompilerSystem;
  2012. /**
  2013. * When set to true, if the "tsconfig.json" file is not found
  2014. * it'll automatically generate and save a default tsconfig
  2015. * within the root directory.
  2016. */
  2017. initTsConfig?: boolean;
  2018. }
  2019. /**
  2020. * Results from an attempt to load a config. The values on this interface
  2021. * have not yet been validated and are not ready to be used for arbitrary
  2022. * operations around the codebase.
  2023. */
  2024. export interface LoadConfigResults {
  2025. config: ValidatedConfig;
  2026. diagnostics: Diagnostic[];
  2027. tsconfig: {
  2028. path: string;
  2029. compilerOptions: any;
  2030. files: string[];
  2031. include: string[];
  2032. exclude: string[];
  2033. extends: string;
  2034. };
  2035. }
  2036. export interface Diagnostic {
  2037. level: 'error' | 'warn' | 'info' | 'log' | 'debug';
  2038. type: string;
  2039. header?: string;
  2040. language?: string;
  2041. messageText: string;
  2042. debugText?: string;
  2043. code?: string;
  2044. absFilePath?: string;
  2045. relFilePath?: string;
  2046. lineNumber?: number;
  2047. columnNumber?: number;
  2048. lines?: {
  2049. lineIndex: number;
  2050. lineNumber: number;
  2051. text?: string;
  2052. errorCharStart: number;
  2053. errorLength?: number;
  2054. }[];
  2055. }
  2056. export interface CacheStorage {
  2057. get(key: string): Promise<any>;
  2058. set(key: string, value: any): Promise<void>;
  2059. }
  2060. export interface WorkerOptions {
  2061. maxConcurrentWorkers?: number;
  2062. maxConcurrentTasksPerWorker?: number;
  2063. logger?: Logger;
  2064. }
  2065. export interface RollupInterface {
  2066. rollup: {
  2067. (config: any): Promise<any>;
  2068. };
  2069. plugins: {
  2070. nodeResolve(opts: any): any;
  2071. replace(opts: any): any;
  2072. commonjs(opts: any): any;
  2073. json(): any;
  2074. };
  2075. }
  2076. export interface ResolveModuleOptions {
  2077. manuallyResolve?: boolean;
  2078. packageJson?: boolean;
  2079. }
  2080. export interface PrerenderStartOptions {
  2081. buildId?: string;
  2082. hydrateAppFilePath: string;
  2083. componentGraph: BuildResultsComponentGraph;
  2084. srcIndexHtmlPath: string;
  2085. }
  2086. export interface PrerenderResults {
  2087. buildId: string;
  2088. diagnostics: Diagnostic[];
  2089. urls: number;
  2090. duration: number;
  2091. average: number;
  2092. }
  2093. /**
  2094. * Input for CSS optimization functions, including the input CSS
  2095. * string and a few boolean options which turn on or off various
  2096. * optimizations.
  2097. */
  2098. export interface OptimizeCssInput {
  2099. input: string;
  2100. filePath?: string;
  2101. autoprefixer?: boolean | null | AutoprefixerOptions;
  2102. minify?: boolean;
  2103. sourceMap?: boolean;
  2104. resolveUrl?: (url: string) => Promise<string> | string;
  2105. }
  2106. /**
  2107. * This is not a real interface describing the options which can
  2108. * be passed to autoprefixer, for that see the docs, here:
  2109. * https://github.com/postcss/autoprefixer#options
  2110. *
  2111. * Instead, this basically just serves as a label type to track
  2112. * that arguments are being passed consistently.
  2113. */
  2114. export declare type AutoprefixerOptions = Object;
  2115. /**
  2116. * Output from CSS optimization functions, wrapping up optimized
  2117. * CSS and any diagnostics produced during optimization.
  2118. */
  2119. export interface OptimizeCssOutput {
  2120. output: string;
  2121. diagnostics: Diagnostic[];
  2122. }
  2123. export interface OptimizeJsInput {
  2124. input: string;
  2125. filePath?: string;
  2126. target?: 'es5' | 'latest';
  2127. pretty?: boolean;
  2128. sourceMap?: boolean;
  2129. }
  2130. export interface OptimizeJsOutput {
  2131. output: string;
  2132. sourceMap: any;
  2133. diagnostics: Diagnostic[];
  2134. }
  2135. export interface LazyRequire {
  2136. ensure(fromDir: string, moduleIds: string[]): Promise<Diagnostic[]>;
  2137. require(fromDir: string, moduleId: string): any;
  2138. getModulePath(fromDir: string, moduleId: string): string;
  2139. }
  2140. export interface FsWatcherItem {
  2141. close(): void;
  2142. }
  2143. export interface MakeDirectoryOptions {
  2144. /**
  2145. * Indicates whether parent folders should be created.
  2146. * @default false
  2147. */
  2148. recursive?: boolean;
  2149. /**
  2150. * A file mode. If a string is passed, it is parsed as an octal integer. If not specified
  2151. * @default 0o777.
  2152. */
  2153. mode?: number;
  2154. }
  2155. export interface FsStats {
  2156. isFile(): boolean;
  2157. isDirectory(): boolean;
  2158. isBlockDevice(): boolean;
  2159. isCharacterDevice(): boolean;
  2160. isSymbolicLink(): boolean;
  2161. isFIFO(): boolean;
  2162. isSocket(): boolean;
  2163. dev: number;
  2164. ino: number;
  2165. mode: number;
  2166. nlink: number;
  2167. uid: number;
  2168. gid: number;
  2169. rdev: number;
  2170. size: number;
  2171. blksize: number;
  2172. blocks: number;
  2173. atime: Date;
  2174. mtime: Date;
  2175. ctime: Date;
  2176. birthtime: Date;
  2177. }
  2178. export interface Compiler {
  2179. build(): Promise<CompilerBuildResults>;
  2180. createWatcher(): Promise<CompilerWatcher>;
  2181. destroy(): Promise<void>;
  2182. sys: CompilerSystem;
  2183. }
  2184. export interface CompilerWatcher extends BuildOnEvents {
  2185. start: () => Promise<WatcherCloseResults>;
  2186. close: () => Promise<WatcherCloseResults>;
  2187. request: (data: CompilerRequest) => Promise<CompilerRequestResponse>;
  2188. }
  2189. export interface CompilerRequest {
  2190. path?: string;
  2191. }
  2192. export interface WatcherCloseResults {
  2193. exitCode: number;
  2194. }
  2195. export interface CompilerRequestResponse {
  2196. path: string;
  2197. nodeModuleId: string;
  2198. nodeModuleVersion: string;
  2199. nodeResolvedPath: string;
  2200. cachePath: string;
  2201. cacheHit: boolean;
  2202. content: string;
  2203. status: number;
  2204. }
  2205. export interface TranspileOptions {
  2206. /**
  2207. * A component can be defined as a custom element by using `customelement`, or the
  2208. * component class can be exported by using `module`. Default is `customelement`.
  2209. */
  2210. componentExport?: 'customelement' | 'module' | string | undefined;
  2211. /**
  2212. * Sets how and if component metadata should be assigned on the compiled
  2213. * component output. The `compilerstatic` value will set the metadata to
  2214. * a static `COMPILER_META` getter on the component class. This option
  2215. * is useful for unit testing preprocessors. Default is `null`.
  2216. */
  2217. componentMetadata?: 'runtimestatic' | 'compilerstatic' | string | undefined;
  2218. /**
  2219. * The actual internal import path for any `@stencil/core` imports.
  2220. * Default is `@stencil/core/internal/client`.
  2221. */
  2222. coreImportPath?: string;
  2223. /**
  2224. * The current working directory. Default is `/`.
  2225. */
  2226. currentDirectory?: string;
  2227. /**
  2228. * The filename of the code being compiled. Default is `module.tsx`.
  2229. */
  2230. file?: string;
  2231. /**
  2232. * Module format to use for the compiled code output, which can be either `esm` or `cjs`.
  2233. * Default is `esm`.
  2234. */
  2235. module?: 'cjs' | 'esm' | string;
  2236. /**
  2237. * Sets how and if any properties, methods and events are proxied on the
  2238. * component class. The `defineproperty` value sets the getters and setters
  2239. * using Object.defineProperty. Default is `defineproperty`.
  2240. */
  2241. proxy?: 'defineproperty' | string | undefined;
  2242. /**
  2243. * How component styles should be associated to the component. The `static`
  2244. * setting will assign the styles as a static getter on the component class.
  2245. */
  2246. style?: 'static' | string | undefined;
  2247. /**
  2248. * How style data should be added for imports. For example, the `queryparams` value
  2249. * adds the component's tagname and encapsulation info as querystring parameter
  2250. * to the style's import, such as `style.css?tag=my-tag&encapsulation=shadow`. This
  2251. * style data can be used by bundlers to further optimize each component's css.
  2252. * Set to `null` to not include the querystring parameters. Default is `queryparams`.
  2253. */
  2254. styleImportData?: 'queryparams' | string | undefined;
  2255. /**
  2256. * The JavaScript source target TypeScript should to transpile to. Values can be
  2257. * `latest`, `esnext`, `es2017`, `es2015`, or `es5`. Defaults to `latest`.
  2258. */
  2259. target?: CompileTarget;
  2260. /**
  2261. * Create a source map. Using `inline` will inline the source map into the
  2262. * code, otherwise the source map will be in the returned `map` property.
  2263. * Default is `true`.
  2264. */
  2265. sourceMap?: boolean | 'inline';
  2266. /**
  2267. * Base directory to resolve non-relative module names. Same as the `baseUrl`
  2268. * TypeScript compiler option: https://www.typescriptlang.org/docs/handbook/module-resolution.html#path-mapping
  2269. */
  2270. baseUrl?: string;
  2271. /**
  2272. * List of path mapping entries for module names to locations relative to the `baseUrl`.
  2273. * Same as the `paths` TypeScript compiler option:
  2274. * https://www.typescriptlang.org/docs/handbook/module-resolution.html#path-mapping
  2275. */
  2276. paths?: {
  2277. [key: string]: string[];
  2278. };
  2279. /**
  2280. * Passed in Stencil Compiler System, otherwise falls back to the internal in-memory only system.
  2281. */
  2282. sys?: CompilerSystem;
  2283. }
  2284. export declare type CompileTarget = 'latest' | 'esnext' | 'es2020' | 'es2019' | 'es2018' | 'es2017' | 'es2015' | 'es5' | string | undefined;
  2285. export interface TranspileResults {
  2286. code: string;
  2287. data?: any[];
  2288. diagnostics: Diagnostic[];
  2289. imports?: {
  2290. path: string;
  2291. }[];
  2292. inputFileExtension: string;
  2293. inputFilePath: string;
  2294. map: any;
  2295. outputFilePath: string;
  2296. }
  2297. export interface TransformOptions {
  2298. coreImportPath: string;
  2299. componentExport: 'lazy' | 'module' | 'customelement' | null;
  2300. componentMetadata: 'runtimestatic' | 'compilerstatic' | null;
  2301. currentDirectory: string;
  2302. file?: string;
  2303. isolatedModules?: boolean;
  2304. module?: 'cjs' | 'esm';
  2305. proxy: 'defineproperty' | null;
  2306. style: 'static' | null;
  2307. styleImportData: 'queryparams' | null;
  2308. target?: string;
  2309. }
  2310. export interface CompileScriptMinifyOptions {
  2311. target?: CompileTarget;
  2312. pretty?: boolean;
  2313. }
  2314. export interface DevServer extends BuildEmitEvents {
  2315. address: string;
  2316. basePath: string;
  2317. browserUrl: string;
  2318. protocol: string;
  2319. port: number;
  2320. root: string;
  2321. close(): Promise<void>;
  2322. }
  2323. export interface CliInitOptions {
  2324. args: string[];
  2325. logger: Logger;
  2326. sys: CompilerSystem;
  2327. }