Skip to content

Commit

Permalink
Telemetry tracking event for emotion feature
Browse files Browse the repository at this point in the history
  • Loading branch information
Brooooooklyn committed Mar 12, 2022
1 parent 3ca467c commit 13b02d4
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/next-swc/crates/napi/src/transform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ impl Task for TransformTask {
self.c.cm.clone(),
fm.clone(),
&options,
self.c.comments().clone(),
self.c.comments(),
);
self.c.process_js_with_custom_pass(
fm,
Expand Down
1 change: 1 addition & 0 deletions packages/next/build/webpack-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1504,6 +1504,7 @@ export default async function getBaseWebpackConfig(
],
['swcRemoveConsole', !!config.compiler?.removeConsole],
['swcImportSource', !!jsConfig?.compilerOptions?.jsxImportSource],
['swcEmotion', !!config.experimental.emotion],
])
),
].filter(Boolean as any as ExcludesFalse),
Expand Down
2 changes: 2 additions & 0 deletions packages/next/build/webpack/plugins/telemetry-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ type Feature =
| 'swcExperimentalDecorators'
| 'swcRemoveConsole'
| 'swcImportSource'
| 'swcEmotion'

interface FeatureUsage {
featureName: Feature
Expand Down Expand Up @@ -50,6 +51,7 @@ const BUILD_FEATURES: Array<Feature> = [
'swcExperimentalDecorators',
'swcRemoveConsole',
'swcImportSource',
'swcEmotion',
]

/**
Expand Down
1 change: 1 addition & 0 deletions packages/next/telemetry/events/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ export type EventBuildFeatureUsage = {
| 'swcExperimentalDecorators'
| 'swcRemoveConsole'
| 'swcImportSource'
| 'swcEmotion'
| 'build-lint'
invocationCount: number
}
Expand Down
1 change: 1 addition & 0 deletions test/integration/telemetry/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,7 @@ describe('Telemetry CLI', () => {
regex.exec(stderr).pop() // swcReactRemoveProperties
regex.exec(stderr).pop() // swcRemoveConsole
regex.exec(stderr).pop() // swcImportSource
regex.exec(stderr).pop() // swcEmotion
const image = regex.exec(stderr).pop()
expect(image).toContain(`"featureName": "next/image"`)
expect(image).toContain(`"invocationCount": 1`)
Expand Down

0 comments on commit 13b02d4

Please sign in to comment.