-
-
Notifications
You must be signed in to change notification settings - Fork 203
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(custom-esbuild): add support for plugin configuration
- Loading branch information
1 parent
a64a028
commit 81890a5
Showing
15 changed files
with
124 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
examples/custom-esbuild/sanity-esbuild-app-esm/esbuild/define-text-by-option-plugin.cjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
function defineTitleByOptionPlugin(pluginOptions) { | ||
return { | ||
name: 'define-title', | ||
setup(build) { | ||
const options = build.initialOptions; | ||
options.define.titleByOption = JSON.stringify(pluginOptions.title); | ||
}, | ||
}; | ||
}; | ||
|
||
module.exports = defineTitleByOptionPlugin; |
11 changes: 11 additions & 0 deletions
11
examples/custom-esbuild/sanity-esbuild-app-esm/esbuild/define-text-by-option-plugin.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
function defineTitleByOptionPlugin(pluginOptions) { | ||
return { | ||
name: 'define-title', | ||
setup(build) { | ||
const options = build.initialOptions; | ||
options.define.titleByOption = JSON.stringify(pluginOptions.title); | ||
}, | ||
}; | ||
}; | ||
|
||
export default defineTitleByOptionPlugin; |
13 changes: 13 additions & 0 deletions
13
examples/custom-esbuild/sanity-esbuild-app-esm/esbuild/define-text-by-option-plugin.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import type { Plugin, PluginBuild } from 'esbuild'; | ||
|
||
function defineTitleByOptionPlugin(pluginOptions: {title: string}): Plugin { | ||
return { | ||
name: 'define-title', | ||
setup(build: PluginBuild) { | ||
const options = build.initialOptions; | ||
options.define!['titleByOption'] = JSON.stringify(pluginOptions.title); | ||
}, | ||
}; | ||
}; | ||
|
||
export default defineTitleByOptionPlugin; |
2 changes: 2 additions & 0 deletions
2
examples/custom-esbuild/sanity-esbuild-app-esm/src/app/app.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
<h1>{{ title }}</h1> | ||
<h2>{{ subtitle }}</h2> | ||
<h3>{{ optionTitle }}</h3> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
examples/custom-esbuild/sanity-esbuild-app/esbuild/define-text-by-option-plugin.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
function defineTitleByOptionPlugin(pluginOptions) { | ||
return { | ||
name: 'define-title', | ||
setup(build) { | ||
const options = build.initialOptions; | ||
options.define.titleByOption = JSON.stringify(pluginOptions.title); | ||
}, | ||
}; | ||
}; | ||
|
||
module.exports = defineTitleByOptionPlugin; |
11 changes: 11 additions & 0 deletions
11
examples/custom-esbuild/sanity-esbuild-app/esbuild/define-text-by-option-plugin.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
function defineTitleByOptionPlugin(pluginOptions) { | ||
return { | ||
name: 'define-title', | ||
setup(build) { | ||
const options = build.initialOptions; | ||
options.define.titleByOption = JSON.stringify(pluginOptions.title); | ||
}, | ||
}; | ||
}; | ||
|
||
export default defineTitleByOptionPlugin; |
2 changes: 2 additions & 0 deletions
2
examples/custom-esbuild/sanity-esbuild-app/src/app/app.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
<h1>{{ title }}</h1> | ||
<h2>{{ subtitle }}</h2> | ||
<h3>{{ optionTitle }}</h3> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters