@jspsych/config 1.3.0 → 1.3.2

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 (3) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/package.json +3 -1
  3. package/rollup.js +18 -7
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @jspsych/config
2
2
 
3
+ ## 1.3.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`e3e9d903`](https://github.com/jspsych/jsPsych/commit/e3e9d903462663b694633cdf873accefda453961) Thanks [@bjoluc](https://github.com/bjoluc)! - Prevent rollup from relying on node internals in browser builds
8
+
9
+ ## 1.3.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [#2643](https://github.com/jspsych/jsPsych/pull/2643) [`dc005661`](https://github.com/jspsych/jsPsych/commit/dc005661420dcc5c8aec62651687fc9aeac5fb65) Thanks [@bjoluc](https://github.com/bjoluc)! - Include previously undefined `regeneratorRuntime` in the Babel build of the `jspsych` package
14
+
3
15
  ## 1.3.0
4
16
 
5
17
  ### Minor Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jspsych/config",
3
- "version": "1.3.0",
3
+ "version": "1.3.2",
4
4
  "description": "Shared (build) configuration for jsPsych packages",
5
5
  "type": "module",
6
6
  "exports": {
@@ -46,6 +46,7 @@
46
46
  "@rollup/plugin-commonjs": "22.0.0",
47
47
  "@rollup/plugin-json": "4.1.0",
48
48
  "@rollup/plugin-node-resolve": "13.3.0",
49
+ "@rollup/plugin-replace": "4.0.0",
49
50
  "@types/gulp": "4.0.9",
50
51
  "@types/jest": "27.5.1",
51
52
  "babel-preset-minify": "0.5.2",
@@ -59,6 +60,7 @@
59
60
  "jest": "28.1.0",
60
61
  "jest-environment-jsdom": "28.1.0",
61
62
  "merge-stream": "2.0.0",
63
+ "regenerator-runtime": "0.13.9",
62
64
  "rollup": "2.73.0",
63
65
  "rollup-plugin-terser": "7.0.2",
64
66
  "rollup-plugin-typescript2": "0.31.2",
package/rollup.js CHANGED
@@ -3,6 +3,7 @@ import { babel } from "@rollup/plugin-babel";
3
3
  import commonjs from "@rollup/plugin-commonjs";
4
4
  import json from "@rollup/plugin-json";
5
5
  import resolve from "@rollup/plugin-node-resolve";
6
+ import replace from "@rollup/plugin-replace";
6
7
  import { defineConfig } from "rollup";
7
8
  import { terser } from "rollup-plugin-terser";
8
9
  import typescript from "rollup-plugin-typescript2";
@@ -12,7 +13,7 @@ const makeConfig = ({
12
13
  outputOptions = {},
13
14
  globalOptions = {},
14
15
  iifeOutputOptions = {},
15
- nodeOnly = false,
16
+ isNodeOnlyBuild = false,
16
17
  }) => {
17
18
  const source = "src/index";
18
19
  const destination = "dist/index";
@@ -25,7 +26,7 @@ const makeConfig = ({
25
26
  const commonConfig = defineConfig({
26
27
  input: `${source}.ts`,
27
28
  plugins: [
28
- resolve(),
29
+ resolve({ preferBuiltins: isNodeOnlyBuild }),
29
30
  typescript({
30
31
  typescript: ts,
31
32
  tsconfigDefaults: {
@@ -61,7 +62,7 @@ const makeConfig = ({
61
62
  },
62
63
  ];
63
64
 
64
- if (!nodeOnly) {
65
+ if (!isNodeOnlyBuild) {
65
66
  output.push({
66
67
  // Build file to be used for tinkering in modern browsers
67
68
  file: `${destination}.browser.js`,
@@ -74,18 +75,28 @@ const makeConfig = ({
74
75
  // Non-babel builds
75
76
  const config = defineConfig([{ ...commonConfig, output }]);
76
77
 
77
- if (!nodeOnly) {
78
+ if (!isNodeOnlyBuild) {
78
79
  // Babel build
79
80
  config.push({
80
81
  ...commonConfig,
81
- plugins: commonConfig.plugins.concat(
82
+ plugins: [
83
+ // Import `regenerator-runtime` if requested:
84
+ replace({
85
+ values: {
86
+ "// __rollup-babel-import-regenerator-runtime__":
87
+ 'import "regenerator-runtime/runtime.js";',
88
+ },
89
+ delimiters: ["", ""],
90
+ preventAssignment: true,
91
+ }),
92
+ ...commonConfig.plugins,
82
93
  babel({
83
94
  babelHelpers: "bundled",
84
95
  extends: "@jspsych/config/babel",
85
96
  // https://github.com/ezolenko/rollup-plugin-typescript2#rollupplugin-babel
86
97
  extensions: [...babelDefaultExtensions, ".ts"],
87
- })
88
- ),
98
+ }),
99
+ ],
89
100
  output: [
90
101
  {
91
102
  // Minified production build file