From f0f807e829d10d03a5490a0447a64b4e1e13e571 Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum Date: Tue, 30 Dec 2025 14:59:06 -0800 Subject: [PATCH] Drop support for default exports Closes #229 --- lib/index.mjs | 173 ------------------------------------ test/after-compile-test.mjs | 6 -- 2 files changed, 179 deletions(-) diff --git a/lib/index.mjs b/lib/index.mjs index 78c0c420..52aa52a0 100644 --- a/lib/index.mjs +++ b/lib/index.mjs @@ -40,176 +40,3 @@ export const TRUE = sass.TRUE; export const FALSE = sass.FALSE; export const NULL = sass.NULL; export const types = sass.types; - -let printedDefaultExportDeprecation = false; -function defaultExportDeprecation() { - if (printedDefaultExportDeprecation) return; - printedDefaultExportDeprecation = true; - console.error( - "`import sass from 'sass'` is deprecated.\n" + - "Please use `import * as sass from 'sass'` instead.", - ); -} - -export default { - get compile() { - defaultExportDeprecation(); - return sass.compile; - }, - get compileAsync() { - defaultExportDeprecation(); - return sass.compileAsync; - }, - get compileString() { - defaultExportDeprecation(); - return sass.compileString; - }, - get compileStringAsync() { - defaultExportDeprecation(); - return sass.compileStringAsync; - }, - get NodePackageImporter() { - defaultExportDeprecation(); - return sass.NodePackageImporter; - }, - get initAsyncCompiler() { - defaultExportDeprecation(); - return sass.initAsyncCompiler; - }, - get initCompiler() { - defaultExportDeprecation(); - return sass.initCompiler; - }, - get AsyncCompiler() { - defaultExportDeprecation(); - return sass.AsyncCompiler; - }, - get Compiler() { - defaultExportDeprecation(); - return sass.Compiler; - }, - get deprecations() { - defaultExportDeprecation(); - return sass.deprecations; - }, - get Version() { - defaultExportDeprecation(); - return sass.Version; - }, - get Logger() { - defaultExportDeprecation(); - return sass.Logger; - }, - get CalculationOperation() { - defaultExportDeprecation(); - return sass.CalculationOperation; - }, - get CalculationOperator() { - defaultExportDeprecation(); - return sass.CalculationOperator; - }, - get CalculationInterpolation() { - defaultExportDeprecation(); - return sass.CalculationInterpolation; - }, - get SassArgumentList() { - defaultExportDeprecation(); - return sass.SassArgumentList; - }, - get SassBoolean() { - defaultExportDeprecation(); - return sass.SassBoolean; - }, - get SassCalculation() { - defaultExportDeprecation(); - return sass.SassCalculation; - }, - get SassColor() { - defaultExportDeprecation(); - return sass.SassColor; - }, - get SassFunction() { - defaultExportDeprecation(); - return sass.SassFunction; - }, - get SassMixin() { - defaultExportDeprecation(); - return sass.SassMixin; - }, - get SassList() { - defaultExportDeprecation(); - return sass.SassList; - }, - get SassMap() { - defaultExportDeprecation(); - return sass.SassMap; - }, - get SassNumber() { - defaultExportDeprecation(); - return sass.SassNumber; - }, - get SassString() { - defaultExportDeprecation(); - return sass.SassString; - }, - get Value() { - defaultExportDeprecation(); - return sass.Value; - }, - get CustomFunction() { - defaultExportDeprecation(); - return sass.CustomFunction; - }, - get ListSeparator() { - defaultExportDeprecation(); - return sass.ListSeparator; - }, - get sassFalse() { - defaultExportDeprecation(); - return sass.sassFalse; - }, - get sassNull() { - defaultExportDeprecation(); - return sass.sassNull; - }, - get sassTrue() { - defaultExportDeprecation(); - return sass.sassTrue; - }, - get Exception() { - defaultExportDeprecation(); - return sass.Exception; - }, - get PromiseOr() { - defaultExportDeprecation(); - return sass.PromiseOr; - }, - get info() { - defaultExportDeprecation(); - return sass.info; - }, - get render() { - defaultExportDeprecation(); - return sass.render; - }, - get renderSync() { - defaultExportDeprecation(); - return sass.renderSync; - }, - get TRUE() { - defaultExportDeprecation(); - return sass.TRUE; - }, - get FALSE() { - defaultExportDeprecation(); - return sass.FALSE; - }, - get NULL() { - defaultExportDeprecation(); - return sass.NULL; - }, - get types() { - defaultExportDeprecation(); - return sass.types; - }, -}; diff --git a/test/after-compile-test.mjs b/test/after-compile-test.mjs index 94b3f477..553270ed 100644 --- a/test/after-compile-test.mjs +++ b/test/after-compile-test.mjs @@ -30,10 +30,4 @@ for (const [name, value] of Object.entries(cjs)) { } else if (esm[name] !== value) { throw new Error(`ESM ${name} isn't the same as CJS.`); } - - if (!esm.default[name]) { - throw new Error(`ESM default export is missing export ${name}.`); - } else if (esm.default[name] !== value) { - throw new Error(`ESM default export ${name} isn't the same as CJS.`); - } }