@stencil/core 2.16.1 → 2.17.2-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/cli/config-flags.d.ts +110 -0
  2. package/cli/index.cjs +710 -225
  3. package/cli/index.d.ts +2 -1
  4. package/cli/index.js +710 -225
  5. package/cli/package.json +1 -1
  6. package/compiler/package.json +1 -1
  7. package/compiler/stencil.js +905 -290
  8. package/compiler/stencil.min.js +2 -2
  9. package/dependencies.json +1 -1
  10. package/dev-server/client/index.js +1 -1
  11. package/dev-server/client/package.json +1 -1
  12. package/dev-server/connector.html +2 -2
  13. package/dev-server/index.js +1 -1
  14. package/dev-server/package.json +1 -1
  15. package/dev-server/server-process.js +2 -2
  16. package/internal/app-data/package.json +1 -1
  17. package/internal/client/css-shim.js +1 -1
  18. package/internal/client/dom.js +1 -1
  19. package/internal/client/index.js +11 -6
  20. package/internal/client/package.json +1 -1
  21. package/internal/client/patch-browser.js +1 -1
  22. package/internal/client/patch-esm.js +1 -1
  23. package/internal/client/shadow-css.js +1 -1
  24. package/internal/hydrate/index.js +2 -2
  25. package/internal/hydrate/package.json +1 -1
  26. package/internal/package.json +1 -1
  27. package/internal/stencil-private.d.ts +6 -2
  28. package/internal/stencil-public-compiler.d.ts +67 -48
  29. package/internal/testing/index.js +1 -1
  30. package/internal/testing/package.json +1 -1
  31. package/mock-doc/index.cjs +163 -5
  32. package/mock-doc/index.d.ts +86 -1
  33. package/mock-doc/index.js +163 -5
  34. package/mock-doc/package.json +1 -1
  35. package/package.json +2 -1
  36. package/screenshot/package.json +1 -1
  37. package/sys/node/index.js +325 -314
  38. package/sys/node/package.json +1 -1
  39. package/sys/node/worker.js +1 -1
  40. package/testing/index.d.ts +1 -1
  41. package/testing/index.js +445 -382
  42. package/testing/jest/jest-config.d.ts +1 -1
  43. package/testing/jest/jest-runner.d.ts +3 -2
  44. package/testing/jest/jest-screenshot.d.ts +1 -1
  45. package/testing/mocks.d.ts +48 -3
  46. package/testing/package.json +1 -1
  47. package/testing/puppeteer/puppeteer-browser.d.ts +2 -2
  48. package/testing/test/testing-utils.spec.d.ts +1 -0
  49. package/testing/testing-utils.d.ts +74 -2
  50. package/testing/testing.d.ts +2 -2
@@ -0,0 +1,110 @@
1
+ import type { LogLevel, TaskCommand } from '../internal/index';
2
+ /**
3
+ * All the Boolean options supported by the Stencil CLI
4
+ */
5
+ export declare const BOOLEAN_CLI_ARGS: readonly ["build", "cache", "checkVersion", "ci", "compare", "debug", "dev", "devtools", "docs", "e2e", "es5", "esm", "headless", "help", "log", "open", "prerender", "prerenderExternal", "prod", "profile", "serviceWorker", "screenshot", "serve", "skipNodeCheck", "spec", "ssr", "stats", "updateScreenshot", "verbose", "version", "watch", "all", "automock", "bail", "changedFilesWithAncestor", "clearCache", "clearMocks", "collectCoverage", "color", "colors", "coverage", "detectLeaks", "detectOpenHandles", "errorOnDeprecated", "expand", "findRelatedTests", "forceExit", "init", "injectGlobals", "json", "lastCommit", "listTests", "logHeapUsage", "noStackTrace", "notify", "onlyChanged", "onlyFailures", "passWithNoTests", "resetMocks", "resetModules", "restoreMocks", "runInBand", "runTestsByPath", "showConfig", "silent", "skipFilter", "testLocationInResults", "updateSnapshot", "useStderr", "watchAll", "watchman"];
6
+ /**
7
+ * All the Number options supported by the Stencil CLI
8
+ */
9
+ export declare const NUMBER_CLI_ARGS: readonly ["port", "maxConcurrency", "testTimeout"];
10
+ /**
11
+ * All the String options supported by the Stencil CLI
12
+ */
13
+ export declare const STRING_CLI_ARGS: readonly ["address", "config", "docsApi", "docsJson", "emulate", "root", "screenshotConnector", "cacheDirectory", "changedSince", "collectCoverageFrom", "coverageDirectory", "coverageThreshold", "env", "filter", "globalSetup", "globalTeardown", "globals", "haste", "moduleNameMapper", "notifyMode", "outputFile", "preset", "prettierPath", "resolver", "rootDir", "runner", "testEnvironment", "testEnvironmentOptions", "testFailureExitCode", "testNamePattern", "testResultsProcessor", "testRunner", "testSequencer", "testURL", "timers", "transform", "collectCoverageOnlyFrom", "coveragePathIgnorePatterns", "coverageReporters", "moduleDirectories", "moduleFileExtensions", "modulePathIgnorePatterns", "modulePaths", "projects", "reporters", "roots", "selectProjects", "setupFiles", "setupFilesAfterEnv", "snapshotSerializers", "testMatch", "testPathIgnorePatterns", "testPathPattern", "testRegex", "transformIgnorePatterns", "unmockedModulePathPatterns", "watchPathIgnorePatterns"];
14
+ /**
15
+ * All the CLI arguments which may have string or number values
16
+ *
17
+ * `maxWorkers` is an argument which is used both by Stencil _and_ by Jest,
18
+ * which means that we need to support parsing both string and number values.
19
+ */
20
+ export declare const STRING_NUMBER_CLI_ARGS: readonly ["maxWorkers"];
21
+ /**
22
+ * All the LogLevel-type options supported by the Stencil CLI
23
+ *
24
+ * This is a bit silly since there's only one such argument atm,
25
+ * but this approach lets us make sure that we're handling all
26
+ * our arguments in a type-safe way.
27
+ */
28
+ export declare const LOG_LEVEL_CLI_ARGS: readonly ["logLevel"];
29
+ /**
30
+ * A type which gives the members of a `ReadonlyArray<string>` as
31
+ * an enum-like type which can be used for e.g. keys in a `Record`
32
+ * (as in the `AliasMap` type below)
33
+ */
34
+ declare type ArrayValuesAsUnion<T extends ReadonlyArray<string>> = T[number];
35
+ export declare type BooleanCLIArg = ArrayValuesAsUnion<typeof BOOLEAN_CLI_ARGS>;
36
+ export declare type StringCLIArg = ArrayValuesAsUnion<typeof STRING_CLI_ARGS>;
37
+ export declare type NumberCLIArg = ArrayValuesAsUnion<typeof NUMBER_CLI_ARGS>;
38
+ export declare type StringNumberCLIArg = ArrayValuesAsUnion<typeof STRING_NUMBER_CLI_ARGS>;
39
+ export declare type LogCLIArg = ArrayValuesAsUnion<typeof LOG_LEVEL_CLI_ARGS>;
40
+ declare type KnownCLIArg = BooleanCLIArg | StringCLIArg | NumberCLIArg | StringNumberCLIArg | LogCLIArg;
41
+ declare type AliasMap = Partial<Record<KnownCLIArg, string>>;
42
+ /**
43
+ * For a small subset of CLI options we support a short alias e.g. `'h'` for `'help'`
44
+ */
45
+ export declare const CLI_ARG_ALIASES: AliasMap;
46
+ /**
47
+ * Given two types `K` and `T` where `K` extends `ReadonlyArray<string>`,
48
+ * construct a type which maps the strings in `K` as keys to values of type `T`.
49
+ *
50
+ * Because we use types derived this way to construct an interface (`ConfigFlags`)
51
+ * for which we want optional keys, we make all the properties optional (w/ `'?'`)
52
+ * and possibly null.
53
+ */
54
+ declare type ObjectFromKeys<K extends ReadonlyArray<string>, T> = {
55
+ [key in K[number]]?: T | null;
56
+ };
57
+ /**
58
+ * Type containing the possible Boolean configuration flags, to be included
59
+ * in ConfigFlags, below
60
+ */
61
+ declare type BooleanConfigFlags = ObjectFromKeys<typeof BOOLEAN_CLI_ARGS, boolean>;
62
+ /**
63
+ * Type containing the possible String configuration flags, to be included
64
+ * in ConfigFlags, below
65
+ */
66
+ declare type StringConfigFlags = ObjectFromKeys<typeof STRING_CLI_ARGS, string>;
67
+ /**
68
+ * Type containing the possible numeric configuration flags, to be included
69
+ * in ConfigFlags, below
70
+ */
71
+ declare type NumberConfigFlags = ObjectFromKeys<typeof NUMBER_CLI_ARGS, number>;
72
+ /**
73
+ * Type containing the configuration flags which may be set to either string
74
+ * or number values.
75
+ */
76
+ declare type StringNumberConfigFlags = ObjectFromKeys<typeof STRING_NUMBER_CLI_ARGS, string | number>;
77
+ /**
78
+ * Type containing the possible LogLevel configuration flags, to be included
79
+ * in ConfigFlags, below
80
+ */
81
+ declare type LogLevelFlags = ObjectFromKeys<typeof LOG_LEVEL_CLI_ARGS, LogLevel>;
82
+ /**
83
+ * The configuration flags which can be set by the user on the command line.
84
+ * This interface captures both known arguments (which are enumerated and then
85
+ * parsed according to their types) and unknown arguments which the user may
86
+ * pass at the CLI.
87
+ *
88
+ * Note that this interface is constructed by extending `BooleanConfigFlags`,
89
+ * `StringConfigFlags`, etc. These types are in turn constructed from types
90
+ * extending `ReadonlyArray<string>` which we declare in another module. This
91
+ * allows us to record our known CLI arguments in one place, using a
92
+ * `ReadonlyArray<string>` to get both a type-level representation of what CLI
93
+ * options we support and a runtime list of strings which can be used to match
94
+ * on actual flags passed by the user.
95
+ */
96
+ export interface ConfigFlags extends BooleanConfigFlags, StringConfigFlags, NumberConfigFlags, StringNumberConfigFlags, LogLevelFlags {
97
+ task: TaskCommand | null;
98
+ args: string[];
99
+ knownArgs: string[];
100
+ unknownArgs: string[];
101
+ }
102
+ /**
103
+ * Helper function for initializing a `ConfigFlags` object. Provide any overrides
104
+ * for default values and off you go!
105
+ *
106
+ * @param init an object with any overrides for default values
107
+ * @returns a complete CLI flag object
108
+ */
109
+ export declare const createConfigFlags: (init?: Partial<ConfigFlags>) => ConfigFlags;
110
+ export {};