@atlaspack/transformer-compiled 0.1.1-dev-swc44-3ef36b21e.0 → 0.2.0

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.
@@ -10,6 +10,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
10
10
  * allowing users to transition without any change in functionality.
11
11
  */
12
12
  const path_1 = require("path");
13
+ const assert_1 = __importDefault(require("assert"));
13
14
  const core_1 = require("@babel/core");
14
15
  const generator_1 = __importDefault(require("@babel/generator"));
15
16
  const utils_1 = require("@compiled/utils");
@@ -17,6 +18,14 @@ const plugin_1 = require("@atlaspack/plugin");
17
18
  const source_map_1 = __importDefault(require("@atlaspack/source-map"));
18
19
  const utils_2 = require("@atlaspack/utils");
19
20
  const utils_3 = require("./utils");
21
+ const babel_plugin_1 = __importDefault(require("@compiled/babel-plugin"));
22
+ const babel_plugin_strip_runtime_1 = __importDefault(require("@compiled/babel-plugin-strip-runtime"));
23
+ // @ts-expect-error no declaration file
24
+ // eslint-disable-next-line import/no-extraneous-dependencies
25
+ const plugin_syntax_jsx_1 = __importDefault(require("@babel/plugin-syntax-jsx"));
26
+ // @ts-expect-error no declaration file
27
+ // eslint-disable-next-line import/no-extraneous-dependencies
28
+ const plugin_syntax_typescript_1 = __importDefault(require("@babel/plugin-syntax-typescript"));
20
29
  const configFiles = [
21
30
  '.compiledcssrc',
22
31
  '.compiledcssrc.json',
@@ -28,7 +37,7 @@ const packageKey = '@atlaspack/transformer-compiled';
28
37
  * Atlaspack Compiled transformer.
29
38
  */
30
39
  exports.default = new plugin_1.Transformer({
31
- async loadConfig({ config, options }) {
40
+ async setup({ config, options }) {
32
41
  const conf = await config.getConfigFrom((0, path_1.join)(options.projectRoot, 'index'), configFiles, {
33
42
  packageKey,
34
43
  });
@@ -58,68 +67,72 @@ exports.default = new plugin_1.Transformer({
58
67
  }
59
68
  Object.assign(contents, conf.contents);
60
69
  }
61
- return contents;
62
- },
63
- canReuseAST() {
64
- // Compiled should run before any other JS transformer.
65
- return false;
70
+ let importSourceMatches = [
71
+ ...utils_1.DEFAULT_IMPORT_SOURCES,
72
+ ...(contents.importSources || []),
73
+ ];
74
+ return {
75
+ config: {
76
+ compiledConfig: contents,
77
+ mode: options.mode,
78
+ projectRoot: options.projectRoot,
79
+ },
80
+ conditions: {
81
+ codeMatch: importSourceMatches,
82
+ },
83
+ env: [
84
+ // TODO revisit this list, since we may have added variables in here that were actually enumarated rather than accessed directly
85
+ 'BABEL_ENV',
86
+ 'BABEL_SHOW_CONFIG_FOR',
87
+ 'BROWSERSLIST',
88
+ 'BROWSERSLIST_CONFIG',
89
+ 'BROWSERSLIST_DISABLE_CACHE',
90
+ 'BROWSERSLIST_ENV',
91
+ 'BROWSERSLIST_IGNORE_OLD_DATA',
92
+ 'BABEL_TYPES_8_BREAKING',
93
+ 'BROWSERSLIST_ROOT_PATH',
94
+ 'BROWSERSLIST_STATS',
95
+ 'AUTOPREFIXER',
96
+ 'AUTOPREFIXER_GRID',
97
+ 'TEST_PKG_VERSION',
98
+ 'FORCE_COLOR',
99
+ 'DEBUG',
100
+ 'NODE_DEBUG',
101
+ 'CI',
102
+ 'COLORTERM',
103
+ ],
104
+ };
66
105
  },
67
- async parse({ asset, config, options }) {
106
+ async transform({ asset, config }) {
107
+ if (config.compiledConfig.extract &&
108
+ config.compiledConfig.classHashPrefix) {
109
+ throw new Error('`@atlaspack/transformer-compiled` is mixing `extract: true` and `classHashPrefix` options, which will not supported and will result in bundle size bloat.');
110
+ }
68
111
  // Disable stylesheet extraction locally due to https://github.com/atlassian-labs/compiled/issues/1306
69
- const extract = config.extract && options.mode !== 'development';
112
+ const extract = config.compiledConfig.extract && config.mode !== 'development';
70
113
  if (!asset.isSource && !extract) {
71
114
  // Only parse source (pre-built code should already have been baked) or if stylesheet extraction is enabled
72
- return undefined;
115
+ return [asset];
73
116
  }
74
117
  const code = await asset.getCode();
75
118
  if (
76
119
  // If neither Compiled (default) nor any of the additional import sources are found in the code, we bail out.
77
- [...utils_1.DEFAULT_IMPORT_SOURCES, ...(config.importSources || [])].every((importSource) => !code.includes(importSource))) {
120
+ [
121
+ ...utils_1.DEFAULT_IMPORT_SOURCES,
122
+ ...(config.compiledConfig.importSources || []),
123
+ ].every((importSource) => !code.includes(importSource))) {
78
124
  // We only want to parse files that are actually using Compiled.
79
125
  // For everything else we bail out.
80
- return undefined;
126
+ return [asset];
81
127
  }
82
128
  if (code.includes('/* COMPILED_TRANSFORMED_ASSET */')) {
83
129
  // If we're dealing with a pre-transformed asset, we bail out to avoid performing the expensive parse operation.
84
130
  // We add this marker to the code to indicate that the asset has already been transformed.
85
- return undefined;
86
- }
87
- const program = await (0, core_1.parseAsync)(code, {
88
- filename: asset.filePath,
89
- babelrc: false,
90
- configFile: false,
91
- caller: { name: 'compiled' },
92
- rootMode: 'upward-optional',
93
- parserOpts: {
94
- // @ts-expect-error - Type mismatch between @babel/parser and @compiled/utils versions
95
- plugins: config.parserBabelPlugins ?? utils_1.DEFAULT_PARSER_BABEL_PLUGINS,
96
- },
97
- plugins: config.transformerBabelPlugins ?? undefined,
98
- });
99
- if (program) {
100
- return {
101
- type: 'babel',
102
- version: '7.0.0',
103
- program,
104
- };
105
- }
106
- return undefined;
107
- },
108
- async transform({ asset, config, options }) {
109
- if (config.extract && config.classHashPrefix) {
110
- throw new Error('`@atlaspack/transformer-compiled` is mixing `extract: true` and `classHashPrefix` options, which will not supported and will result in bundle size bloat.');
111
- }
112
- const ast = await asset.getAST();
113
- if (!(ast?.type === 'babel' && ast.program)) {
114
- // We will only receive ASTs for assets we're interested in.
115
- // Since this is undefined (or in node modules) we aren't interested in it.
116
131
  return [asset];
117
132
  }
118
133
  // Disable stylesheet extraction locally due to https://github.com/atlassian-labs/compiled/issues/1306
119
- const extract = config.extract && options.mode !== 'development';
120
134
  const includedFiles = [];
121
- const code = asset.isASTDirty() ? undefined : await asset.getCode();
122
- const result = await (0, core_1.transformFromAstAsync)(ast.program, code, {
135
+ const result = await (0, core_1.transformAsync)(code, {
123
136
  code: false,
124
137
  ast: true,
125
138
  filename: asset.filePath,
@@ -127,29 +140,27 @@ exports.default = new plugin_1.Transformer({
127
140
  configFile: false,
128
141
  sourceMaps: !!asset.env.sourceMap,
129
142
  compact: false,
130
- parserOpts: {
131
- // @ts-expect-error - Type mismatch between @babel/parser and @compiled/utils versions
132
- plugins: config.parserBabelPlugins ?? utils_1.DEFAULT_PARSER_BABEL_PLUGINS,
133
- },
134
143
  plugins: [
135
- ...(config.transformerBabelPlugins ?? []),
144
+ plugin_syntax_jsx_1.default,
145
+ [plugin_syntax_typescript_1.default, { isTSX: true }],
136
146
  asset.isSource && [
137
- '@compiled/babel-plugin',
147
+ babel_plugin_1.default,
138
148
  {
139
149
  ...config,
140
- classNameCompressionMap: config.extract && config.classNameCompressionMap,
150
+ classNameCompressionMap: config.compiledConfig.extract &&
151
+ config.compiledConfig.classNameCompressionMap,
141
152
  onIncludedFiles: (files) => includedFiles.push(...files),
142
- resolver: config.resolver
143
- ? config.resolver
144
- : (0, utils_3.createDefaultResolver)(config),
153
+ resolver: config.compiledConfig.resolver
154
+ ? config.compiledConfig.resolver
155
+ : (0, utils_3.createDefaultResolver)(config.compiledConfig),
145
156
  cache: false,
146
157
  },
147
158
  ],
148
159
  extract && [
149
- '@compiled/babel-plugin-strip-runtime',
160
+ babel_plugin_strip_runtime_1.default,
150
161
  {
151
162
  compiledRequireExclude: true,
152
- extractStylesToDirectory: config.extractStylesToDirectory,
163
+ extractStylesToDirectory: config.compiledConfig.extractStylesToDirectory,
153
164
  },
154
165
  ],
155
166
  ].filter(utils_1.toBoolean),
@@ -171,24 +182,16 @@ exports.default = new plugin_1.Transformer({
171
182
  ...(metadata.styleRules ?? []),
172
183
  ];
173
184
  }
174
- if (result?.ast) {
175
- asset.setAST({
176
- type: 'babel',
177
- version: '7.0.0',
178
- program: result.ast,
179
- });
180
- }
181
- return [asset];
182
- },
183
- async generate({ asset, ast, options }) {
184
185
  const originalSourceMap = await asset.getMap();
185
- const sourceFileName = (0, utils_2.relativeUrl)(options.projectRoot, asset.filePath);
186
- const { code, rawMappings } = (0, generator_1.default)(ast.program, {
186
+ const sourceFileName = (0, utils_2.relativeUrl)(config.projectRoot, asset.filePath);
187
+ (0, assert_1.default)(result?.ast, 'Babel transform returned no AST');
188
+ const { code: generatedCode, rawMappings } = (0, generator_1.default)(result.ast.program, {
187
189
  sourceFileName,
188
190
  sourceMaps: !!asset.env.sourceMap,
189
191
  comments: true,
190
192
  });
191
- const map = new source_map_1.default(options.projectRoot);
193
+ asset.setCode(generatedCode);
194
+ const map = new source_map_1.default(config.projectRoot);
192
195
  if (rawMappings) {
193
196
  map.addIndexedMappings(rawMappings);
194
197
  }
@@ -203,9 +206,6 @@ exports.default = new plugin_1.Transformer({
203
206
  }
204
207
  }
205
208
  }
206
- return {
207
- content: code,
208
- map,
209
- };
209
+ return [asset];
210
210
  },
211
211
  });
@@ -1,7 +1,13 @@
1
1
  import { Transformer } from '@atlaspack/plugin';
2
2
  import type { CompiledTransformerOpts } from './types';
3
+ import { BuildMode } from '@atlaspack/types';
4
+ interface Config {
5
+ compiledConfig: CompiledTransformerOpts;
6
+ mode: BuildMode;
7
+ projectRoot: string;
8
+ }
3
9
  /**
4
10
  * Atlaspack Compiled transformer.
5
11
  */
6
- declare const _default: Transformer<CompiledTransformerOpts>;
12
+ declare const _default: Transformer<Config>;
7
13
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/transformer-compiled",
3
- "version": "0.1.1-dev-swc44-3ef36b21e.0",
3
+ "version": "0.2.0",
4
4
  "description": "Atlaspack transformer for Compiled CSS-in-JS (insourced from @compiled/parcel-transformer)",
5
5
  "license": "(MIT OR Apache-2.0)",
6
6
  "publishConfig": {
@@ -21,22 +21,23 @@
21
21
  "src"
22
22
  ],
23
23
  "dependencies": {
24
- "@atlaspack/plugin": "2.14.46-dev-swc44-3ef36b21e.0",
25
- "@atlaspack/source-map": "3.2.1-dev-swc44-3ef36b21e.0",
26
- "@atlaspack/utils": "3.2.7-dev-swc44-3ef36b21e.0",
24
+ "@atlaspack/plugin": "2.14.46",
25
+ "@atlaspack/source-map": "3.2.1",
26
+ "@atlaspack/utils": "3.2.7",
27
27
  "@babel/core": "^7.22.11",
28
28
  "@babel/generator": "^7.22.10",
29
+ "@babel/plugin-syntax-jsx": "^7.27.1",
30
+ "@babel/plugin-syntax-typescript": "^7.27.1",
29
31
  "@compiled/babel-plugin": "^0.38.0",
30
32
  "@compiled/babel-plugin-strip-runtime": "^0.38.0",
31
33
  "@compiled/utils": "^0.13.1",
32
34
  "enhanced-resolve": "^5.18.1"
33
35
  },
34
36
  "devDependencies": {
35
- "@atlaspack/types": "2.15.36-dev-swc44-3ef36b21e.0"
37
+ "@atlaspack/types": "2.15.36"
36
38
  },
37
39
  "type": "commonjs",
38
40
  "scripts": {
39
41
  "build:lib": "gulp build --gulpfile ../../../gulpfile.js --cwd ."
40
- },
41
- "gitHead": "3ef36b21e388934416729737de94a47adf5e6ca4"
42
+ }
42
43
  }
@@ -5,25 +5,31 @@
5
5
  * allowing users to transition without any change in functionality.
6
6
  */
7
7
  import {join} from 'path';
8
+ import assert from 'assert';
8
9
 
9
- import {parseAsync, transformFromAstAsync} from '@babel/core';
10
+ import {transformAsync} from '@babel/core';
10
11
  import generate from '@babel/generator';
11
12
  import type {PluginOptions as BabelPluginOptions} from '@compiled/babel-plugin';
12
13
  import type {
13
14
  PluginOptions as BabelStripRuntimePluginOptions,
14
15
  BabelFileMetadata,
15
16
  } from '@compiled/babel-plugin-strip-runtime';
16
- import {
17
- DEFAULT_IMPORT_SOURCES,
18
- DEFAULT_PARSER_BABEL_PLUGINS,
19
- toBoolean,
20
- } from '@compiled/utils';
17
+ import {DEFAULT_IMPORT_SOURCES, toBoolean} from '@compiled/utils';
21
18
  import {Transformer} from '@atlaspack/plugin';
22
19
  import SourceMap from '@atlaspack/source-map';
23
20
  import {relativeUrl} from '@atlaspack/utils';
24
21
 
25
22
  import type {CompiledTransformerOpts} from './types';
26
23
  import {createDefaultResolver} from './utils';
24
+ import {BuildMode} from '@atlaspack/types';
25
+ import CompiledBabelPlugin from '@compiled/babel-plugin';
26
+ import CompiledBabelPluginStripRuntime from '@compiled/babel-plugin-strip-runtime';
27
+ // @ts-expect-error no declaration file
28
+ // eslint-disable-next-line import/no-extraneous-dependencies
29
+ import BabelPluginSyntaxJsx from '@babel/plugin-syntax-jsx';
30
+ // @ts-expect-error no declaration file
31
+ // eslint-disable-next-line import/no-extraneous-dependencies
32
+ import BabelPluginSyntaxTypescript from '@babel/plugin-syntax-typescript';
27
33
 
28
34
  const configFiles = [
29
35
  '.compiledcssrc',
@@ -34,11 +40,17 @@ const configFiles = [
34
40
 
35
41
  const packageKey = '@atlaspack/transformer-compiled';
36
42
 
43
+ interface Config {
44
+ compiledConfig: CompiledTransformerOpts;
45
+ mode: BuildMode;
46
+ projectRoot: string;
47
+ }
48
+
37
49
  /**
38
50
  * Atlaspack Compiled transformer.
39
51
  */
40
- export default new Transformer<CompiledTransformerOpts>({
41
- async loadConfig({config, options}) {
52
+ export default new Transformer<Config>({
53
+ async setup({config, options}) {
42
54
  const conf = await config.getConfigFrom<CompiledTransformerOpts>(
43
55
  join(options.projectRoot, 'index'),
44
56
  configFiles,
@@ -84,84 +96,84 @@ export default new Transformer<CompiledTransformerOpts>({
84
96
  Object.assign(contents, conf.contents);
85
97
  }
86
98
 
87
- return contents;
88
- },
99
+ let importSourceMatches = [
100
+ ...DEFAULT_IMPORT_SOURCES,
101
+ ...(contents.importSources || []),
102
+ ];
89
103
 
90
- canReuseAST() {
91
- // Compiled should run before any other JS transformer.
92
- return false;
104
+ return {
105
+ config: {
106
+ compiledConfig: contents,
107
+ mode: options.mode,
108
+ projectRoot: options.projectRoot,
109
+ },
110
+ conditions: {
111
+ codeMatch: importSourceMatches,
112
+ },
113
+ env: [
114
+ // TODO revisit this list, since we may have added variables in here that were actually enumarated rather than accessed directly
115
+ 'BABEL_ENV',
116
+ 'BABEL_SHOW_CONFIG_FOR',
117
+ 'BROWSERSLIST',
118
+ 'BROWSERSLIST_CONFIG',
119
+ 'BROWSERSLIST_DISABLE_CACHE',
120
+ 'BROWSERSLIST_ENV',
121
+ 'BROWSERSLIST_IGNORE_OLD_DATA',
122
+ 'BABEL_TYPES_8_BREAKING',
123
+ 'BROWSERSLIST_ROOT_PATH',
124
+ 'BROWSERSLIST_STATS',
125
+ 'AUTOPREFIXER',
126
+ 'AUTOPREFIXER_GRID',
127
+ 'TEST_PKG_VERSION',
128
+ 'FORCE_COLOR',
129
+ 'DEBUG',
130
+ 'NODE_DEBUG',
131
+ 'CI',
132
+ 'COLORTERM',
133
+ ],
134
+ };
93
135
  },
94
136
 
95
- async parse({asset, config, options}) {
137
+ async transform({asset, config}) {
138
+ if (
139
+ config.compiledConfig.extract &&
140
+ config.compiledConfig.classHashPrefix
141
+ ) {
142
+ throw new Error(
143
+ '`@atlaspack/transformer-compiled` is mixing `extract: true` and `classHashPrefix` options, which will not supported and will result in bundle size bloat.',
144
+ );
145
+ }
146
+
96
147
  // Disable stylesheet extraction locally due to https://github.com/atlassian-labs/compiled/issues/1306
97
- const extract = config.extract && options.mode !== 'development';
148
+ const extract =
149
+ config.compiledConfig.extract && config.mode !== 'development';
98
150
  if (!asset.isSource && !extract) {
99
151
  // Only parse source (pre-built code should already have been baked) or if stylesheet extraction is enabled
100
- return undefined;
152
+ return [asset];
101
153
  }
102
154
 
103
155
  const code = await asset.getCode();
104
156
  if (
105
157
  // If neither Compiled (default) nor any of the additional import sources are found in the code, we bail out.
106
- [...DEFAULT_IMPORT_SOURCES, ...(config.importSources || [])].every(
107
- (importSource) => !code.includes(importSource),
108
- )
158
+ [
159
+ ...DEFAULT_IMPORT_SOURCES,
160
+ ...(config.compiledConfig.importSources || []),
161
+ ].every((importSource) => !code.includes(importSource))
109
162
  ) {
110
163
  // We only want to parse files that are actually using Compiled.
111
164
  // For everything else we bail out.
112
- return undefined;
165
+ return [asset];
113
166
  }
114
167
  if (code.includes('/* COMPILED_TRANSFORMED_ASSET */')) {
115
168
  // If we're dealing with a pre-transformed asset, we bail out to avoid performing the expensive parse operation.
116
169
  // We add this marker to the code to indicate that the asset has already been transformed.
117
- return undefined;
118
- }
119
-
120
- const program = await parseAsync(code, {
121
- filename: asset.filePath,
122
- babelrc: false,
123
- configFile: false,
124
- caller: {name: 'compiled'},
125
- rootMode: 'upward-optional',
126
- parserOpts: {
127
- // @ts-expect-error - Type mismatch between @babel/parser and @compiled/utils versions
128
- plugins: config.parserBabelPlugins ?? DEFAULT_PARSER_BABEL_PLUGINS,
129
- },
130
- plugins: config.transformerBabelPlugins ?? undefined,
131
- });
132
-
133
- if (program) {
134
- return {
135
- type: 'babel',
136
- version: '7.0.0',
137
- program,
138
- };
139
- }
140
-
141
- return undefined;
142
- },
143
-
144
- async transform({asset, config, options}) {
145
- if (config.extract && config.classHashPrefix) {
146
- throw new Error(
147
- '`@atlaspack/transformer-compiled` is mixing `extract: true` and `classHashPrefix` options, which will not supported and will result in bundle size bloat.',
148
- );
149
- }
150
-
151
- const ast = await asset.getAST();
152
-
153
- if (!(ast?.type === 'babel' && ast.program)) {
154
- // We will only receive ASTs for assets we're interested in.
155
- // Since this is undefined (or in node modules) we aren't interested in it.
156
170
  return [asset];
157
171
  }
158
172
 
159
173
  // Disable stylesheet extraction locally due to https://github.com/atlassian-labs/compiled/issues/1306
160
- const extract = config.extract && options.mode !== 'development';
161
174
  const includedFiles: string[] = [];
162
- const code = asset.isASTDirty() ? undefined : await asset.getCode();
163
175
 
164
- const result = await transformFromAstAsync(ast.program, code, {
176
+ const result = await transformAsync(code, {
165
177
  code: false,
166
178
  ast: true,
167
179
  filename: asset.filePath,
@@ -169,30 +181,29 @@ export default new Transformer<CompiledTransformerOpts>({
169
181
  configFile: false,
170
182
  sourceMaps: !!asset.env.sourceMap,
171
183
  compact: false,
172
- parserOpts: {
173
- // @ts-expect-error - Type mismatch between @babel/parser and @compiled/utils versions
174
- plugins: config.parserBabelPlugins ?? DEFAULT_PARSER_BABEL_PLUGINS,
175
- },
176
184
  plugins: [
177
- ...(config.transformerBabelPlugins ?? []),
185
+ BabelPluginSyntaxJsx,
186
+ [BabelPluginSyntaxTypescript, {isTSX: true}],
178
187
  asset.isSource && [
179
- '@compiled/babel-plugin',
188
+ CompiledBabelPlugin,
180
189
  {
181
190
  ...config,
182
191
  classNameCompressionMap:
183
- config.extract && config.classNameCompressionMap,
192
+ config.compiledConfig.extract &&
193
+ config.compiledConfig.classNameCompressionMap,
184
194
  onIncludedFiles: (files: string[]) => includedFiles.push(...files),
185
- resolver: config.resolver
186
- ? config.resolver
187
- : createDefaultResolver(config),
195
+ resolver: config.compiledConfig.resolver
196
+ ? config.compiledConfig.resolver
197
+ : createDefaultResolver(config.compiledConfig),
188
198
  cache: false,
189
199
  } as BabelPluginOptions,
190
200
  ],
191
201
  extract && [
192
- '@compiled/babel-plugin-strip-runtime',
202
+ CompiledBabelPluginStripRuntime,
193
203
  {
194
204
  compiledRequireExclude: true,
195
- extractStylesToDirectory: config.extractStylesToDirectory,
205
+ extractStylesToDirectory:
206
+ config.compiledConfig.extractStylesToDirectory,
196
207
  } as BabelStripRuntimePluginOptions,
197
208
  ],
198
209
  ].filter(toBoolean),
@@ -217,25 +228,15 @@ export default new Transformer<CompiledTransformerOpts>({
217
228
  ];
218
229
  }
219
230
 
220
- if (result?.ast) {
221
- asset.setAST({
222
- type: 'babel',
223
- version: '7.0.0',
224
- program: result.ast,
225
- });
226
- }
227
-
228
- return [asset];
229
- },
230
-
231
- async generate({asset, ast, options}) {
232
231
  const originalSourceMap = await asset.getMap();
233
232
  const sourceFileName: string = relativeUrl(
234
- options.projectRoot,
233
+ config.projectRoot,
235
234
  asset.filePath,
236
235
  );
237
236
 
238
- const {code, rawMappings} = generate(ast.program, {
237
+ assert(result?.ast, 'Babel transform returned no AST');
238
+
239
+ const {code: generatedCode, rawMappings} = generate(result.ast.program, {
239
240
  sourceFileName,
240
241
  sourceMaps: !!asset.env.sourceMap,
241
242
  comments: true,
@@ -249,7 +250,9 @@ export default new Transformer<CompiledTransformerOpts>({
249
250
  }>;
250
251
  };
251
252
 
252
- const map = new SourceMap(options.projectRoot);
253
+ asset.setCode(generatedCode);
254
+
255
+ const map = new SourceMap(config.projectRoot);
253
256
  if (rawMappings) {
254
257
  map.addIndexedMappings(rawMappings);
255
258
  }
@@ -266,9 +269,6 @@ export default new Transformer<CompiledTransformerOpts>({
266
269
  }
267
270
  }
268
271
 
269
- return {
270
- content: code,
271
- map,
272
- };
272
+ return [asset];
273
273
  },
274
274
  });
package/LICENSE DELETED
@@ -1,201 +0,0 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for reasonable and customary use in describing the
141
- origin of the Work and reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS
177
-
178
- APPENDIX: How to apply the Apache License to your work.
179
-
180
- To apply the Apache License to your work, attach the following
181
- boilerplate notice, with the fields enclosed by brackets "[]"
182
- replaced with your own identifying information. (Don't include
183
- the brackets!) The text should be enclosed in the appropriate
184
- comment syntax for the file format. We also recommend that a
185
- file or class name and description of purpose be included on the
186
- same "printed page" as the copyright notice for easier
187
- identification within third-party archives.
188
-
189
- Copyright (c) 2024 Atlassian US., Inc.
190
-
191
- Licensed under the Apache License, Version 2.0 (the "License");
192
- you may not use this file except in compliance with the License.
193
- You may obtain a copy of the License at
194
-
195
- http://www.apache.org/licenses/LICENSE-2.0
196
-
197
- Unless required by applicable law or agreed to in writing, software
198
- distributed under the License is distributed on an "AS IS" BASIS,
199
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
- See the License for the specific language governing permissions and
201
- limitations under the License.