@parcel/macros 2.11.1-dev.3133

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.
Files changed (3) hide show
  1. package/LICENSE +21 -0
  2. package/macros.d.ts +42 -0
  3. package/package.json +23 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2017-present Devon Govett
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/macros.d.ts ADDED
@@ -0,0 +1,42 @@
1
+ export interface MacroContext {
2
+ /** Adds an asset as a dependency of the JS module that called this macro. */
3
+ addAsset(asset: MacroAsset): void;
4
+ /** Invalidate the macro call whenever the given file changes. */
5
+ invalidateOnFileChange(filePath: string): void;
6
+ /** Invalidate the macro call when a file matching the given pattern is created. */
7
+ invalidateOnFileCreate(options: FileCreateInvalidation): void;
8
+ /** Invalidate the macro whenever the given environment variable changes. */
9
+ invalidateOnEnvChange(env: string): void;
10
+ /** Invalidate the macro whenever Parcel restarts. */
11
+ invalidateOnStartup(): void;
12
+ /** Invalidate the macro on every build. */
13
+ invalidateOnBuild(): void;
14
+ }
15
+
16
+ export interface MacroAsset {
17
+ /** The type of the asset (e.g. `'css'`). */
18
+ type: string;
19
+ /** The content of the asset. */
20
+ content: string;
21
+ }
22
+
23
+ export type FileCreateInvalidation =
24
+ | FileInvalidation
25
+ | GlobInvalidation
26
+ | FileAboveInvalidation;
27
+
28
+ /** Invalidate when a file matching a glob is created. */
29
+ export interface GlobInvalidation {
30
+ glob: string;
31
+ }
32
+
33
+ /** Invalidate when a specific file is created. */
34
+ export interface FileInvalidation {
35
+ filePath: string;
36
+ }
37
+
38
+ /** Invalidate when a file of a specific name is created above a certain directory in the hierarchy. */
39
+ export interface FileAboveInvalidation {
40
+ fileName: string;
41
+ aboveFilePath: string;
42
+ }
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "@parcel/macros",
3
+ "version": "2.11.1-dev.3133+a9bb85adf",
4
+ "license": "MIT",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "funding": {
9
+ "type": "opencollective",
10
+ "url": "https://opencollective.com/parcel"
11
+ },
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "https://github.com/parcel-bundler/parcel.git"
15
+ },
16
+ "types": "macros.d.ts",
17
+ "sideEffects": false,
18
+ "engines": {
19
+ "node": ">= 12.0.0",
20
+ "parcel": "^2.0.0-dev.1508+a9bb85adf"
21
+ },
22
+ "gitHead": "a9bb85adf8f3b38631e178b3aacaa30c78696e36"
23
+ }