@stencil/core 2.11.0-0 → 2.13.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 (46) hide show
  1. package/cli/index.cjs +20 -4
  2. package/cli/index.js +20 -4
  3. package/cli/package.json +1 -1
  4. package/compiler/package.json +1 -1
  5. package/compiler/stencil.js +211 -483
  6. package/compiler/stencil.min.js +2 -2
  7. package/dependencies.json +1 -1
  8. package/dev-server/client/index.js +1 -1
  9. package/dev-server/client/package.json +1 -1
  10. package/dev-server/connector.html +2 -2
  11. package/dev-server/index.js +1 -1
  12. package/dev-server/package.json +1 -1
  13. package/dev-server/server-process.js +2 -2
  14. package/internal/app-data/package.json +1 -1
  15. package/internal/client/css-shim.js +1 -1
  16. package/internal/client/dom.js +1 -1
  17. package/internal/client/index.js +11 -7
  18. package/internal/client/package.json +1 -1
  19. package/internal/client/patch-browser.js +1 -1
  20. package/internal/client/patch-esm.js +1 -1
  21. package/internal/client/shadow-css.js +1 -1
  22. package/internal/hydrate/index.js +2 -1
  23. package/internal/hydrate/package.json +1 -1
  24. package/internal/package.json +1 -1
  25. package/internal/stencil-public-compiler.d.ts +1 -1
  26. package/internal/stencil-public-runtime.d.ts +6 -4
  27. package/internal/testing/index.js +15 -13
  28. package/internal/testing/package.json +1 -1
  29. package/mock-doc/index.cjs +20 -2
  30. package/mock-doc/index.d.ts +1 -0
  31. package/mock-doc/index.js +20 -2
  32. package/mock-doc/package.json +1 -1
  33. package/package.json +6 -6
  34. package/readme.md +52 -85
  35. package/screenshot/package.json +1 -1
  36. package/sys/node/autoprefixer.js +2 -2
  37. package/sys/node/index.js +17 -16
  38. package/sys/node/package.json +1 -1
  39. package/sys/node/worker.js +1 -1
  40. package/testing/index.js +419 -390
  41. package/testing/jest/jest-config.d.ts +11 -0
  42. package/testing/jest/jest-environment.d.ts +1 -0
  43. package/testing/jest/jest-preprocessor.d.ts +56 -8
  44. package/testing/jest/jest-runner.d.ts +4 -0
  45. package/testing/jest-preset.js +5 -0
  46. package/testing/package.json +1 -1
@@ -1,5 +1,16 @@
1
1
  import type * as d from '@stencil/core/internal';
2
2
  import type { Config } from '@jest/types';
3
+ /**
4
+ * Builds the `argv` to be used when programmatically invoking the Jest CLI
5
+ * @param config the Stencil config to use while generating Jest CLI arguments
6
+ * @returns the arguments to pass to the Jest CLI, wrapped in an object
7
+ */
3
8
  export declare function buildJestArgv(config: d.Config): Config.Argv;
9
+ /**
10
+ * Generate a Jest run configuration to be used as a part of the `argv` passed to the Jest CLI when it is invoked
11
+ * programmatically
12
+ * @param config the Stencil config to use while generating Jest CLI arguments
13
+ * @returns the Jest Config to attach to the `argv` argument
14
+ */
4
15
  export declare function buildJestConfig(config: d.Config): string;
5
16
  export declare function getProjectListFromCLIArgs(config: d.Config, argv: Config.Argv): Config.Path[];
@@ -9,6 +9,7 @@ export declare function createJestPuppeteerEnvironment(): {
9
9
  newPuppeteerPage(): Promise<import("puppeteer").Page>;
10
10
  closeOpenPages(): Promise<void>;
11
11
  teardown(): Promise<void>;
12
+ getVmContext(): any;
12
13
  };
13
14
  [x: string]: any;
14
15
  };
@@ -1,11 +1,59 @@
1
+ declare type Jest26CacheKeyOptions = {
2
+ instrument: boolean;
3
+ rootDir: string;
4
+ };
5
+ declare type Jest26Config = {
6
+ instrument: boolean;
7
+ rootDir: string;
8
+ };
9
+ declare type Jest27TransformOptions = {
10
+ config: Jest26Config;
11
+ };
1
12
  export declare const jestPreprocessor: {
2
- process(sourceText: string, filePath: string, jestConfig: {
3
- rootDir: string;
4
- }): string;
5
- getCompilerOptions(rootDir: string): any;
6
- getCacheKey(code: string, filePath: string, jestConfigStr: string, transformOptions: {
7
- instrument: boolean;
8
- rootDir: string;
9
- }): string;
13
+ /**
14
+ * Transforms a file to CommonJS to be used by Jest. The API for `process` is described in the
15
+ * ["Writing custom transformers"](https://jestjs.io/docs/code-transformation#writing-custom-transformers)
16
+ * documentation on the jest site. Unfortunately, the URL is not versioned at the time of this writing. For
17
+ * reference, the v27.2 docs were referenced (the most recent available).
18
+ *
19
+ * This function attempts to support several versions of Jest (v23 through v27). Support for earlier versions of Jest
20
+ * will be removed in a future major version of Stencil.
21
+ *
22
+ * @param sourceText the contents of the source file
23
+ * @param sourcePath the path to the source file
24
+ * @param jestConfig the jest configuration when called by Jest 26 and lower. This parameter is folded into
25
+ * `transformOptions` when called by Jest 27+ as a top level `config` property. Calls to this function from Jest 27+
26
+ * will have a `Jest27TransformOptions` shape
27
+ * @param transformOptions an object containing the various transformation options. In Jest 27+ this parameter occurs
28
+ * third in this function signature (and no fourth parameter is formally accepted)
29
+ * @returns the transformed file contents if the file should be transformed. returns the original source otherwise
30
+ */
31
+ process(sourceText: string, sourcePath: string, jestConfig: Jest26Config | Jest27TransformOptions, transformOptions?: Jest26Config): string;
32
+ /**
33
+ * Generates a key used to cache the results of transforming a file. This helps avoid re-processing a file via the
34
+ * `transform` function unnecessarily (when no changes have occurred). The API for `getCacheKey` is described in the
35
+ * ["Writing custom transformers"](https://jestjs.io/docs/code-transformation#writing-custom-transformers)
36
+ * documentation on the jest site. Unfortunately, the URL is not versioned at the time of this writing. For
37
+ * reference, the v27.2 docs were referenced (the most recent available).
38
+ *
39
+ * This function attempts to support several versions of Jest (v23 through v27). Support for earlier versions of Jest
40
+ * will be removed in a future major version of Stencil.
41
+ *
42
+ * @param sourceText the contents of the source file
43
+ * @param sourcePath the path to the source file
44
+ * @param jestConfigStr a stringified version of the jest configuration when called by Jest 26 and lower. This
45
+ * parameter takes the shape of `transformOptions` when called by Jest 27+.
46
+ * @param transformOptions an object containing the various transformation options. In Jest 27+ this parameter occurs
47
+ * third in this function signature (and no fourth parameter is formally accepted)
48
+ * @returns the key to cache a file with
49
+ */
50
+ getCacheKey(sourceText: string, sourcePath: string, jestConfigStr: string | Jest27TransformOptions, transformOptions?: Jest26CacheKeyOptions): string;
10
51
  };
52
+ /**
53
+ * Determines if a file should be transformed prior to being consumed by Jest, based on the file name and its contents
54
+ * @param filePath the path of the file
55
+ * @param sourceText the contents of the file
56
+ * @returns `true` if the file should be transformed, `false` otherwise
57
+ */
11
58
  export declare function shouldTransform(filePath: string, sourceText: string): boolean;
59
+ export {};
@@ -1,5 +1,9 @@
1
1
  import type * as d from '@stencil/core/internal';
2
2
  export declare function runJest(config: d.Config, env: d.E2EProcessEnv): Promise<boolean>;
3
+ /**
4
+ * Creates a Stencil test runner
5
+ * @returns the test runner
6
+ */
3
7
  export declare function createTestRunner(): any;
4
8
  export declare function includeTestFile(testPath: string, env: d.E2EProcessEnv): boolean;
5
9
  export declare function getEmulateConfigs(testing: d.TestingConfig, flags: d.ConfigFlags): d.EmulateConfig[];
@@ -1,3 +1,8 @@
1
+ /**
2
+ * The path's declared below are relative. Specifically, they are relative to the location of this file after
3
+ * compilation of the Stencil compiler has completed. See `scripts/bundles/testing` for the location of this file
4
+ * following compilation.
5
+ */
1
6
  const path = require('path');
2
7
  const testingDir = __dirname;
3
8
  const rootDir = path.join(testingDir, '..');
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/testing",
3
- "version": "2.11.0-0",
3
+ "version": "2.13.0",
4
4
  "description": "Stencil testing suite.",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",