day-9.mjs

January 3, 2022 ยท View on GitHub

/////////////////////////////////////////////////////////////////////////////// // Day 9 - Bundlers Hate This // // #region problem // /////////////////////////////////////////////////////////////////////////////// // Write code that will cause beforeExit to be called and complete before // // process.exit(1); that is at the start of the same Module evaluates. // ///////////////////////////////////////////////////////////////////////////////

// DO NOT ADD ANY CODE BEFORE THIS LINE process.exit(1);

async function beforeExit() { await import('data:text/javascript,process.exit(0)'); }

/////////////////////////////////////////////////////////////////////////////// // #endregion problem // ///////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////// // Test - Leave code after this alone // // #region test // ///////////////////////////////////////////////////////////////////////////////

// N/A, the process.exit(1); is the test.

/////////////////////////////////////////////////////////////////////////////// // #endregion test // ///////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////// // Hints - Encoded in ROT13 encoded // // #region hints // /////////////////////////////////////////////////////////////////////////////// // // // Fvzcyr: gur fbyhgvba erdhverf 2 zbqhyr fbhepr grkgf gb jbex. Ubcr lbh // // xabj ubvfgvat. // // // /////////////////////////////////////////////////////////////////////////////// // #endregion hints // ///////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////// // Use Cases // // #region uses // /////////////////////////////////////////////////////////////////////////////// // // // This workflow can allow the creation of "friendly" style modules that // // share private state safely by the gateway pattern. // // // /////////////////////////////////////////////////////////////////////////////// // #endregion uses // ///////////////////////////////////////////////////////////////////////////////