@@ -8448,3 +8448,87 @@ NOTE: You can mark the path "bar" as external to exclude it from the bundle, whi
84488448` ,
84498449 })
84508450}
8451+
8452+ func TestDecoratorPrintingESM (t * testing.T ) {
8453+ default_suite .expectBundled (t , bundled {
8454+ files : map [string ]string {
8455+ "/entry.js" : `
8456+ import { constant } from './constants'
8457+ import { imported } from 'somewhere'
8458+ import { undef } from './empty'
8459+
8460+ _ = class Outer {
8461+ #bar;
8462+
8463+ classes = [
8464+ class { @imported @imported() imported },
8465+ class { @unbound @unbound() unbound },
8466+ class { @constant @constant() constant },
8467+ class { @undef @undef() undef },
8468+
8469+ class { @(element[access]) indexed },
8470+ class { @foo.#bar private },
8471+ class { @foo.\u30FF unicode },
8472+ class { @(() => {}) arrow },
8473+ ]
8474+ }
8475+ ` ,
8476+ "/constants.js" : `
8477+ export const constant = 123
8478+ ` ,
8479+ "/empty.js" : `` ,
8480+ },
8481+ entryPaths : []string {"/entry.js" },
8482+ options : config.Options {
8483+ Mode : config .ModeBundle ,
8484+ OutputFormat : config .FormatESModule ,
8485+ AbsOutputFile : "/out.js" ,
8486+ ExternalPackages : true ,
8487+ MinifySyntax : true ,
8488+ },
8489+ expectedCompileLog : `entry.js: WARNING: Import "undef" will always be undefined because the file "empty.js" has no exports
8490+ ` ,
8491+ })
8492+ }
8493+
8494+ func TestDecoratorPrintingCJS (t * testing.T ) {
8495+ default_suite .expectBundled (t , bundled {
8496+ files : map [string ]string {
8497+ "/entry.js" : `
8498+ import { constant } from './constants'
8499+ import { imported } from 'somewhere'
8500+ import { undef } from './empty'
8501+
8502+ _ = class Outer {
8503+ #bar;
8504+
8505+ classes = [
8506+ class { @imported @imported() imported },
8507+ class { @unbound @unbound() unbound },
8508+ class { @constant @constant() constant },
8509+ class { @undef @undef() undef },
8510+
8511+ class { @(element[access]) indexed },
8512+ class { @foo.#bar private },
8513+ class { @foo.\u30FF unicode },
8514+ class { @(() => {}) arrow },
8515+ ]
8516+ }
8517+ ` ,
8518+ "/constants.js" : `
8519+ export const constant = 123
8520+ ` ,
8521+ "/empty.js" : `` ,
8522+ },
8523+ entryPaths : []string {"/entry.js" },
8524+ options : config.Options {
8525+ Mode : config .ModeBundle ,
8526+ OutputFormat : config .FormatCommonJS ,
8527+ AbsOutputFile : "/out.js" ,
8528+ ExternalPackages : true ,
8529+ MinifySyntax : true ,
8530+ },
8531+ expectedCompileLog : `entry.js: WARNING: Import "undef" will always be undefined because the file "empty.js" has no exports
8532+ ` ,
8533+ })
8534+ }
0 commit comments