@flamework-experimental/core 2.0.0-alpha.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.
Files changed (65) hide show
  1. package/README.md +66 -0
  2. package/flamework.build +17 -0
  3. package/out/dependency.d.ts +18 -0
  4. package/out/dependency.luau +32 -0
  5. package/out/flamework.d.ts +78 -0
  6. package/out/flamework.luau +138 -0
  7. package/out/index.d.ts +28 -0
  8. package/out/init.luau +40 -0
  9. package/out/injectable.d.ts +13 -0
  10. package/out/injectable.luau +23 -0
  11. package/out/lifecycle/lifecycleInterfaces.d.ts +94 -0
  12. package/out/lifecycle/lifecycleInterfaces.luau +55 -0
  13. package/out/lifecycle/lifecyclePlugin.d.ts +85 -0
  14. package/out/lifecycle/lifecyclePlugin.luau +424 -0
  15. package/out/modding.d.ts +171 -0
  16. package/out/modding.luau +66 -0
  17. package/out/module/defaultModule.d.ts +5 -0
  18. package/out/module/defaultModule.luau +28 -0
  19. package/out/module/module.d.ts +78 -0
  20. package/out/module/module.luau +811 -0
  21. package/out/module/moduleBuilder.d.ts +88 -0
  22. package/out/module/moduleBuilder.luau +169 -0
  23. package/out/module/moduleDefinition.d.ts +105 -0
  24. package/out/module/moduleDefinition.luau +79 -0
  25. package/out/module/moduleHooks.d.ts +23 -0
  26. package/out/module/moduleHooks.luau +19 -0
  27. package/out/module/providerRegistration.d.ts +22 -0
  28. package/out/module/providerRegistration.luau +80 -0
  29. package/out/module/scopes.d.ts +40 -0
  30. package/out/module/scopes.luau +159 -0
  31. package/out/plugin/pluginDefinition.d.ts +128 -0
  32. package/out/plugin/pluginDefinition.luau +61 -0
  33. package/out/prelude.d.ts +8 -0
  34. package/out/prelude.luau +14 -0
  35. package/out/provider.d.ts +27 -0
  36. package/out/provider.luau +26 -0
  37. package/out/reflect.d.ts +60 -0
  38. package/out/reflect.luau +310 -0
  39. package/out/serialization/types.d.ts +86 -0
  40. package/out/serialization/types.luau +9 -0
  41. package/out/utility/constructors.d.ts +4 -0
  42. package/out/utility/constructors.luau +12 -0
  43. package/out/utility/convertConciseDependencyInfo.d.ts +5 -0
  44. package/out/utility/convertConciseDependencyInfo.luau +29 -0
  45. package/out/utility/getClassImplements.d.ts +7 -0
  46. package/out/utility/getClassImplements.luau +27 -0
  47. package/out/utility/getClassesInPath.d.ts +23 -0
  48. package/out/utility/getClassesInPath.luau +91 -0
  49. package/out/utility/globs.d.ts +9 -0
  50. package/out/utility/globs.luau +64 -0
  51. package/out/utility/metadata.d.ts +12 -0
  52. package/out/utility/metadata.luau +43 -0
  53. package/out/utility/pathRoot.d.ts +17 -0
  54. package/out/utility/pathRoot.luau +105 -0
  55. package/out/utility/recycleThread.d.ts +1 -0
  56. package/out/utility/recycleThread.luau +31 -0
  57. package/out/utility/runtimeConfig.d.ts +59 -0
  58. package/out/utility/runtimeConfig.luau +25 -0
  59. package/out/utility/tsImport.d.ts +6 -0
  60. package/out/utility/tsImport.luau +15 -0
  61. package/out/utility/types.d.ts +16 -0
  62. package/out/utility/types.luau +22 -0
  63. package/out/utility/writable.d.ts +4 -0
  64. package/out/utility/writable.luau +2 -0
  65. package/package.json +33 -0
@@ -0,0 +1,66 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ local Modding = {}
3
+ do
4
+ local _container = Modding
5
+ --[[
6
+ *
7
+ * This function is able to utilize Flamework's user macros to generate and inspect types.
8
+ * This function supports all values natively supported by Flamework's user macros.
9
+ *
10
+ * For example, if you want to retrieve the properties of an instance, you could write code like this:
11
+ * ```ts
12
+ * // Returns an array of all keys part of the union.
13
+ * const basePartKeys = Modding.inspect<InstancePropertyNames<BasePart>[]>();
14
+ * ```
15
+ *
16
+ * @metadata macro
17
+
18
+ ]]
19
+ local function inspect(value)
20
+ local _value = value
21
+ assert(_value)
22
+ return value
23
+ end
24
+ _container.inspect = inspect
25
+ --[[
26
+ *
27
+ * This type emits runtime equivalents of types, such as generating strings from string literal types.
28
+ *
29
+ * You are able to generate most TS types, including objects and tuples which will generate equivalent objects at runtime.
30
+ * Additionally, you can generate unions by using `Array<T>`, which will generate an array where each constituent of `T` is its own element.
31
+ *
32
+ * This type is primarily used to mark a user macro parameter as metadata, and is not necessary if you use other macro types.
33
+
34
+ ]]
35
+ --[[
36
+ *
37
+ * Creates an injectable type that can be used to modify dependency injection behavior.
38
+
39
+ ]]
40
+ --[[
41
+ *
42
+ * An internal type for intrinsic user macro metadata.
43
+ *
44
+ * @hidden
45
+
46
+ ]]
47
+ --[[
48
+ *
49
+ * This namespace contains types and metadata related to the current macro's callsite.
50
+
51
+ ]]
52
+ --[[
53
+ *
54
+ * This namespace contains types that allow you to perform functions or fetch metadata about specific types.
55
+
56
+ ]]
57
+ --[[
58
+ *
59
+ * Information about an injected dependency.
60
+
61
+ ]]
62
+ -- This is used so that nested `Modding.Injectable` calls are treated correctly.
63
+ end
64
+ return {
65
+ Modding = Modding,
66
+ }
@@ -0,0 +1,5 @@
1
+ import type { Module } from "./module";
2
+ export declare function getDefaultModule(): Module | undefined;
3
+ export declare function setDefaultModule(module: Module): void;
4
+ /** Releases the default if `module` is it; a module that never was the default changes nothing. */
5
+ export declare function clearDefaultModule(module: Module): void;
@@ -0,0 +1,28 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ --[[
3
+ *
4
+ * The module `Dependency<T>()` resolves against.
5
+ *
6
+ * The first root module ignited in a realm claims it, and igniting with `{ default: true }` replaces
7
+ * it. Extinguishing the default releases it, so the next root ignited becomes the default again --
8
+ * which is what lets a test ignite and extinguish a module per case without leaking one into the next.
9
+
10
+ ]]
11
+ local defaultModule
12
+ local function getDefaultModule()
13
+ return defaultModule
14
+ end
15
+ local function setDefaultModule(module)
16
+ defaultModule = module
17
+ end
18
+ --* Releases the default if `module` is it; a module that never was the default changes nothing.
19
+ local function clearDefaultModule(module)
20
+ if defaultModule == module then
21
+ defaultModule = nil
22
+ end
23
+ end
24
+ return {
25
+ getDefaultModule = getDefaultModule,
26
+ setDefaultModule = setDefaultModule,
27
+ clearDefaultModule = clearDefaultModule,
28
+ }
@@ -0,0 +1,78 @@
1
+ import { Modding } from "../modding";
2
+ import type { Constructor } from "../utility/constructors";
3
+ import type { Destructor, ExtractSingleCallback } from "../utility/types";
4
+ import type { IgniteOptions, ModuleState } from "./moduleDefinition";
5
+ /** What a lookup through a module and its imports found: where, and which class when it is a class provider. */
6
+ export interface ProviderLookup {
7
+ module: Module;
8
+ classValue?: object;
9
+ }
10
+ interface InternalModule {
11
+ }
12
+ export interface Module extends InternalModule {
13
+ /** The name the module reports itself by: set on the builder, or generated from where it was created. */
14
+ readonly debugName: string;
15
+ /**
16
+ * Whether ignition has completed and {@link extinguish} has not been called. What a module has
17
+ * to be before another can import it.
18
+ */
19
+ isIgnited: () => boolean;
20
+ /**
21
+ * This function manually fetches a dependency from this module, as opposed to dependency injection.
22
+ *
23
+ * @metadata macro
24
+ */
25
+ resolveDependency: <T = unknown>(info?: string | Modding.Target.DependencyConcise<T>) => T;
26
+ /**
27
+ * Terminates this module.
28
+ *
29
+ * This runs the plugins' `onExtinguished` hooks.
30
+ */
31
+ extinguish: () => void;
32
+ /**
33
+ * Registers a listener for the specified lifecycle event.
34
+ * You can optionally provide a function as a shorthand for lifecycle events with a single method.
35
+ *
36
+ * This function returns a destructor that can be used to disconnect the lifecycle event.
37
+ *
38
+ * @param value The object that implements the lifecycle event.
39
+ * @metadata macro
40
+ */
41
+ listen<T>(this: void, value: T, meta?: Modding.Target.Id<T>): Destructor;
42
+ /**
43
+ * Registers a listener for the specified lifecycle event, using a shorthand function.
44
+ * This overload can only be used on lifecycle events that have a single method.
45
+ *
46
+ * This function returns a destructor that can be used to disconnect the lifecycle event.
47
+ *
48
+ * @param value A shorthand function for the lifecycle event.
49
+ * @metadata macro
50
+ */
51
+ listen<T>(this: void, value: ExtractSingleCallback<T>, id?: Modding.Target.Id<T>, name?: Modding.Emit<keyof T>): Destructor;
52
+ /**
53
+ * Constructs a class through this module's dependency injection without registering it as a
54
+ * provider, and attaches it to any lifecycle events it implements.
55
+ *
56
+ * The instance is owned by this module: it is released when {@link extinguish} runs, or earlier
57
+ * via {@link removeClassInstance}.
58
+ */
59
+ createClassInstance: <T extends object>(constructor: Constructor<T>, config?: InstanceCreationConfig) => T;
60
+ /**
61
+ * Detaches an instance created by {@link createClassInstance} from its lifecycle events.
62
+ */
63
+ removeClassInstance: (instance: object) => void;
64
+ /**
65
+ * Whether {@link extinguish} has been called on this module.
66
+ */
67
+ isExtinguished: () => boolean;
68
+ }
69
+ interface InstanceCreationConfig {
70
+ /**
71
+ * When specified, this allows you to override dependency resolution.
72
+ *
73
+ * If this function returns `undefined`, then dependency resolution will fallback to the module's resolution.
74
+ */
75
+ overrideDependency?: (info: Modding.DependencyInfo) => unknown;
76
+ }
77
+ export declare function createModuleInstantiation(state: ModuleState, options?: IgniteOptions): Module;
78
+ export {};