From b285da8b2a90a29e2249722c5fa233009a56c836 Mon Sep 17 00:00:00 2001 From: CJ Green <44074998+okaycj@users.noreply.github.com> Date: Thu, 10 Oct 2024 11:13:32 -0400 Subject: [PATCH 1/3] Update Rollup config to hide known circular dependency warnings. --- rollup.mjs | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/rollup.mjs b/rollup.mjs index a197283c..f727cecb 100644 --- a/rollup.mjs +++ b/rollup.mjs @@ -1,8 +1,51 @@ +/* eslint-disable func-style */ + import { makeRollupConfig as jsPsychMakeRollupConfig } from "@jspsych/config/rollup"; import { iifeNameData } from "./packages/data/rollup.config.mjs"; +/** + * Create rollup config for any package. + * + * @param iifeName - IIFE Name for this package + * @returns Rollup config + */ export function makeRollupConfig(iifeName) { const dataPackageName = "@lookit/data"; + + const knownCircularDeps = [ + "@smithy/util-stream/dist-es/blob/Uint8ArrayBlobAdapter.js", + "@smithy/util-endpoints/dist-es/utils/callFunction.js", + "@smithy/util-endpoints/dist-es/utils/getEndpointProperties.js", + "@smithy/util-endpoints/dist-es/utils/evaluateRules.js", + "@aws-crypto/crc32/build/module/index.js", + "@aws-crypto/crc32c/build/module/index.js", + ]; + + /** + * Change warnings into errors. This will help us catch build concerns before + * they are in production. Also, hide known circular dependency warnings. This is + * copied from Rollup's documentation: + * https://rollupjs.org/configuration-options/#onlog + * + * @param level - Message level + * @param log - Log object containing location, frame, and message. + * @param handler - Function called to record log. + */ + const onLog = (level, log, handler) => { + // Don't log known circular dependencies with the data package. + if (log.code === "CIRCULAR_DEPENDENCY" && iifeName === "chsData") { + if (knownCircularDeps.some((value) => log.message.includes(value))) { + return; + } + } + + if (level === "warn") { + handler("error", log); + } else { + handler(level, log); + } + }; + return jsPsychMakeRollupConfig(iifeName).map((config) => { return { ...config, @@ -18,6 +61,7 @@ export function makeRollupConfig(iifeName) { }, }; }), + onLog, }; }); } From 4a280e8524d4d74d51585ac29acc43ef32869557 Mon Sep 17 00:00:00 2001 From: CJ Green <44074998+okaycj@users.noreply.github.com> Date: Thu, 10 Oct 2024 11:19:26 -0400 Subject: [PATCH 2/3] Format fixes --- rollup.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rollup.mjs b/rollup.mjs index f727cecb..75df2211 100644 --- a/rollup.mjs +++ b/rollup.mjs @@ -23,8 +23,8 @@ export function makeRollupConfig(iifeName) { /** * Change warnings into errors. This will help us catch build concerns before - * they are in production. Also, hide known circular dependency warnings. This is - * copied from Rollup's documentation: + * they are in production. Also, hide known circular dependency warnings. This + * is copied from Rollup's documentation: * https://rollupjs.org/configuration-options/#onlog * * @param level - Message level From c1cf62baf4713bb35f435cc20ab3cf48e6aa5ec7 Mon Sep 17 00:00:00 2001 From: CJ Green <44074998+okaycj@users.noreply.github.com> Date: Thu, 10 Oct 2024 11:25:30 -0400 Subject: [PATCH 3/3] Add changeset file --- .changeset/nice-hats-sing.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 .changeset/nice-hats-sing.md diff --git a/.changeset/nice-hats-sing.md b/.changeset/nice-hats-sing.md new file mode 100644 index 00000000..99cea7dd --- /dev/null +++ b/.changeset/nice-hats-sing.md @@ -0,0 +1,9 @@ +--- +"@lookit/lookit-initjspsych": patch +"@lookit/surveys": patch +"@lookit/record": patch +"@lookit/style": patch +"@lookit/data": patch +--- + +Update rollup config to hide known circular warnings